Search in sources :

Example 1 with NewTaskForm

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);
        }
    }
}
Also used : TaskInfo(lee.study.down.model.TaskInfo) NewTaskForm(lee.study.down.mvc.form.NewTaskForm) WsForm(lee.study.down.mvc.form.WsForm)

Example 2 with NewTaskForm

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;
}
Also used : TaskInfo(lee.study.down.model.TaskInfo) NewTaskForm(lee.study.down.mvc.form.NewTaskForm) ResultInfo(lee.study.down.model.ResultInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

TaskInfo (lee.study.down.model.TaskInfo)2 NewTaskForm (lee.study.down.mvc.form.NewTaskForm)2 ResultInfo (lee.study.down.model.ResultInfo)1 WsForm (lee.study.down.mvc.form.WsForm)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1