Sfoglia il codice sorgente

日报导出增加工号
威派格项目导入异常修改

yurk 2 anni fa
parent
commit
d12b33a19c

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

@@ -2773,6 +2773,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             inputStream.close();
             outputStream.close();
             if(fileName.endsWith(".xlsx")){
+                if(!fileName.endsWith(".xlsx")){
+                    msg.setError("文件格式错误,请使用’.xlsx’格式");
+                    return msg;
+                }
                 //然后解析表格
                 XSSFWorkbook workbook = new XSSFWorkbook(file);
                 //我们只需要第一个sheet
@@ -3000,6 +3004,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 operationRecord.setContent("导入了"+importCount+"条项目数据");
                 operationRecordService.save(operationRecord);
             }else if(fileName.endsWith(".xls")){
+                if(!fileName.endsWith(".xls")){
+                    msg.setError("文件格式错误,请使用’.xlsx’格式");
+                    return msg;
+                }
                 //然后解析表格
                 HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
                 //我们只需要第一个sheet
@@ -3523,13 +3531,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                 ProjectKeyNodesSetting projectKeyNodesSetting = projectKeyNodesSettingList.get(x);
                                 Optional<ProjectKeyNodes> first = nodes.stream().filter(ns -> ns.getNodesId().equals(projectKeyNodesSetting.getId())).findFirst();
                                 ProjectKeyNodes projectKeyNodes=new ProjectKeyNodes();
+                                boolean flagNodes=false;
                                 switch (x){
                                     case 0:
                                         if(plate1!=null&&plate1.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate1.getDateCellValue())){
                                             projectKeyNodes.setPlanCompleteDate(sdf.format(plate1.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate2!=null&&plate2.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate2.getDateCellValue())){
                                             projectKeyNodes.setActualCompleteDate(sdf.format(plate2.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate3!=null&&!StringUtils.isEmpty(plate3.getStringCellValue())){
                                             switch (plate3.getStringCellValue()){
@@ -3540,14 +3551,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                                 case "完成":projectKeyNodes.setStates("2");
                                                     break;
                                             }
+                                            flagNodes=true;
                                         }
                                         break;
                                     case 1:
                                         if(plate4!=null&&plate4.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate4.getDateCellValue())){
                                             projectKeyNodes.setPlanCompleteDate(sdf.format(plate4.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate5!=null&&plate5.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate5.getDateCellValue())){
                                             projectKeyNodes.setActualCompleteDate(sdf.format(plate5.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate6!=null&&!StringUtils.isEmpty(plate6.getStringCellValue())){
                                             switch (plate6.getStringCellValue()){
@@ -3558,14 +3572,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                                 case "完成":projectKeyNodes.setStates("2");
                                                     break;
                                             }
+                                            flagNodes=true;
                                         }
                                         break;
                                     case 2:
                                         if(plate7!=null&&plate7.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate7.getDateCellValue())){
                                             projectKeyNodes.setPlanCompleteDate(sdf.format(plate7.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate8!=null&&plate8.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate8.getDateCellValue())){
                                             projectKeyNodes.setActualCompleteDate(sdf.format(plate8.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate9!=null&&!StringUtils.isEmpty(plate9.getStringCellValue())){
                                             switch (plate9.getStringCellValue()){
@@ -3576,14 +3593,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                                 case "完成":projectKeyNodes.setStates("2");
                                                     break;
                                             }
+                                            flagNodes=true;
                                         }
                                         break;
                                     case 3:
                                         if(plate10!=null&&plate10.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate10.getDateCellValue())){
                                             projectKeyNodes.setPlanCompleteDate(sdf.format(plate10.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate11!=null&&plate11.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate11.getDateCellValue())){
                                             projectKeyNodes.setActualCompleteDate(sdf.format(plate11.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate12!=null&&!StringUtils.isEmpty(plate12.getStringCellValue())){
                                             switch (plate12.getStringCellValue()){
@@ -3594,14 +3614,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                                 case "完成":projectKeyNodes.setStates("2");
                                                     break;
                                             }
+                                            flagNodes=true;
                                         }
                                         break;
                                     case 4:
                                         if(plate13!=null&&plate13.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate13.getDateCellValue())){
                                             projectKeyNodes.setPlanCompleteDate(sdf.format(plate13.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate14!=null&&plate14.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate14.getDateCellValue())){
                                             projectKeyNodes.setActualCompleteDate(sdf.format(plate14.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate15!=null&&!StringUtils.isEmpty(plate15.getStringCellValue())){
                                             switch (plate15.getStringCellValue()){
@@ -3612,14 +3635,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                                 case "完成":projectKeyNodes.setStates("2");
                                                     break;
                                             }
+                                            flagNodes=true;
                                         }
                                         break;
                                     case 5:
                                         if(plate16!=null&&plate16.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate16.getDateCellValue())){
                                             projectKeyNodes.setPlanCompleteDate(sdf.format(plate16.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate17!=null&&plate17.getCellTypeEnum() == CellType.NUMERIC  && !StringUtils.isEmpty(plate17.getDateCellValue())){
                                             projectKeyNodes.setActualCompleteDate(sdf.format(plate17.getDateCellValue()));
+                                            flagNodes=true;
                                         }
                                         if(plate18!=null&&!StringUtils.isEmpty(plate18.getStringCellValue())){
                                             switch (plate18.getStringCellValue()){
@@ -3630,12 +3656,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                                 case "完成":projectKeyNodes.setStates("2");
                                                     break;
                                             }
+                                            flagNodes=true;
                                         }
                                         break;
                                 }
                                 if(first.isPresent()){
-                                     projectKeyNodes.setId(first.get().getId());
-                                    projectKeyNodesMapper.updateById(projectKeyNodes);
+                                    if(flagNodes){
+                                        projectKeyNodes.setId(first.get().getId());
+                                        projectKeyNodesMapper.updateById(projectKeyNodes);
+                                    }
                                 }else {
                                     projectKeyNodes.setProjectId(id);
                                     projectKeyNodes.setNodesId(projectKeyNodesSetting.getId());
@@ -3804,7 +3833,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     p.setProjectId(project.getId());
                                     participationMapper.insert(p);
                                 } else {
-                                    projectMapper.deleteById(project.getId());
                                     throw new Exception("参与人["+str+"]不存在");
                                 }
                             }

+ 10 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -3197,6 +3197,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             sheet.createFreezePane(0,1);
             List<String> titles = new ArrayList<String>();
             titles.add("序号");
+            titles.add("工号");
             titles.add("员工");
             titles.add("所在部门");
             titles.add("项目名称");
@@ -3382,18 +3383,19 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             for (Map<String, Object> map : allReportByDate) {
                 HSSFRow row = sheet.createRow(rowNum);
                 row.createCell(0).setCellValue(rowNum);
-                row.createCell(1).setCellValue((String) map.get("name"));
-                row.createCell(2).setCellValue((String) map.get("departmentName"));
-                row.createCell(3).setCellValue((String) map.get("project"));
-                row.createCell(4).setCellValue((String) map.get("categoryName"));
+                row.createCell(1).setCellValue((String) map.get("jobNumber"));
+                row.createCell(2).setCellValue((String) map.get("name"));
+                row.createCell(3).setCellValue((String) map.get("departmentName"));
+                row.createCell(4).setCellValue((String) map.get("project"));
+                row.createCell(5).setCellValue((String) map.get("categoryName"));
                 if(timeType.getMainProjectState()==1){
-                    row.createCell(5).setCellValue((String) map.get("projectMainName"));
+                    row.createCell(6).setCellValue((String) map.get("projectMainName"));
                 }else {
-                    row.createCell(5).setCellValue((String) map.get("subProjectName"));
+                    row.createCell(6).setCellValue((String) map.get("subProjectName"));
                 }
-                int index = 6;
+                int index = 7;
                 if (company.getPackageProject() == 1) {
-                    row.createCell(6).setCellValue((String) map.get("taskName"));
+                    row.createCell(7).setCellValue((String) map.get("taskName"));
                     index++;
                 }
                 HSSFCell cell = row.createCell(index);

+ 3 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -57,7 +57,7 @@
 
     <!--根据日期获取全部报告信息-->
     <select id="getAllReportByDate" resultType="java.util.Map">
-        SELECT a.id, c.name,c.corpwx_userid as corpwxUserId, b.project_name AS project,b.project_code as projectCode,b.category_name as categoryName, a.working_time AS duration, a.content, a.create_time   AS time,a.create_date as createDate,
+        SELECT a.id, c.name,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId, b.project_name AS project,b.project_code as projectCode,b.category_name as categoryName, a.working_time AS duration, a.content, a.create_time   AS time,a.create_date as createDate,
         a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType,a.start_time as startTime,u.job_number as jobNumber,
         a.end_time  as endTime, d.name as subProjectName,d.code as subProjectCode,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime,a.progress as progress,
         a.department_audit_state as departmentAuditState, a.stage, a.pic_str as picStr, multi_worktime as multiWorktime
@@ -125,7 +125,7 @@
     </select>
 
     <select id="getProjectMembReportByDate" resultType="java.util.Map">
-        SELECT a.id, c.name,c.corpwx_userid as corpwxUserId, b.project_name AS project, b.category_name as categoryName,a.working_time AS duration,
+        SELECT a.id, c.name,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId, b.project_name AS project, b.category_name as categoryName,a.working_time AS duration,
         a.content, a.create_time AS time, a.create_date as createDate,
         a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType, a.start_time as startTime,
         a.end_time as endTime, d.name as subProjectName,a.task_id as taskId, task.name as taskName, a.is_overtime as
@@ -171,7 +171,7 @@
     </select>
 
     <select id="getDeptMembReportByDate" resultType="java.util.Map">
-        SELECT a.id, c.name,c.corpwx_userid as corpwxUserId, b.project_name AS project, a.working_time AS duration, a.content, a.create_time AS time,a.create_date as createDate,
+        SELECT a.id, c.name,c.job_number as jobNumber,c.corpwx_userid as corpwxUserId, b.project_name AS project, a.working_time AS duration, a.content, a.create_time AS time,a.create_date as createDate,
         a.state, a.time_type as timeType, a.cost, a.report_time_type as reportTimeType, a.start_time as startTime,
         a.end_time as endTime, d.name as subProjectName,a.task_id as taskId, task.name as taskName, a.is_overtime as isOvertime,a.progress as progress,
         a.department_audit_state as departmentAuditState,a.stage, a.pic_str as picStr, multi_worktime as multiWorktime