Revert "Feature#61"
This commit is contained in:
WeiYe 2020-03-30 09:44:38 +08:00 committed by GitHub
commit 4b654f3515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 372 additions and 322 deletions

3
.gitignore vendored
View File

@ -13,5 +13,4 @@
/datax-rpc/target/
/datax-all.iml
/logs/
*-dev*
/data/
*-dev*

View File

@ -126,21 +126,6 @@
<systemPath>${basedir}/src/main/lib/sqljdbc4-4.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>local_policy</artifactId>
<version>4.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/local_policy.jar</systemPath>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>US_export_policy</artifactId>
<version>4.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/US_export_policy.jar</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>

View File

@ -102,7 +102,7 @@ public class JobInfoController {
}
}
} catch (ParseException e) {
return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_invalid"));
return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid"));
}
return new ReturnT<>(result);
}

View File

@ -74,7 +74,7 @@ public class JobTemplateController {
}
}
} catch (ParseException e) {
return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_invalid"));
return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid"));
}
return new ReturnT<>(result);
}

View File

@ -49,7 +49,7 @@ public class JobTrigger {
}
if (GlueTypeEnum.BEAN.getDesc().equals(jobInfo.getGlueType())) {
//解密账密
String json = JSONUtils.changeJson(jobInfo.getJobJson(), JSONUtils.decrypt);
String json = JSONUtils.decryptJson(jobInfo.getJobJson());
jobInfo.setJobJson(json);
}
if (StringUtils.isNotBlank(executorParam)) {

View File

@ -21,11 +21,11 @@ public class JwtUser implements UserDetails {
}
// 写一个能直接使用user创建jwtUser的构造器
public JwtUser(JobUser user, JobRole role) {
public JwtUser(JobUser user) {
id = user.getId();
username = user.getUsername();
password = user.getPassword();
authorities = Collections.singleton(new SimpleGrantedAuthority(role.getName()));
authorities = Collections.singleton(new SimpleGrantedAuthority(user.getRole()));
}
@Override

View File

@ -15,11 +15,8 @@ import com.wugui.datax.admin.entity.JobLogReport;
import com.wugui.datax.admin.mapper.*;
import com.wugui.datax.admin.service.JobService;
import com.wugui.datax.admin.util.CronUtil;
import com.wugui.datax.admin.util.JSONUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -55,7 +52,7 @@ public class JobServiceImpl implements JobService {
int list_count = jobInfoMapper.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, glueType, author);
// package result
Map<String, Object> maps = new HashMap<>();
Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal", list_count); // 总记录数
maps.put("recordsFiltered", list_count); // 过滤后的总记录数
maps.put("data", list); // 分页列表
@ -67,31 +64,31 @@ public class JobServiceImpl implements JobService {
// valid
JobGroup group = jobGroupMapper.load(jobInfo.getJobGroup());
if (group == null) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose") + I18nUtil.getString("jobinfo_field_jobgroup")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose") + I18nUtil.getString("jobinfo_field_jobgroup")));
}
if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_invalid"));
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid"));
}
if (jobInfo.getGlueType().equals(GlueTypeEnum.BEAN.getDesc()) && jobInfo.getJobJson().trim().length() <= 2) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobjson")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobjson")));
}
if (jobInfo.getJobDesc() == null || jobInfo.getJobDesc().trim().length() == 0) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
}
if (jobInfo.getAuthor() == null || jobInfo.getAuthor().trim().length() == 0) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
}
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
}
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
}
if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype") + I18nUtil.getString("system_unvalid")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype") + I18nUtil.getString("system_unvalid")));
}
if (GlueTypeEnum.BEAN == GlueTypeEnum.match(jobInfo.getGlueType()) && (jobInfo.getExecutorHandler() == null || jobInfo.getExecutorHandler().trim().length() == 0)) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + "JobHandler"));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + "JobHandler"));
}
// fix "\r" in shell
@ -127,15 +124,14 @@ public class JobServiceImpl implements JobService {
// add in db
jobInfo.setAddTime(new Date());
jobInfo.setJobJson(JSONUtils.changeJson(jobInfo.getJobJson(), JSONUtils.encrypt));
jobInfo.setUpdateTime(new Date());
jobInfo.setGlueUpdatetime(new Date());
jobInfoMapper.save(jobInfo);
if (jobInfo.getId() < 1) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add") + I18nUtil.getString("system_fail")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add") + I18nUtil.getString("system_fail")));
}
return new ReturnT<>(String.valueOf(jobInfo.getId()));
return new ReturnT<String>(String.valueOf(jobInfo.getId()));
}
@Override
@ -157,22 +153,22 @@ public class JobServiceImpl implements JobService {
// valid
if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_invalid"));
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid"));
}
if (jobInfo.getGlueType().equals(GlueTypeEnum.BEAN.getDesc()) && jobInfo.getJobJson().trim().length() <= 2) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobjson")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobjson")));
}
if (jobInfo.getJobDesc() == null || jobInfo.getJobDesc().trim().length() == 0) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));
}
if (jobInfo.getAuthor() == null || jobInfo.getAuthor().trim().length() == 0) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_author")));
}
if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy") + I18nUtil.getString("system_unvalid")));
}
if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy") + I18nUtil.getString("system_unvalid")));
}
// ChildJobId valid
@ -204,7 +200,7 @@ public class JobServiceImpl implements JobService {
// group valid
JobGroup jobGroup = jobGroupMapper.load(jobInfo.getJobGroup());
if (jobGroup == null) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup") + I18nUtil.getString("system_unvalid")));
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup") + I18nUtil.getString("system_unvalid")));
}
// stage job info
@ -224,15 +220,26 @@ public class JobServiceImpl implements JobService {
nextTriggerTime = nextValidTime.getTime();
} catch (ParseException e) {
logger.error(e.getMessage(), e);
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_invalid") + " | " + e.getMessage());
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") + " | " + e.getMessage());
}
}
BeanUtils.copyProperties(jobInfo,exists_jobInfo);
exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
exists_jobInfo.setJobCron(jobInfo.getJobCron());
exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
exists_jobInfo.setAuthor(jobInfo.getAuthor());
exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
exists_jobInfo.setTriggerNextTime(nextTriggerTime);
exists_jobInfo.setReplaceParam(jobInfo.getReplaceParam());
exists_jobInfo.setJvmParam(jobInfo.getJvmParam());
exists_jobInfo.setIncStartTime(jobInfo.getIncStartTime());
exists_jobInfo.setTriggerNextTime(nextTriggerTime);
exists_jobInfo.setUpdateTime(new Date());
exists_jobInfo.setGlueType(jobInfo.getGlueType());
exists_jobInfo.setPartitionInfo(jobInfo.getPartitionInfo());
@ -278,7 +285,7 @@ public class JobServiceImpl implements JobService {
nextTriggerTime = nextValidTime.getTime();
} catch (ParseException e) {
logger.error(e.getMessage(), e);
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_invalid") + " | " + e.getMessage());
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") + " | " + e.getMessage());
}
xxlJobInfo.setTriggerStatus(1);

