修改导入Project

dev_xd
Mac 2024-11-09 17:40:37 +08:00
parent 6b29ab9a30
commit 727c7c414c
2 changed files with 34 additions and 5 deletions

View File

@ -67,13 +67,42 @@ public class ProPlanController extends BaseController
@RequiresPermissions("manage:plan:export") @RequiresPermissions("manage:plan:export")
@Log(title = "计划管理", businessType = BusinessType.EXPORT) @Log(title = "计划管理", businessType = BusinessType.EXPORT)
@PostMapping("/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); List<ProPlan> list = proPlanService.selectProPlanList(proPlan);
ExcelUtil<ProPlan> util = new ExcelUtil<ProPlan>(ProPlan.class); Project prj=new Project();
util.exportExcel(response, list, "计划管理数据");
//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") @RequiresPermissions("manage:plan:import")
@Log(title = "计划管理", businessType = BusinessType.IMPORT) @Log(title = "计划管理", businessType = BusinessType.IMPORT)
@PostMapping("/importData") @PostMapping("/importData")

View File

@ -293,7 +293,7 @@ function handleDelete(row) {
function handleExport() { function handleExport() {
proxy.download('manage/plan/export', { proxy.download('manage/plan/export', {
...queryParams.value ...queryParams.value
}, `plan_${new Date().getTime()}.xlsx`) }, `plan_${new Date().getTime()}.mpp`)
} }
data.projectId=userStore.currentProId; data.projectId=userStore.currentProId;
data.compId=userStore.currentComId; data.compId=userStore.currentComId;