//#import $@projectCode:services/modelService.jsx
//#import Util.js
//#import file.js



var formSpecs = @formSpecs;

var taskInfo = @projectCodeService.getExportTaskInfo( taskInfoId );
taskInfo.total = @projectCodeService.getAllSize();
taskInfo.lastTime = new Date().getTime();
taskInfo.processState = "processing";
taskInfo.msg = "获取导出总数成功......";
taskInfo.percent = "1";
taskInfo.fileUrls = [];
@projectCodeService.updateExportTaskInfo( taskInfoId, taskInfo );


var from = 0;
var allListObjs = [];
while(from < taskInfo.total){
    var listObjs = @projectCodeService.getAllObjectsEx(from, 10000);
    allListObjs = allListObjs.concat(listObjs);
    from = from + listObjs.length;
    taskInfo.lastTime = new Date().getTime();
    taskInfo.processState = "processing";
    taskInfo.msg = "正在导出......";
    taskInfo.percent = (allListObjs.length) * 100 / taskInfo.total;
    taskInfo.exportedRows = from + listObjs.length;
    @projectCodeService.updateExportTaskInfo( taskInfoId, taskInfo );
}

var s = JSON.stringify(allListObjs);
var fileId = "" + $.addAsZip(s);

taskInfo.processState = "success";
taskInfo.percent = 100;
taskInfo.msg = "导出文件成功";
taskInfo.fileId = fileId;
taskInfo.fileUrl = FileService.getFullPath(fileId);
taskInfo.fileUrls.push(taskInfo.fileUrl);
@projectCodeService.updateExportTaskInfo( taskInfoId, taskInfo );











