Преглед на файлове

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

ggooalice преди 2 години
родител
ревизия
846af17261

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

@@ -257,7 +257,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             List<ProjectLevel> projectLevelList = projectLevelMapper.selectList(new QueryWrapper<ProjectLevel>().eq("company_id", companyId));
             TimeType timeType = timeTypeMapper.selectById(companyId);
             List<Integer> projectIds = projectList.stream().distinct().map(pl -> pl.getId()).collect(Collectors.toList());
-            List<ProjectSeparate> projectSeparateList = projectSeparateMapper.selectList(new QueryWrapper<ProjectSeparate>().in("id", projectIds));
             List<ProjectVO> list = new ArrayList<>();
             for (Project project : projectList) {
                 ProjectVO projectVO = new ProjectVO();
@@ -314,9 +313,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     projectVO.setProviderInfoList(mapList);
                 }
                 if(companyId==936){
-                    Optional<ProjectSeparate> first1 = projectSeparateList.stream().filter(ps -> ps.getId().equals(project.getId())).findFirst();
-                    if(first1.isPresent()){
-                        projectVO.setProjectSeparate(first1.get());
+                    if(projectIds!=null){
+                        List<ProjectSeparate> projectSeparateList = projectSeparateMapper.selectList(new QueryWrapper<ProjectSeparate>().in("id", projectIds));
+                        Optional<ProjectSeparate> first1 = projectSeparateList.stream().filter(ps -> ps.getId().equals(project.getId())).findFirst();
+                        if(first1.isPresent()){
+                            projectVO.setProjectSeparate(first1.get());
+                        }
                     }
                 }
                 list.add(projectVO);
@@ -417,6 +419,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             .setTaskGpIncharge(taskGpIncharge)
                             .setProviderIds(providerIds)
                             .setProviderNames(providerNames);
+                    ProjectMain projectMain = projectMainMapper.selectById(projectMainId);
+                    if(projectMain!=null){
+                        project.setCategory(projectMain.getCategoryId());
+                        project.setCategoryName(projectMain.getCategoryName());
+                    }
                     if (category != null) {
                         ProjectCategory projectCategory = projectCategoryMapper.selectById(category);
                         if (projectCategory != null) {
@@ -2617,6 +2624,20 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         }
                     }
                     //参与人
+                    if(inchargerCell!=null){
+                        if(participatorCell==null||StringUtils.isEmpty(participatorCell.getStringCellValue())){
+                            String value = inchargerCell.getStringCellValue();
+                            Participation p = new Participation();
+                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(value)).findFirst();
+                            if (first.isPresent()) {
+                                p.setUserId(first.get().getId());
+                                p.setProjectId(project.getId());
+                                participationMapper.insert(p);
+                            } else {
+                                throw new Exception("参与人["+value+"]不存在");
+                            }
+                        }
+                    }
                     if (participatorCell != null) {
                         String part = participatorCell.getStringCellValue().trim();
                         //将项目负责人也添加到参与人当中来
@@ -2808,14 +2829,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 +3012,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())) {
@@ -3023,6 +3044,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                         Optional<ProjectMain> first = projectMainList.stream().filter(pm -> pm.getName().equals(mainName)).findFirst();
                                         if(first.isPresent()){
                                             project.setProjectMainId(first.get().getId());
+                                            project.setCategory(first.get().getCategoryId());
+                                            project.setCategoryName(first.get().getCategoryName());
                                         }else {
                                             msg.setError("主项目["+mainName+"]不存在");
                                             return msg;
@@ -3066,6 +3089,20 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     }
                     importCount++;
                     //参与人
+                    if(inchargerCell!=null){
+                        if(participatorCell==null||StringUtils.isEmpty(participatorCell.getStringCellValue())){
+                            String value = inchargerCell.getStringCellValue();
+                            Participation p = new Participation();
+                            Optional<User> first = userList.stream().filter(u -> u.getName().equals(value)).findFirst();
+                            if (first.isPresent()) {
+                                p.setUserId(first.get().getId());
+                                p.setProjectId(project.getId());
+                                participationMapper.insert(p);
+                            } else {
+                                throw new Exception("参与人["+value+"]不存在");
+                            }
+                        }
+                    }
                     if (participatorCell != null) {
                         String part = participatorCell.getStringCellValue().trim();
                         //将项目负责人也添加到参与人当中来

+ 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());

BIN
fhKeeper/formulahousekeeper/management-platform/项目任务导入模板.xlsx


+ 15 - 6
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -2933,12 +2933,21 @@ a {
 
                     // 判断公司id是否等于936
                     if(this.user.companyId == '936') {
-                        this.$set(this.addForm, 'contractCode', item.projectSeparate.contractCode)
-                        this.$set(this.addForm, 'warrantyStartDate', item.projectSeparate.warrantyStartDate)
-                        this.$set(this.addForm, 'warrantyEndDate', item.projectSeparate.warrantyEndDate)
-                        this.$set(this.addForm, 'projectCategorySub', item.projectSeparate.projectCategorySub)
-                        this.$set(this.addForm, 'region', item.projectSeparate.region)
-                        this.$set(this.addForm, 'bu', item.projectSeparate.bu)
+                        if(item.projectSeparate) {
+                            this.$set(this.addForm, 'contractCode', item.projectSeparate.contractCode)
+                            this.$set(this.addForm, 'warrantyStartDate', item.projectSeparate.warrantyStartDate)
+                            this.$set(this.addForm, 'warrantyEndDate', item.projectSeparate.warrantyEndDate)
+                            this.$set(this.addForm, 'projectCategorySub', item.projectSeparate.projectCategorySub)
+                            this.$set(this.addForm, 'region', item.projectSeparate.region)
+                            this.$set(this.addForm, 'bu', item.projectSeparate.bu)
+                        } else {
+                            this.$set(this.addForm, 'contractCode', '')
+                            this.$set(this.addForm, 'warrantyStartDate', '')
+                            this.$set(this.addForm, 'warrantyEndDate', '')
+                            this.$set(this.addForm, 'projectCategorySub', '')
+                            this.$set(this.addForm, 'region', '')
+                            this.$set(this.addForm, 'bu', '')
+                        }
                     }
 
                     // 判断是否有供应商

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -13,7 +13,8 @@
             <el-divider style="margin: 0px 0px !important;height:0.5px;"></el-divider>
             <div class="tree" :style="'height:'+ (tableHeight + 83) + 'px'">
                 <!-- <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" accordion></el-tree> -->
-                <el-tree :data="data" :props="defaultProps" node-key="id" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa">
+                <!-- <el-tree :data="data" :props="defaultProps" node-key="id" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa"> -->
+                <el-tree :data="data" :props="defaultProps" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa">
                     <span class="custom-tree-node" style="position: relative;box-sizing: border-box;width: 10%;" slot-scope="{ node }" @mouseleave= mouseleave(data,$event) @mouseover= mouseover(data,$event)>
 
                         <span style="padding-right: 50px;box-sizing: border-box;overflow:hidden;text-overflow:ellipsis;line-height: 36px; display: inline-block;">{{ node.label }}</span>