瀏覽代碼

任务导入修改

yurk 2 年之前
父節點
當前提交
9597158363

+ 7 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -2808,14 +2808,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     /*if (startDateCell != null)startDateCell.setCellType(CellType.NUMERIC);
                     if (endDateCell != null)endDateCell.setCellType(CellType.NUMERIC);*/
                     if (amountCell != null)amountCell.setCellType(CellType.STRING);
-                    if (contractCell != null)amountCell.setCellType(CellType.STRING);
+                    if (contractCell != null)contractCell.setCellType(CellType.STRING);
                     /*if (warrantyStartDateCell != null)amountCell.setCellType(CellType.STRING);
                     if (warrantyEndDateCell != null)amountCell.setCellType(CellType.STRING);*/
-                    if (projectCategorySubCell != null)amountCell.setCellType(CellType.STRING);
-                    if (regionCell != null)amountCell.setCellType(CellType.STRING);
-                    if (buCell != null)amountCell.setCellType(CellType.STRING);
-                    if (stateCell != null)amountCell.setCellType(CellType.STRING);
-                    if (stageCell != null)amountCell.setCellType(CellType.STRING);
+                    if (projectCategorySubCell != null)projectCategorySubCell.setCellType(CellType.STRING);
+                    if (regionCell != null)regionCell.setCellType(CellType.STRING);
+                    if (buCell != null)buCell.setCellType(CellType.STRING);
+                    if (stateCell != null)stateCell.setCellType(CellType.STRING);
+                    if (stageCell != null)stageCell.setCellType(CellType.STRING);
                     if (nameCell == null) {//项目名称为空的直接跳过
                         throw new Exception("项目名称不能为空");
                     }
@@ -2991,7 +2991,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     if (endDateCell !=null && endDateCell.getCellTypeEnum() == CellType.NUMERIC && !StringUtils.isEmpty(endDateCell.getDateCellValue())) {
                         project.setPlanEndDate(LocalDate.parse(sdf.format(endDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
                     }
-                    if (amountCell !=null && endDateCell.getCellTypeEnum() == CellType.NUMERIC && !StringUtils.isEmpty(amountCell.getStringCellValue())) {
+                    if (amountCell !=null && amountCell.getCellTypeEnum() == CellType.NUMERIC && !StringUtils.isEmpty(amountCell.getStringCellValue())) {
                         project.setContractAmount(Double.parseDouble(amountCell.getStringCellValue()));
                     }
                     if (isPublicCell != null && !StringUtils.isEmpty(isPublicCell.getStringCellValue())) {

+ 17 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -339,16 +339,18 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                     continue;
                 }
                 //此处新建账号 默认密码为000000 默认 姓名第一列 手机号第二列 月薪第三列
-                XSSFCell nameCell = row.getCell(0);
+                XSSFCell stagesCell = row.getCell(0);
+                XSSFCell nameCell = row.getCell(1);
                 if (nameCell == null) {
                     break;
                 }
-                XSSFCell stagesCell = row.getCell(1);
                 XSSFCell typeCell = row.getCell(2);
                 XSSFCell executorCell = row.getCell(3);
                 XSSFCell levelCell = row.getCell(4);
-                XSSFCell endDateCell = row.getCell(5);
-                XSSFCell planHoursCell = row.getCell(6);
+                XSSFCell startDateCell = row.getCell(5);
+                XSSFCell endDateCell = row.getCell(6);
+                XSSFCell planHoursCell = row.getCell(7);
+                XSSFCell descCell = row.getCell(8);
                 nameCell.setCellType(CellType.STRING);
                 stagesCell.setCellType(CellType.STRING);
                 typeCell.setCellType(CellType.STRING);
@@ -359,7 +361,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 String name = nameCell.getStringCellValue();
                 String type = typeCell.getStringCellValue();
                 //忽略表头
-                if (name.equals("标题") && type.equals("类型") && rowIndex == 0) {
+                if (name.equals("任务内容") && type.equals("类型") && rowIndex == 0) {
                     continue;
                 }
                 Task task = new Task();
@@ -416,6 +418,13 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 if(levelCell!=null){
                     task.setTaskLevel(taskLevelMap.get(levelCell.getStringCellValue()));
                 }
+                if(startDateCell.getDateCellValue()!=null){
+                    Date dateCellValue = startDateCell.getDateCellValue();
+                    System.out.println("日期=="+dateCellValue.toString());
+                    String formatValue = new SimpleDateFormat("yyyy-MM-dd").format(dateCellValue);
+                    LocalDate startDate = LocalDate.parse(formatValue, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+                    task.setStartDate(startDate);
+                }
                 if(endDateCell.getDateCellValue()!=null){
                     Date dateCellValue = endDateCell.getDateCellValue();
                     System.out.println("日期=="+dateCellValue.toString());
@@ -426,6 +435,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 if(planHoursCell!=null){
                     task.setPlanHours(Integer.parseInt(planHoursCell.getStringCellValue()));
                 }
+                if(descCell!=null){
+                    task.setTaskDesc(descCell.getStringCellValue());
+                }
                 task.setCreaterId(creator.getId());
                 task.setCreatorColor(creator.getColor());
                 task.setCreaterName(creator.getName());