View File

@ -49,7 +49,7 @@ public class JobTemplateServiceImpl implements JobTemplateService {
int list_count = jobTemplateMapper.pageListCount(start, length, jobGroup, jobDesc, executorHandler, author);
// package result
Map<String, Object> maps = new HashMap<>();
Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal", list_count); // 总记录数
maps.put("recordsFiltered", list_count); // 过滤后的总记录数
maps.put("data", list); // 分页列表
@ -64,7 +64,7 @@ public class JobTemplateServiceImpl implements JobTemplateService {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose")+I18nUtil.getString("jobinfo_field_jobgroup")) );
}
if (!CronExpression.isValidExpression(jobTemplate.getJobCron())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_invalid") );
return new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid") );
}
if (jobTemplate.getJobDesc()==null || jobTemplate.getJobDesc().trim().length()==0) {
return new ReturnT<String>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
@ -142,7 +142,7 @@ public class JobTemplateServiceImpl implements JobTemplateService {
// valid
if (!CronExpression.isValidExpression(jobTemplate.getJobCron())) {
return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_invalid"));
return new ReturnT<>(ReturnT.FAIL_CODE, I18nUtil.getString("jobinfo_field_cron_unvalid"));
}
if (jobTemplate.getJobDesc()==null || jobTemplate.getJobDesc().trim().length()==0) {
return new ReturnT<>(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobinfo_field_jobdesc")));

View File

@ -1,6 +1,5 @@
package com.wugui.datax.admin.service.impl;
import com.wugui.datax.admin.entity.JobRole;
import com.wugui.datax.admin.entity.JwtUser;
import com.wugui.datax.admin.entity.JobUser;
import com.wugui.datax.admin.mapper.JobUserMapper;
@ -25,8 +24,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
@Override
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
JobUser user = jobUserMapper.loadByUserName(s);
JobRole role = jobUserMapper.getRoleByUserId(user.getId());
return new JwtUser(user, role);
return new JwtUser(user);
}
}

View File

@ -1,5 +1,6 @@
package com.wugui.datax.admin.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -14,63 +15,105 @@ import com.alibaba.fastjson.JSONObject;
public class JSONUtils {
/**
* decrypt 解密
*/
public static Integer decrypt = 0;
/**
* decrypt 加密
*/
public static Integer encrypt = 1;
/**
* @param content
* @param key
* @param changeType 0加密 or 1解密
* 返回格式化的json
*
* @param object
* @return
*/
public static JSONObject change(String content, String key, Integer changeType) {
JSONObject keyObj = JSONObject.parseObject(JSONObject.parseObject(content).getString(key));
JSONObject params = JSONObject.parseObject(keyObj.getString("parameter"));
String dUsername = null, dPassword = null;
if (decrypt.equals(changeType)) { //解密
dUsername = AESUtil.decrypt(params.getString("username"));
dPassword = AESUtil.decrypt(params.getString("password"));
} else if (encrypt.equals(changeType)) {//加密
dUsername = AESUtil.encrypt(params.getString("username"));
dPassword = AESUtil.encrypt(params.getString("password"));
}
String username = dUsername == null ? params.getString("username") : dUsername;
String password = dPassword == null ? params.getString("password") : dPassword;
params.put("username", username);
params.put("password", password);
keyObj.put("parameter", params);
return keyObj;
public static String formatJson(Object object) {
return JSON.toJSONString(object, true);
}
/**
* @param jsonStr
* @param changeType 0加密 or 1解密
* @return jsonStr
*/
public static String changeJson(String jsonStr, Integer changeType) {
public static String decryptJson(String jsonStr) {
JSONObject json = JSONObject.parseObject(jsonStr);
JSONObject job = json.getJSONObject("job");
JSONArray contents = job.getJSONArray("content");
for (int i = 0; i < contents.size(); i++) {
String contentStr = contents.getString(i);
Object obj = contents.get(i);
if (decrypt.equals(changeType)) { //解密
((JSONObject) obj).put("reader", change(contentStr, "reader", decrypt));
((JSONObject) obj).put("writer", change(contentStr, "writer", decrypt));
} else if (encrypt.equals(changeType)) {//加密
((JSONObject) obj).put("reader", change(contentStr, "reader", encrypt));
((JSONObject) obj).put("writer", change(contentStr, "writer", encrypt));
}
JSONArray content = job.getJSONArray("content");
for (int i = 0; i < content.size(); i++) {
((JSONObject) content.get(i)).put("reader", decrypt(content.getString(i), "reader"));
((JSONObject) content.get(i)).put("writer", decrypt(content.getString(i), "writer"));
}
job.put("content", contents);
job.put("content", content);
json.put("job", job);
return json.toJSONString();
}
public static JSONObject decrypt(String content, String key) {
JSONObject writer = JSONObject.parseObject(JSONObject.parseObject(content).getString(key));
JSONObject writerParams = JSONObject.parseObject(writer.getString("parameter"));
String dUsername = AESUtil.decrypt(writerParams.getString("username"));
String username = dUsername == null ? writerParams.getString("username") : dUsername;
writerParams.put("username", username);
String dPassword = AESUtil.decrypt(writerParams.getString("password"));
String password = dPassword == null ? writerParams.getString("password") : dPassword;
writerParams.put("password", password);
writer.put("parameter", writerParams);
return writer;
}
public static void main(String[] args) {
String s = "{\n" +
" \"job\": {\n" +
" \"setting\": {\n" +
" \"speed\": {\n" +
" \"channel\": 3\n" +
" },\n" +
" \"errorLimit\": {\n" +
" \"record\": 0,\n" +
" \"percentage\": 0.02\n" +
" }\n" +
" },\n" +
" \"content\": [\n" +
" {\n" +
" \"reader\": {\n" +
" \"name\": \"mysqlreader\",\n" +
" \"parameter\": {\n" +
" \"username\": \"8ivlZcKGclwi5NwpuzkXzg==\",\n" +
" \"password\": \"fZfGM5387/mzCDxqjb2thQ==\",\n" +
" \"column\": [\n" +
" \"`id`\"\n" +
" ],\n" +
" \"splitPk\": \"\",\n" +
" \"connection\": [\n" +
" {\n" +
" \"table\": [\n" +
" \"datax_plugin\"\n" +
" ],\n" +
" \"jdbcUrl\": [\n" +
" \"jdbc:mysql://localhost:3306/datax_web\"\n" +
" ]\n" +
" }\n" +
" ]\n" +
" }\n" +
" },\n" +
" \"writer\": {\n" +
" \"name\": \"mysqlwriter\",\n" +
" \"parameter\": {\n" +
" \"username\": \"8ivlZcKGclwi5NwpuzkXzg==\",\n" +
" \"password\": \"fZfGM5387/mzCDxqjb2thQ==\",\n" +
" \"column\": [\n" +
" \"`id`\"\n" +
" ],\n" +
" \"preSql\": [\n" +
" \"\"\n" +
" ],\n" +
" \"connection\": [\n" +
" {\n" +
" \"table\": [\n" +
" \"job_log\"\n" +
" ],\n" +
" \"jdbcUrl\": \"jdbc:mysql://localhost:3306/datax_web\"\n" +
" }\n" +
" ]\n" +
" }\n" +
" }\n" +
" }\n" +
" ]\n" +
" }\n" +
"}";
System.out.println(decryptJson(s));
}
}

View File

@ -56,7 +56,7 @@ public class ServletUtils {
* <filter-name>requestContextFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>
*/
public static HttpServletResponse getResponse() {
HttpServletResponse response;
HttpServletResponse response = null;
try {
response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getResponse();
if (response == null) {

View File

@ -122,7 +122,7 @@ jobinfo_field_readerColumns=Reader Column
jobinfo_field_writerColumns=Writer Column
jobinfo_field_gluetype=运行模式
jobinfo_field_executorparam=任务参数
jobinfo_field_cron_invalid=Cron格式非法
jobinfo_field_cron_unvalid=Cron格式非法
jobinfo_field_cron_never_fire=Cron非法永远不会触发
jobinfo_field_author=负责人
jobinfo_field_timeout=任务超时时间

View File

@ -117,7 +117,7 @@ jobinfo_field_jobJSON=Job JSON
jobinfo_field_timeout=Job timeout period
jobinfo_field_gluetype=GLUE Type
jobinfo_field_executorparam=Param
jobinfo_field_cron_invalid=The Cron is illegal
jobinfo_field_cron_unvalid=The Cron is illegal
jobinfo_field_cron_never_fire=The Cron will never fire
jobinfo_field_author=Author
jobinfo_field_alarmemail=Alarm email

View File

@ -65,7 +65,7 @@
UPDATE job_user
SET
<if test="password != null and password != ''">
password = #{password}
password = #{password},
</if>
role = #{role},
permission = #{permission}

View File

@ -46,8 +46,8 @@ public class JobThread extends Thread {
public JobThread(int jobId, IJobHandler handler) {
this.jobId = jobId;
this.handler = handler;
this.triggerQueue = new LinkedBlockingQueue<>();
this.triggerLogIdSet = Collections.synchronizedSet(new HashSet<>());
this.triggerQueue = new LinkedBlockingQueue<TriggerParam>();
this.triggerLogIdSet = Collections.synchronizedSet(new HashSet<Long>());
}
public IJobHandler getHandler() {

View File

@ -70,7 +70,7 @@ public class DataXConfig {
* <artifactId>spring-cloud-commons</artifactId>
* <version>${version}</version>
* </dependency>
*AE
*
* 2配置文件或者容器启动变量
* spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
*

View File

@ -33,13 +33,13 @@ public class XxlRegistryBaseClient {
this.env = env;
// valid
if (adminAddress == null || adminAddress.trim().length() == 0) {
if (adminAddress==null || adminAddress.trim().length()==0) {
throw new RuntimeException("xxl-registry adminAddress empty");
}
if (biz == null || biz.trim().length() < 4 || biz.trim().length() > 255) {
if (biz==null || biz.trim().length()<4 || biz.trim().length()>255) {
throw new RuntimeException("xxl-registry biz empty Invalid[4~255]");
}
if (env == null || env.trim().length() < 2 || env.trim().length() > 255) {
if (env==null || env.trim().length()<2 || env.trim().length()>255) {
throw new RuntimeException("xxl-registry biz env Invalid[2~255]");
}
@ -59,17 +59,17 @@ public class XxlRegistryBaseClient {
* @param registryDataList
* @return
*/
public boolean registry(List<XxlRegistryDataParamVO> registryDataList) {
public boolean registry(List<XxlRegistryDataParamVO> registryDataList){
// valid
if (registryDataList == null || registryDataList.size() == 0) {
if (registryDataList==null || registryDataList.size()==0) {
throw new RuntimeException("xxl-registry registryDataList empty");
}
for (XxlRegistryDataParamVO registryParam : registryDataList) {
if (registryParam.getKey() == null || registryParam.getKey().trim().length() < 4 || registryParam.getKey().trim().length() > 255) {
for (XxlRegistryDataParamVO registryParam: registryDataList) {
if (registryParam.getKey()==null || registryParam.getKey().trim().length()<4 || registryParam.getKey().trim().length()>255) {
throw new RuntimeException("xxl-registry registryDataList#key Invalid[4~255]");
}
if (registryParam.getValue() == null || registryParam.getValue().trim().length() < 4 || registryParam.getValue().trim().length() > 255) {
if (registryParam.getValue()==null || registryParam.getValue().trim().length()<4 || registryParam.getValue().trim().length()>255) {
throw new RuntimeException("xxl-registry registryDataList#value Invalid[4~255]");
}
}
@ -88,12 +88,12 @@ public class XxlRegistryBaseClient {
// result
Map<String, Object> respObj = requestAndValid(pathUrl, paramsJson, 5);
return respObj != null ? true : false;
return respObj!=null?true:false;
}
private Map<String, Object> requestAndValid(String pathUrl, String requestBody, int timeout) {
private Map<String, Object> requestAndValid(String pathUrl, String requestBody, int timeout){
for (String adminAddressUrl : adminAddressArr) {
for (String adminAddressUrl: adminAddressArr) {
String finalUrl = adminAddressUrl + pathUrl;
// request
@ -106,15 +106,14 @@ public class XxlRegistryBaseClient {
Map<String, Object> resopnseMap = null;
try {
resopnseMap = BasicJson.parseMap(responseData);
} catch (Exception e) {
}
} catch (Exception e) { }
// valid resopnse
if (resopnseMap == null
if (resopnseMap==null
|| !resopnseMap.containsKey("code")
|| !"200".equals(String.valueOf(resopnseMap.get("code")))
) {
) {
logger.warn("XxlRegistryBaseClient response fail, responseData={}", responseData);
return null;
}
@ -134,14 +133,14 @@ public class XxlRegistryBaseClient {
*/
public boolean remove(List<XxlRegistryDataParamVO> registryDataList) {
// valid
if (registryDataList == null || registryDataList.size() == 0) {
if (registryDataList==null || registryDataList.size()==0) {
throw new RuntimeException("xxl-registry registryDataList empty");
}
for (XxlRegistryDataParamVO registryParam : registryDataList) {
if (registryParam.getKey() == null || registryParam.getKey().trim().length() < 4 || registryParam.getKey().trim().length() > 255) {
for (XxlRegistryDataParamVO registryParam: registryDataList) {
if (registryParam.getKey()==null || registryParam.getKey().trim().length()<4 || registryParam.getKey().trim().length()>255) {
throw new RuntimeException("xxl-registry registryDataList#key Invalid[4~255]");
}
if (registryParam.getValue() == null || registryParam.getValue().trim().length() < 4 || registryParam.getValue().trim().length() > 255) {
if (registryParam.getValue()==null || registryParam.getValue().trim().length()<4 || registryParam.getValue().trim().length()>255) {
throw new RuntimeException("xxl-registry registryDataList#value Invalid[4~255]");
}
}
@ -160,7 +159,7 @@ public class XxlRegistryBaseClient {
// result
Map<String, Object> respObj = requestAndValid(pathUrl, paramsJson, 5);
return respObj != null ? true : false;
return respObj!=null?true:false;
}
/**
@ -171,7 +170,7 @@ public class XxlRegistryBaseClient {
*/
public Map<String, TreeSet<String>> discovery(Set<String> keys) {
// valid
if (keys == null || keys.size() == 0) {
if (keys==null || keys.size()==0) {
throw new RuntimeException("xxl-registry keys empty");
}
@ -191,7 +190,7 @@ public class XxlRegistryBaseClient {
Map<String, Object> respObj = requestAndValid(pathUrl, paramsJson, 5);
// parse
if (respObj != null && respObj.containsKey("data")) {
if (respObj!=null && respObj.containsKey("data")) {
Map<String, TreeSet<String>> data = (Map<String, TreeSet<String>>) respObj.get("data");
return data;
}
@ -207,7 +206,7 @@ public class XxlRegistryBaseClient {
*/
public boolean monitor(Set<String> keys) {
// valid
if (keys == null || keys.size() == 0) {
if (keys==null || keys.size()==0) {
throw new RuntimeException("xxl-registry keys empty");
}
@ -225,7 +224,7 @@ public class XxlRegistryBaseClient {
// result
Map<String, Object> respObj = requestAndValid(pathUrl, paramsJson, 60);
return respObj != null ? true : false;
return respObj!=null?true:false;
}
}

View File

@ -14,7 +14,6 @@ public class XxlRegistryDataParamVO {
public XxlRegistryDataParamVO() {
}
public XxlRegistryDataParamVO(String key, String value) {
this.key = key;
this.value = value;

View File

@ -51,10 +51,17 @@ public class BasicHttpUtil {
dataOutputStream.flush();
dataOutputStream.close();
/*byte[] requestBodyBytes = requestBody.getBytes("UTF-8");
connection.setRequestProperty("Content-Length", String.valueOf(requestBodyBytes.length));
OutputStream outwritestream = connection.getOutputStream();
outwritestream.write(requestBodyBytes);
outwritestream.flush();
outwritestream.close();*/
// valid StatusCode
int statusCode = connection.getResponseCode();
if (statusCode != 200) {
throw new RuntimeException("http request StatusCode(" + statusCode + ") invalid. for url : " + url);
throw new RuntimeException("http request StatusCode("+ statusCode +") invalid. for url : " + url);
}
// result
@ -116,7 +123,7 @@ public class BasicHttpUtil {
// valid StatusCode
int statusCode = connection.getResponseCode();
if (statusCode != 200) {
throw new RuntimeException("Http Request StatusCode(" + statusCode + ") Invalid.");
throw new RuntimeException("Http Request StatusCode("+ statusCode +") Invalid.");
}
// result

View File

@ -29,7 +29,7 @@ public class BasicJson {
* parse json to map
*
* @param json
* @return only for filed type "null、ArrayList、LinkedHashMap、String、Long、Double、..."
* @return only for filed type "null、ArrayList、LinkedHashMap、String、Long、Double、..."
*/
public static Map<String, Object> parseMap(String json) {
return basicJsonReader.parseMap(json);
@ -46,11 +46,12 @@ public class BasicJson {
}
public static void main(String[] args) {
Map<String, Object> result = new HashMap<>();
result.put("code", 200);
result.put("msg", "success");
result.put("arr", Arrays.asList("111", "222"));
result.put("arr", Arrays.asList("111","222"));
result.put("float", 1.11f);
result.put("temp", null);
@ -205,4 +206,6 @@ public class BasicJson {
}*/
}

View File

@ -12,169 +12,173 @@ import java.util.Map;
* @author xuxueli 2018-11-30
*/
public class BasicJsonReader {
private static Logger logger = LoggerFactory.getLogger(BasicJsonwriter.class);
private static Logger logger = LoggerFactory.getLogger(BasicJsonwriter.class);
public Map<String, Object> parseMap(String json) {
if (json != null) {
json = json.trim();
if (json.startsWith("{")) {
return parseMapInternal(json);
}
}
throw new IllegalArgumentException("Cannot parse JSON");
}
public Map<String, Object> parseMap(String json) {
if (json != null) {
json = json.trim();
if (json.startsWith("{")) {
return parseMapInternal(json);
}
}
throw new IllegalArgumentException("Cannot parse JSON");
}
public List<Object> parseList(String json) {
if (json != null) {
json = json.trim();
if (json.startsWith("[")) {
return parseListInternal(json);
}
}
throw new IllegalArgumentException("Cannot parse JSON");
}
public List<Object> parseList(String json) {
if (json != null) {
json = json.trim();
if (json.startsWith("[")) {
return parseListInternal(json);
}
}
throw new IllegalArgumentException("Cannot parse JSON");
}
private List<Object> parseListInternal(String json) {
List<Object> list = new ArrayList<Object>();
json = trimLeadingCharacter(trimTrailingCharacter(json, ']'), '[');
for (String value : tokenize(json)) {
list.add(parseInternal(value));
}
return list;
}
private List<Object> parseListInternal(String json) {
List<Object> list = new ArrayList<Object>();
json = trimLeadingCharacter(trimTrailingCharacter(json, ']'), '[');
for (String value : tokenize(json)) {
list.add(parseInternal(value));
}
return list;
}
private Object parseInternal(String json) {
if (json.equals("null")) {
return null;
}
if (json.startsWith("[")) {
return parseListInternal(json);
}
if (json.startsWith("{")) {
return parseMapInternal(json);
}
if (json.startsWith("\"")) {
return trimTrailingCharacter(trimLeadingCharacter(json, '"'), '"');
}
try {
return Long.valueOf(json);
} catch (NumberFormatException ex) {
// ignore
}
try {
return Double.valueOf(json);
} catch (NumberFormatException ex) {
// ignore
}
return json;
}
private Object parseInternal(String json) {
if (json.equals("null")) {
return null;
}
if (json.startsWith("[")) {
return parseListInternal(json);
}
if (json.startsWith("{")) {
return parseMapInternal(json);
}
if (json.startsWith("\"")) {
return trimTrailingCharacter(trimLeadingCharacter(json, '"'), '"');
}
try {
return Long.valueOf(json);
}
catch (NumberFormatException ex) {
// ignore
}
try {
return Double.valueOf(json);
}
catch (NumberFormatException ex) {
// ignore
}
return json;
}
private Map<String, Object> parseMapInternal(String json) {
Map<String, Object> map = new LinkedHashMap<String, Object>();
json = trimLeadingCharacter(trimTrailingCharacter(json, '}'), '{');
for (String pair : tokenize(json)) {
String[] values = trimArrayElements(split(pair, ":"));
String key = trimLeadingCharacter(trimTrailingCharacter(values[0], '"'), '"');
Object value = parseInternal(values[1]);
map.put(key, value);
}
return map;
}
private Map<String, Object> parseMapInternal(String json) {
Map<String, Object> map = new LinkedHashMap<String, Object>();
json = trimLeadingCharacter(trimTrailingCharacter(json, '}'), '{');
for (String pair : tokenize(json)) {
String[] values = trimArrayElements(split(pair, ":"));
String key = trimLeadingCharacter(trimTrailingCharacter(values[0], '"'), '"');
Object value = parseInternal(values[1]);
map.put(key, value);
}
return map;
}
// append start
private static String[] split(String toSplit, String delimiter) {
if (toSplit != null && !toSplit.isEmpty() && delimiter != null && !delimiter.isEmpty()) {
int offset = toSplit.indexOf(delimiter);
if (offset < 0) {
return null;
} else {
String beforeDelimiter = toSplit.substring(0, offset);
String afterDelimiter = toSplit.substring(offset + delimiter.length());
return new String[]{beforeDelimiter, afterDelimiter};
}
} else {
return null;
}
}
// append start
private static String[] split(String toSplit, String delimiter) {
if (toSplit!=null && !toSplit.isEmpty() && delimiter!=null && !delimiter.isEmpty()) {
int offset = toSplit.indexOf(delimiter);
if (offset < 0) {
return null;
} else {
String beforeDelimiter = toSplit.substring(0, offset);
String afterDelimiter = toSplit.substring(offset + delimiter.length());
return new String[]{beforeDelimiter, afterDelimiter};
}
} else {
return null;
}
}
private static String[] trimArrayElements(String[] array) {
if (array == null || array.length == 0) {
return new String[0];
} else {
String[] result = new String[array.length];
private static String[] trimArrayElements(String[] array) {
if (array == null || array.length == 0) {
return new String[0];
} else {
String[] result = new String[array.length];
for(int i = 0; i < array.length; ++i) {
String element = array[i];
result[i] = element != null ? element.trim() : null;
}
for (int i = 0; i < array.length; ++i) {
String element = array[i];
result[i] = element != null ? element.trim() : null;
}
return result;
}
}
return result;
}
}
// append end
private List<String> tokenize(String json) {
List<String> list = new ArrayList<>();
int index = 0;
int inObject = 0;
int inList = 0;
boolean inValue = false;
boolean inEscape = false;
StringBuilder build = new StringBuilder();
while (index < json.length()) {
char current = json.charAt(index);
if (inEscape) {
build.append(current);
index++;
inEscape = false;
continue;
}
if (current == '{') {
inObject++;
}
if (current == '}') {
inObject--;
}
if (current == '[') {
inList++;
}
if (current == ']') {
inList--;
}
if (current == '"') {
inValue = !inValue;
}
if (current == ',' && inObject == 0 && inList == 0 && !inValue) {
list.add(build.toString());
build.setLength(0);
} else if (current == '\\') {
inEscape = true;
} else {
build.append(current);
}
index++;
}
if (build.length() > 0) {
list.add(build.toString());
}
return list;
}
private List<String> tokenize(String json) {
List<String> list = new ArrayList<String>();
int index = 0;
int inObject = 0;
int inList = 0;
boolean inValue = false;
boolean inEscape = false;
StringBuilder build = new StringBuilder();
while (index < json.length()) {
char current = json.charAt(index);
if (inEscape) {
build.append(current);
index++;
inEscape = false;
continue;
}
if (current == '{') {
inObject++;
}
if (current == '}') {
inObject--;
}
if (current == '[') {
inList++;
}
if (current == ']') {
inList--;
}
if (current == '"') {
inValue = !inValue;
}
if (current == ',' && inObject == 0 && inList == 0 && !inValue) {
list.add(build.toString());
build.setLength(0);
}
else if (current == '\\') {
inEscape = true;
}
else {
build.append(current);
}
index++;
}
if (build.length() > 0) {
list.add(build.toString());
}
return list;
}
// plugin util
private static String trimTrailingCharacter(String string, char c) {
if (string.length() > 0 && string.charAt(string.length() - 1) == c) {
return string.substring(0, string.length() - 1);
}
return string;
}
// plugin util
private static String trimTrailingCharacter(String string, char c) {
if (string.length() > 0 && string.charAt(string.length() - 1) == c) {
return string.substring(0, string.length() - 1);
}
return string;
}
private static String trimLeadingCharacter(String string, char c) {
if (string.length() > 0 && string.charAt(0) == c) {
return string.substring(1);
}
return string;
}
private static String trimLeadingCharacter(String string, char c) {
if (string.length() > 0 && string.charAt(0) == c) {
return string.substring(1);
}
return string;
}
}

View File

@ -82,13 +82,13 @@ public class BasicJsonwriter {
// string
json.append(STR_SLASH).append(value.toString()).append(STR_SLASH);
} else if (value instanceof Boolean
} else if ( value instanceof Boolean
|| value instanceof Short
|| value instanceof Integer
|| value instanceof Long
|| value instanceof Float
|| value instanceof Double
) {
) {
// number
json.append(value);
@ -191,4 +191,5 @@ public class BasicJsonwriter {
}
}

View File

@ -36,7 +36,7 @@ public class LocalServiceRegistry extends ServiceRegistry {
@Override
public boolean registry(Set<String> keys, String value) {
if (keys == null || keys.size() == 0 || value == null || value.trim().length() == 0) {
if (keys==null || keys.size()==0 || value==null || value.trim().length()==0) {
return false;
}
for (String key : keys) {
@ -52,7 +52,7 @@ public class LocalServiceRegistry extends ServiceRegistry {
@Override
public boolean remove(Set<String> keys, String value) {
if (keys == null || keys.size() == 0 || value == null || value.trim().length() == 0) {
if (keys==null || keys.size()==0 || value==null || value.trim().length()==0) {
return false;
}
for (String key : keys) {
@ -66,7 +66,7 @@ public class LocalServiceRegistry extends ServiceRegistry {
@Override
public Map<String, TreeSet<String>> discovery(Set<String> keys) {
if (keys == null || keys.size() == 0) {
if (keys==null || keys.size()==0) {
return null;
}
Map<String, TreeSet<String>> registryDataTmp = new HashMap<String, TreeSet<String>>();

View File

@ -20,13 +20,13 @@ public class XxlRpcInvokeFuture implements Future {
public XxlRpcInvokeFuture(XxlRpcFutureResponse futureResponse) {
this.futureResponse = futureResponse;
}
public void stop() {
public void stop(){
// remove-InvokerFuture
futureResponse.removeInvokerFuture();
}
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return futureResponse.cancel(mayInterruptIfRunning);

View File

@ -26,7 +26,7 @@ import java.util.Set;
*
* @author xuxueli 2018-10-19
*/
public class XxlRpcSpringInvokerFactory extends InstantiationAwareBeanPostProcessorAdapter implements InitializingBean, DisposableBean, BeanFactoryAware {
public class XxlRpcSpringInvokerFactory extends InstantiationAwareBeanPostProcessorAdapter implements InitializingBean,DisposableBean, BeanFactoryAware {
private Logger logger = LoggerFactory.getLogger(XxlRpcSpringInvokerFactory.class);
// ---------------------- config ----------------------

View File

@ -24,6 +24,7 @@ public class IpUtil {
private static final Pattern IP_PATTERN = Pattern.compile("\\d{1,3}(\\.\\d{1,3}){3,5}$");
private static volatile InetAddress LOCAL_ADDRESS = null;
// ---------------------- valid ----------------------
@ -56,10 +57,11 @@ public class IpUtil {
return false;
}
String name = address.getHostAddress();
return (name != null
boolean result = (name != null
&& IP_PATTERN.matcher(name).matches()
&& !ANYHOST_VALUE.equals(name)
&& !LOCALHOST_VALUE.equals(name));
return result;
}
@ -123,7 +125,7 @@ public class IpUtil {
InetAddress addressItem = toValidAddress(addresses.nextElement());
if (addressItem != null) {
try {
if (addressItem.isReachable(100)) {
if(addressItem.isReachable(100)){
return addressItem;
}
} catch (IOException e) {
@ -166,7 +168,7 @@ public class IpUtil {
*
* @return String
*/
public static String getIp() {
public static String getIp(){
return getLocalAddress().getHostAddress();
}
@ -176,19 +178,19 @@ public class IpUtil {
* @param port
* @return String
*/
public static String getIpPort(int port) {
public static String getIpPort(int port){
String ip = getIp();
return getIpPort(ip, port);
}
public static String getIpPort(String ip, int port) {
if (ip == null) {
public static String getIpPort(String ip, int port){
if (ip==null) {
return null;
}
return ip.concat(":").concat(String.valueOf(port));
}
public static Object[] parseIpPort(String address) {
public static Object[] parseIpPort(String address){
String[] array = address.split(":");
String host = array[0];

View File

@ -47,7 +47,7 @@ public class NetUtil {
* @return
*/
public static boolean isPortUsed(int port) {
boolean used;
boolean used = false;
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(port);

View File

@ -4,7 +4,6 @@ package com.wugui.datax.rpc.util;
* @author xuxueli 2018-10-20 23:00:40
*/
public class XxlRpcException extends RuntimeException {
private static final long serialVersionUID = 42L;
public XxlRpcException(String msg) {

View File

@ -17,15 +17,18 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for job_permission
-- ----------------------------
DROP TABLE IF EXISTS `job_permission`;
CREATE TABLE `job_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限名',
`description` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限描述',
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '权限名',
`description` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限描述',
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`pid` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of job_permission
@ -39,9 +42,9 @@ INSERT INTO `job_permission` VALUES (2, 'ROLE_ADMIN', 'ABel', '/', NULL);
DROP TABLE IF EXISTS `job_role`;
CREATE TABLE `job_role` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色名称',
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色名称',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of job_role
@ -55,10 +58,10 @@ INSERT INTO `job_role` VALUES (2, 'ROLE_USER');
DROP TABLE IF EXISTS `job_user`;
CREATE TABLE `job_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户主键',
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of job_user
@ -76,7 +79,7 @@ CREATE TABLE `permission_role` (
`role_id` int(11) NULL DEFAULT NULL COMMENT '角色名称',
`permission_id` int(20) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of permission_role
@ -94,7 +97,7 @@ CREATE TABLE `role_user` (
`user_id` int(20) NULL DEFAULT NULL COMMENT '角色名称',
`role_id` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of role_user

View File

@ -342,9 +342,10 @@ ADD COLUMN `load_average` DOUBLE NULL AFTER `memory_usage`;
DROP TABLE IF EXISTS `job_permission`;
CREATE TABLE `job_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限名',
`description` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限描述',
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '权限名',
`description` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限描述',
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`pid` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;