修改导入Project
parent
6b29ab9a30
commit
727c7c414c
|
@ -67,13 +67,42 @@ public class ProPlanController extends BaseController
|
|||
@RequiresPermissions("manage:plan:export")
|
||||
@Log(title = "计划管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ProPlan proPlan)
|
||||
{
|
||||
public void export(HttpServletResponse response, ProPlan proPlan) throws IOException {
|
||||
List<ProPlan> list = proPlanService.selectProPlanList(proPlan);
|
||||
ExcelUtil<ProPlan> util = new ExcelUtil<ProPlan>(ProPlan.class);
|
||||
util.exportExcel(response, list, "计划管理数据");
|
||||
Project prj=new Project();
|
||||
|
||||
//ExcelUtil<ProPlan> util = new ExcelUtil<ProPlan>(ProPlan.class);
|
||||
//util.exportExcel(response, list, "计划管理数据");
|
||||
|
||||
Task task=prj.getRootTask();
|
||||
writeTask(task,list,0);
|
||||
response.setContentType("application/vnd.ms-project");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
prj.save(response.getOutputStream(),1);
|
||||
}
|
||||
|
||||
private void writeTask(Task task, List<ProPlan> list, long pid) {
|
||||
|
||||
for (ProPlan proPlan : list) {
|
||||
if(proPlan.getParentId().equals(pid)){
|
||||
Task subTask= task.getChildren().add(proPlan.getTaskName());
|
||||
addSubTaskInfo(subTask,proPlan);
|
||||
writeTask(subTask,list,proPlan.getTaskId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addSubTaskInfo(Task subTask, ProPlan proPlan) {
|
||||
subTask.setId(proPlan.getTaskId().intValue());
|
||||
subTask.setOutlineLevel(proPlan.getTaskOutlineLevel().intValue());
|
||||
subTask.setGuid(proPlan.getTaskUniqueId());
|
||||
subTask.setStart(proPlan.getStartDate());
|
||||
subTask.setFinish(proPlan.getFinishDate());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequiresPermissions("manage:plan:import")
|
||||
@Log(title = "计划管理", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
|
|
|
@ -293,7 +293,7 @@ function handleDelete(row) {
|
|||
function handleExport() {
|
||||
proxy.download('manage/plan/export', {
|
||||
...queryParams.value
|
||||
}, `plan_${new Date().getTime()}.xlsx`)
|
||||
}, `plan_${new Date().getTime()}.mpp`)
|
||||
}
|
||||
data.projectId=userStore.currentProId;
|
||||
data.compId=userStore.currentComId;
|
||||
|
|
Loading…
Reference in New Issue