use of lee.study.down.mvc.form.NewTaskForm in project proxyee-down by monkeyWie.
the class HttpDownHandleCallback method onDone.
@Override
public void onDone(HttpDownInfo httpDownInfo) throws Exception {
TaskInfo taskInfo = httpDownInfo.getTaskInfo();
// 更改任务下载状态为已完成
ContentManager.DOWN.save();
// 删除任务进度记录文件
synchronized (taskInfo) {
FileUtil.deleteIfExists(taskInfo.buildTaskRecordFilePath());
FileUtil.deleteIfExists(taskInfo.buildTaskRecordBakFilePath());
}
sendTask(httpDownInfo.getTaskInfo().getId());
NewTaskForm taskForm = NewTaskForm.parse(httpDownInfo);
if (taskForm.isUnzip()) {
if (BdyZip.isBdyZip(taskInfo.buildTaskFilePath())) {
WsForm wsForm = new WsForm(WsDataType.UNZIP_NEW, new HashMap<String, String>() {
{
put("filePath", taskInfo.buildTaskFilePath());
put("toPath", taskForm.getUnzipPath());
}
});
ContentManager.WS.sendMsg(wsForm);
}
}
}
use of lee.study.down.mvc.form.NewTaskForm in project proxyee-down by monkeyWie.
the class OpenController method open.
@RequestMapping("createTask")
public ResultInfo open(@RequestBody CreateTaskForm createTaskForm) throws Exception {
ResultInfo resultInfo = HttpDownController.commonBuildTask(createTaskForm.getRequest());
if (resultInfo.getStatus() == ResultStatus.SUCC.getCode()) {
TaskInfo taskInfo = ContentManager.DOWN.getTaskInfo(resultInfo.getData().toString());
NewTaskForm taskForm = new NewTaskForm();
taskForm.setId(taskInfo.getId());
if (!StringUtils.isEmpty(createTaskForm.getFileName())) {
taskForm.setFileName(createTaskForm.getFileName());
} else {
taskForm.setFileName(taskInfo.getFileName());
}
if (!StringUtils.isEmpty(taskInfo.getFilePath())) {
taskForm.setFilePath(taskInfo.getFilePath());
} else {
taskForm.setFilePath(createTaskForm.getFilePath());
}
taskForm.setUnzip(createTaskForm.getUnzipFlag() == 1);
taskForm.setUnzipPath(createTaskForm.getUnzipPath());
taskForm.setConnections(createTaskForm.getConnections());
resultInfo = HttpDownController.commonStartTask(taskForm);
}
return resultInfo;
}
Aggregations