v2.1
This commit is contained in:
		| @@ -123,13 +123,14 @@ public class JobController { | |||||||
|             return Result.getResult(JobError.JOB_NOT_FOUND); |             return Result.getResult(JobError.JOB_NOT_FOUND); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         AppConfigDto appConfig = AppConfigDto.parse(appConfigService.getById(job.getAppId())); | ||||||
|         JSONObject params = JSON.parseObject(job.getParam()); |         JSONObject params = JSON.parseObject(job.getParam()); | ||||||
|         try { |         try { | ||||||
|             String extName = FileUtil.extName(file.getOriginalFilename()); |             String extName = FileUtil.extName(file.getOriginalFilename()); | ||||||
|             if (!StrUtil.isEmpty(extName)) { |             if (!StrUtil.isEmpty(extName)) { | ||||||
|                 extName = StrUtil.DOT + extName; |                 extName = StrUtil.DOT + extName; | ||||||
|             } |             } | ||||||
|             String filePath = requestPath + FileUtil.FILE_SEPARATOR + jobId + FileUtil.FILE_SEPARATOR |             String filePath = appConfig.getRequestPath() + jobId + FileUtil.FILE_SEPARATOR | ||||||
|                     + IdUtil.fastUUID() + extName; |                     + IdUtil.fastUUID() + extName; | ||||||
|             FileUtil.writeFromStream(file.getInputStream(), filePath); |             FileUtil.writeFromStream(file.getInputStream(), filePath); | ||||||
|             params.put(fileKey, filePath); |             params.put(fileKey, filePath); | ||||||
|   | |||||||
| @@ -61,7 +61,8 @@ public class AppConfig implements Serializable { | |||||||
|     private String localPath; |     private String localPath; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 邮件格式(json格式:{"subject":"**","success":"**"}) |      * 邮件格式(json格式:{"subject":"**","success":"**","waiting":"**".....}) | ||||||
|  |      * 参照com.weilab.biology.core.data.enums.JobStatusEnum | ||||||
|      */ |      */ | ||||||
|     @TableField("email_template") |     @TableField("email_template") | ||||||
|     private String emailTemplate; |     private String emailTemplate; | ||||||
|   | |||||||
| @@ -75,7 +75,7 @@ public class Job implements Serializable { | |||||||
|     private LocalDateTime completeTime; |     private LocalDateTime completeTime; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 请求类型 |      * 任务类型 | ||||||
|      */ |      */ | ||||||
|     @TableField(value = "type") |     @TableField(value = "type") | ||||||
|     private Integer type; |     private Integer type; | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								src/main/resources/db.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/main/resources/db.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | create table app_config | ||||||
|  | ( | ||||||
|  |     app_id         int auto_increment comment '应用ID' | ||||||
|  |         primary key, | ||||||
|  |     app_name       varchar(100)                 not null comment '应用名', | ||||||
|  |     concurrent_num int          default 1       not null comment '并发数', | ||||||
|  |     cmd            varchar(500)                 not null comment '命令行', | ||||||
|  |     timeout        bigint       default 840     not null comment '任务超时时间(单位:分钟)', | ||||||
|  |     local_path     varchar(100) default '/data' not null comment '放置文件的路径', | ||||||
|  |     email_template json                         not null comment '邮件格式(json格式:{"subject":"**","success":"**"})', | ||||||
|  |     constraint app_config_app_name_uniq | ||||||
|  |         unique (app_name) | ||||||
|  | ) | ||||||
|  |     comment '应用配置信息'; | ||||||
|  |  | ||||||
|  | create table job | ||||||
|  | ( | ||||||
|  |     job_id        int auto_increment comment 'jobId' | ||||||
|  |         primary key, | ||||||
|  |     app_id        int            not null comment '应用ID', | ||||||
|  |     param         varchar(10000) null comment '请求参数', | ||||||
|  |     mail          varchar(500)   null comment '联系邮箱', | ||||||
|  |     result        text           null comment '运行结果', | ||||||
|  |     status        tinyint        null comment '任务状态。0为待运行,1为正在运行,2为运行成功,-1为运行失败', | ||||||
|  |     request_time  datetime       null comment '请求时间', | ||||||
|  |     create_time   datetime       null comment '创建时间', | ||||||
|  |     complete_time datetime       null comment '完成时间', | ||||||
|  |     type          int            null comment '请求类型' | ||||||
|  | ); | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user