feat: 文件单个上传

Signed-off-by: skyyemperor <skyyemperor@qq.com>
This commit is contained in:
2022-12-10 21:40:57 +08:00
parent 4f8f119ffa
commit 8de89de837
6 changed files with 117 additions and 35 deletions

View File

@@ -80,18 +80,11 @@ public class JobService {
/**
* 提交job
*
* @param dataStr 文本内容
* @param param 其他参数(json格式)
* @param mail 邮箱
* @return
* @throws Exception
*/
@Transactional
public Result submit(String dataStr, BufferedInputStream dataStream, JSONObject param, String mail, Integer type) {
Job job = new Job("", JSON.toJSONString(param), mail, JobStatusEnum.WAIT.getKey(), LocalDateTime.now(), type);
public Result submit(String dataStr, BufferedInputStream dataStream, JSONObject param, Job job) {
jobMapper.insert(job);
sendEmail(job, JobStatusEnum.WAIT, mail);
sendEmail(job, JobStatusEnum.WAIT, job.getMail());
try {
//将请求数据写入本地文件之后向python传递文件路径参数
@@ -172,8 +165,8 @@ public class JobService {
return Result.success(jobs.stream().map(JobLessDto::parseJob).collect(Collectors.toList()));
}
public Result getJobList(Integer type, Integer page, Integer size) {
List<Job> jobs = jobMapper.selectJobListByPage(type, (page - 1) * size, size);
public Result getJobList(Integer type, Boolean filterCreating, Integer page, Integer size) {
List<Job> jobs = jobMapper.selectJobListByPage(type, filterCreating, (page - 1) * size, size);
return Result.success(jobs.stream().map(JobLessDto::parseJob).collect(Collectors.toList()));
}