ソースを参照

美莱德任务计划

QuYueTing 2 日 前
コミット
70caaae0c3

+ 17 - 2
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/controller/ParticipationController.java

@@ -1,12 +1,16 @@
 package com.management.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.management.platform.entity.User;
 import com.management.platform.mapper.ParticipationMapper;
+import com.management.platform.mapper.UserMapper;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * <p>
@@ -23,10 +27,21 @@ public class ParticipationController {
     @Resource
     private ParticipationMapper participationMapper;
 
+    @Resource
+    private UserMapper userMapper;
+
     @RequestMapping("/getByProjectId")
-    public HttpRespMsg getByProjectId(Integer projectId) {
+    public HttpRespMsg getByProjectId(Integer projectId, HttpServletRequest request) {
         HttpRespMsg msg = new HttpRespMsg();
-        msg.data = participationMapper.getParticipator(projectId);
+        if (projectId == null) {
+            String token = request.getHeader("TOKEN");
+            User user = userMapper.selectById(token);
+            //未指定项目时加载全部在职人员
+            msg.data = userMapper.selectList(new QueryWrapper<User>().select("id, job_number, name").eq("is_active", 1).eq("company_id", user.getCompanyId()));
+        } else {
+            msg.data = participationMapper.getParticipator(projectId);
+        }
+
         return msg;
     }
 }

+ 7 - 4
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/controller/TaskController.java

@@ -525,6 +525,13 @@ public class TaskController {
             if (needReOrderList.size() > 0) {
                 taskService.updateBatchById(needReOrderList);
             }
+            List<TaskExecutor> exeList = taskExecutorService.list(new QueryWrapper<TaskExecutor>().eq("task_id", task.getId()));
+            List<String> retIds = new ArrayList<>();
+            for (TaskExecutor exe : exeList) {
+                retIds.add(MessageUtils.message("excel.task") + "_"+task.getId() +"_"+ exe.getId());
+            }
+            //给新建的计划返回甘特图id
+            msg.data = retIds;
         }
 
         TaskComment comment = new TaskComment();
@@ -536,10 +543,6 @@ public class TaskController {
         comment.setContent(user.getName()+(isNew?MessageUtils.message("entry.create"):MessageUtils.message("entry.editedTask"))+MessageUtils.message("entry.task")+(isNew?"":taskCommentString.toString()));
         taskCommentMapper.insert(comment);
 
-        //需要重新计算项目进度
-//        if (needRecalculateProgress) {
-//            updateProjectProgress(task.getProjectId());
-//        }
         if (msgRecepientList.size() > 0) {
             //发消息通知执行人, 带项目id
             msgRecepientList.forEach(msgRecepient->{

+ 1 - 10
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/controller/UserCorpwxTimeController.java

@@ -228,17 +228,8 @@ public class UserCorpwxTimeController {
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
         List<Map> list = new ArrayList<Map>();
-        list = userCorpwxTimeMapper.getUserDataList(user.getCompanyId(), startDate, endDate, null, user.getId());
+        list = userCorpwxTimeMapper.getUserDataList(user.getCompanyId(), startDate, endDate, null, user.getRoleName().contains("管理员")?null:user.getId());
         //工作日处理,排除常规周末和法定节假日
-        DateTimeFormatter dtf =  DateTimeFormatter.ofPattern("yyyy/MM/dd");
-//        list = list.stream().filter(time->{
-//            String date = (String)time.get("createDate");
-//            if (WorkDayCalculateUtils.isWorkDay(LocalDate.parse(date, dtf))) {
-//                return true;
-//            } else {
-//                return false;
-//            }
-//        }).collect(Collectors.toList());
         DateTimeFormatter standFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         HashMap item = new HashMap();
         item.put("list", list);

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/mapper/ProjectMapper.java

@@ -73,7 +73,7 @@ public interface ProjectMapper extends BaseMapper<Project> {
 
     List<Map> getTaskPlanByProject(@Param("projectIds") List<Integer> projectIds, @Param("startDate") String startDate,
                                 @Param("endDate") String endDate, @Param("companyId") Integer companyId,@Param("groupName")String groupName,@Param("taskType")Integer taskType,
-                                   @Param("creatorId") String creatorId);
+                                   @Param("userIds") List<String> userIds);
     List<Map> getTaskPlanWithLeave(@Param("userIds") List<String> userIds, @Param("startDate") String startDate,
                                    @Param("endDate") String endDate, @Param("companyId") Integer companyId,@Param("creatorId") String creatorId,@Param("targetUserId") String targetUserId);
 

+ 8 - 40
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -4806,7 +4806,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部项目");
         List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
         List<User> AllUser = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
-        List<Integer> relatedProjectIds = new ArrayList<>();
+        List<Integer> projectIds = null;
         if (functionList.size() == 0) {
             //担任部门主要负责人
             if (user.getManageDeptId() != null && user.getManageDeptId() != 0) {
@@ -4840,7 +4840,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         HttpRespMsg msg = new HttpRespMsg();
         List<GanttDataItem> itemList = new ArrayList<>();
 
-        List<Integer> projectIds = null;
+
         if (targetProjectId != null) {
             projectIds = new ArrayList<>();
             projectIds.add(targetProjectId);
@@ -4973,9 +4973,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         }
                     }
                 }
+                List<Project> allProjectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()));
                 if (taskType!=null) {
-                    List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()));
-                    List<Integer> collect = projectList.stream().map(Project::getId).collect(Collectors.toList());
+                    List<Integer> collect = allProjectList.stream().map(Project::getId).collect(Collectors.toList());
                     List<Task> tasks = taskMapper.selectList(new QueryWrapper<Task>().eq("task_plan_type", taskType).in("project_id", collect));
                     List filterPids = tasks.stream().map(Task::getProjectId).collect(Collectors.toList());
                     if (projectIds == null) {
@@ -4985,38 +4985,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         }
                     }
                 }
-                ganttData = projectMapper.getTaskPlanByProject(projectIds, startDate ,endDate, user.getCompanyId(),groupName,taskType,user.getId());
-//                System.out.println("ganttData1:"+ganttData.size());
-//                List<ProjectLeader> leaderList = projectLeaderService.list(new QueryWrapper<ProjectLeader>().eq("leader_id", user.getId()).eq("company_id", user.getCompanyId()));
-//                //是小组长
-//                if (!leaderList.isEmpty()){
-//                    List<Integer> projectIdList = leaderList.stream().map(ProjectLeader::getProjectId).collect(Collectors.toList());
-//                    projectIdList.add(-1);
-//                    List<Map> taskPlanByGeneralMemb = projectMapper.getTaskPlanByProjectGeneralMemb(projectIdList,startDate ,endDate, user.getCompanyId(),user.getId(),groupName,taskType,targetProjectId);
-//                    System.out.println("ganttData2:"+taskPlanByGeneralMemb.size());
-//                    ganttData.addAll(taskPlanByGeneralMemb);
-//                }
-//                //找到自己担任项目经理的项目,: is_task_plan==1 ,checkFirstId=自己的id 并且 task_status=3
-//                List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("incharger_id", user.getId()));
-//                if (!projectList.isEmpty()){
-//                    List<Integer> projectIdList = projectList.stream().map(Project::getId).collect(Collectors.toList());
-//                    projectIdList.add(-1);
-//                    List<Map> taskPlanByProjectManager = projectMapper.getTaskPlanByProjectManager(projectIdList,startDate ,endDate, user.getCompanyId(),user.getId(),groupName,taskType,targetProjectId);
-//                    System.out.println("ganttData2:"+taskPlanByProjectManager.size());
-//                    ganttData.addAll(taskPlanByProjectManager);
-//                }
-//
-//                if (user.getRoleName().equals("区域经理&PM")){
-//                    List<Task> taskList = taskService.list(new QueryWrapper<Task>().eq("check_second_id", user.getId()));
-//                    List<Integer> taskIdList = taskList.stream().map(Task::getId).collect(Collectors.toList());
-//                    taskIdList.add(-1);
-//                    List<TaskExecutor> executorList = taskExecutorService.list(new QueryWrapper<TaskExecutor>().in("task_id", taskIdList).isNotNull("executor_id"));
-//                    List<Integer> projectIdList = executorList.stream().distinct().map(TaskExecutor::getProjectId).collect(Collectors.toList());
-//                    projectIdList.add(-1);
-//                    List<Map> taskPlanByProjectAreaManager = projectMapper.getTaskPlanByProjectAreaManager(projectIdList, startDate, endDate, user.getCompanyId(),user.getId(),groupName,taskType,targetProjectId);
-//                    System.out.println("ganttData2:"+taskPlanByProjectAreaManager.size());
-//                    ganttData.addAll(taskPlanByProjectAreaManager);
-//                }
+                System.out.println("按项目查看,项目size="+projectIds.size());
+                ganttData = projectMapper.getTaskPlanByProject(projectIds, startDate ,endDate, user.getCompanyId(),groupName,taskType,userIds);
                 QueryWrapper<BusinessTrip> btQueryWrapper =new QueryWrapper<>();
                 QueryWrapper<BustripProject> bpQueryWrapper =new QueryWrapper<>();
                 btQueryWrapper.in("owner_id", userIds);
@@ -5035,7 +5005,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     }
                 }
                 List<BustripProject> bustripProjectList = bustripProjectMapper.selectList(bpQueryWrapper);
-                List<Project> allProjectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()));
                 for(BusinessTrip businessTrip:businessTripList){
                     List<BustripProject> collect = bustripProjectList.stream().filter(bp -> bp.getBustripId().equals(businessTrip.getId())).collect(Collectors.toList());
                     for(BustripProject bustripProject:collect){
@@ -5114,8 +5083,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     curItem.id = exeId;
                     curItem.userId = (String) map.get("user_id");
                     curItem.text = (String) map.get("project_name")+"/"+(String)map.get("task_name");
-//                    curItem.setCheckFirstId(map.get("checkFirstId")==null?null:(String) map.get("checkFirstId"));
-//                    curItem.setCheckSecondId(map.get("checkSecondId")==null?null:(String) map.get("checkSecondId"));
                     curItem.start_date = start_date;
 
                     curItem.setTaskPlanType(map.get("taskPlanType")==null?null:(Integer)map.get("taskPlanType"));
@@ -8701,6 +8668,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             }
 
             userList = userMapper.selectList(queryWrapper);
+
         }
         List<User> finalUserList = new ArrayList<>();
         userList.forEach(u->{
@@ -12853,7 +12821,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         }
                     }
                 }
-                ganttData = projectMapper.getTaskPlanByProject(projectIds, startDate ,endDate, user.getCompanyId(),null,null,user.getId());
+                ganttData = projectMapper.getTaskPlanByProject(projectIds, startDate ,endDate, user.getCompanyId(),null,null,userIds);
                 QueryWrapper<BusinessTrip> btQueryWrapper =new QueryWrapper<>();
                 QueryWrapper<BustripProject> bpQueryWrapper =new QueryWrapper<>();
                 btQueryWrapper.in("owner_id", userIds);

+ 12 - 1
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -1198,7 +1198,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
     public HttpRespMsg cancelByManager(Integer id, HttpServletRequest request) {
         HttpRespMsg msg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
-        User user = userMapper.selectById(token);
         Task task = taskMapper.selectById(id);
         if (task.getTaskStatus() == TaskController.STATUS_DOING) {
             task.setTaskStatus(TaskController.STATUS_CANCEL);
@@ -1211,6 +1210,18 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
             information.setUserId(owner.getId());
             information.setTime(LocalDateTime.now());
             informationMapper.insert(information);
+
+            //给执行人发消息
+            List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", id));
+            executorList.forEach(e->{
+                User executor = userMapper.selectById(e.getExecutorId());
+                Information exeInformation = new Information();
+                exeInformation.setMsg("您有工作计划被取消");
+                exeInformation.setType(11);
+                exeInformation.setUserId(executor.getId());
+                exeInformation.setTime(LocalDateTime.now());
+                informationMapper.insert(exeInformation);
+            });
         }
         return msg;
     }

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform-mld/src/main/resources/mapper/ProjectMapper.xml

@@ -782,6 +782,10 @@
         <if test="taskType !=null  ">
             and task.task_plan_type = #{taskType}
         </if>
+        <if test="userIds != null">
+            and exists(select 1 from task_executor where task.id=task_executor.task_id
+                         and task_executor.executor_id in <foreach collection="userIds" close=")" open="(" separator="," index="" item="item">#{item}</foreach>)
+        </if>
         and ((IFNULL(task.start_date , task.end_date) between #{startDate} and #{endDate}) or (task.end_date between #{startDate} and #{endDate}))
         and task.end_date is not null
         AND project.`status` = 1

+ 0 - 2
fhKeeper/formulahousekeeper/timesheet_mld/src/components/taskComponent.vue

@@ -1598,8 +1598,6 @@ export default {
         );
     },
     getUsers() {
-        if (!this.addForm.projectId) return;
-        // if (!this.curProjectId && !) return
         this.http.post('/participation/getByProjectId', {projectId: this.addForm.projectId},
         res => {
             if (res.code == "ok") {

+ 22 - 22
fhKeeper/formulahousekeeper/timesheet_mld/src/views/task/list.vue

@@ -82,7 +82,7 @@
                 </el-form-item>
                 <el-form-item style="float: right;" v-if="user.companyId != '3092'">
                     <el-link type="primary" :underline="false" @click="isganttshow = true" style="margin-right: 10px;" v-if="permissions.projectResources">资源分配</el-link>
-                     <el-link type="primary" :underline="false" @click="addTask()">新建任务</el-link>
+                     <el-link type="primary" :underline="false" @click="addTask()">新建计划</el-link>
                      <el-link type="primary" :underline="false" @click="importTaskDialog = true" style="margin-left: 10px;">批量导入</el-link>
                      <el-link type="primary" :underline="false" @click="exportTaskList()" style="margin-left: 10px;" v-loading="exportTaskLoading"  >数据导出</el-link>
                 </el-form-item>
@@ -351,7 +351,7 @@
             </div>
         </el-dialog>
 
-        <!-- 任务详情信息弹出框 -->
+        <!-- 计划详情信息弹出框 -->
         <el-dialog :class="addForm.id==null?'':'jm'" :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" 
         :close-on-click-modal="false" customClass="customWidth" width="840px" :top="'6vh'">
         <!-- <div style="width: 200%;height:80%;position: absolute;right:-100%;top:0;background:#000;opacity: 0;" @click="sss"></div> -->
@@ -759,7 +759,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                 textContent: true, // 控制提交 
                 times: null,
                 text2: '',
-                innerVisibless: false, // 任务展示弹出层
+                innerVisibless: false, // 计划展示弹出层
                 activities: [{
                     content: this.$t('normals'),
                     timestamp: this.$t('hoursago'),
@@ -840,7 +840,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
             };
         },
         methods: {
-            // 批量导入任务
+            // 批量导入计划
             importTask(item) {
                 //首先判断文件类型
                 this.loadingExport = true
@@ -1017,7 +1017,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                 this.rejectItem = data;
                 if (isPass) {
                     //弹窗confirm确认
-                    this.$confirm('确认审核通过该任务吗', this.$t('other.prompts'), {
+                    this.$confirm('确认审核通过该计划吗', this.$t('other.prompts'), {
                     //type: 'warning'
                     }).then(() => {
                         this.viewFilesAndReviewThemRejectCli(true);
@@ -1522,7 +1522,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                     });
                 })
             },
-            // 导出任务
+            // 导出计划
             exportTask() {
                 // console.log('执行代码')
                 this.exportTaskLoading = true
@@ -1757,7 +1757,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
             },
             //进行中的,撤销操作
             cancelTask(item) {
-                this.$confirm('您确定要撤销该任务吗?', this.$t('other.prompts'), {
+                this.$confirm('您确定要撤销该计划吗?', this.$t('other.prompts'), {
                     //type: 'warning'
                 }).then(() => {
                     this.isDeleting = true;
@@ -1845,14 +1845,14 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                     });
                 })
             },
-            // 重启任务点击事件
+            // 重启计划点击事件
             causeRejectionClick() {
                 this.causeRejectionForm.userList = this.causeRejectionForm.responsible.toString()
                 console.log(this.causeRejectionForm)
                 // return
                 this.restart(this.causeRejectionForm)
             },
-            // 点击任务事件
+            // 点击计划事件
             editTask(task) {
                 this.addFormVisible = true;
                 // this.addLoading = false;
@@ -1879,7 +1879,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                 this.taskComponentFlg = true
 
                 this.getTaskDetail(task.id);
-                // this.getTaskProgressList(task.id); // 获取任务进展列表 
+                // this.getTaskProgressList(task.id); // 获取计划进展列表 
                 // this.getUsers(); // 获取名单数据
                 // this.gain(task); // 获取评论列表
                 // this.getDailyList(task.id) // 获取来自日报
@@ -1920,7 +1920,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                     });
                 });
             },
-            //获取任务进展列表
+            //获取计划进展列表
             getTaskProgressList(taskId) {
                 this.taskIid = taskId
                 this.http.post('/task-progress/list', {taskId: taskId},
@@ -2016,11 +2016,11 @@ import { getThemeColor } from '@/utils/commonMethod.js'
             sss(){
                 this.$refs.addRem.style.display="none" 
             },
-            addprogress(){ // 添加子任务进展事件
+            addprogress(){ // 添加子计划进展事件
                 this.$refs.proBox.style.display="block"
                 this.$refs.addPro.style.display="none"
             },
-            shutPro() { // 关闭任务进展
+            shutPro() { // 关闭计划进展
                 this.$refs.addPro.style.display="block"
                 this.$refs.addRem.style.display="none" 
                 this.$refs.proBox.style.display="none" 
@@ -2043,12 +2043,12 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                     this.checkLists.splice(k, 1)
                 }
             },
-            shutPro() { // 关闭任务进展
+            shutPro() { // 关闭计划进展
                 this.$refs.addPro.style.display="block"
                 this.$refs.addRem.style.display="none" 
                 this.$refs.proBox.style.display="none" 
             },
-            addTaskProgress() { //创建任务进展
+            addTaskProgress() { //创建计划进展
                 var param = {
                     taskId: this.taskIid,
                     status: this.radio,
@@ -2081,7 +2081,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                     }
                 );
             },
-            //删除任务进展
+            //删除计划进展
             deleteTaskProgress(id) {
                 this.http.post('/task-progress/deleteProgress', {id: id},
                     res => {
@@ -2100,7 +2100,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                     }
                 );
             },
-            //显示子任务创建卡片
+            //显示子计划创建卡片
             addSubTask() {
                 this.addFormVisible = true;
                 this.addForm = {parentTname: this.addForm.name,parentTid: this.addForm.id,projectId: this.addForm.projectId, groupId: this.addForm.groupId,  taskLevel:0, planHours: 8, taskType: 0};
@@ -2133,7 +2133,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                             });
                         });
             },
-            //认领任务
+            //认领计划
             addAsMyTask(task) {
                 this.http.post('/task/addAsMyTask',{id: task.id},
                 res => {
@@ -2338,14 +2338,14 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                         }
                 });
             },
-            //加载项目内的任务列表
+            //加载项目内的计划列表
             getStageList() {
                 // console.log('进来了')
                 this.http.post('/stages/list',{groupId: this.selectedGroup.id, projectId: this.selectedGroup.projectId, order: this.order, isDesc: this.isDesc},
                 res => {
                     if (res.code == "ok") {
                         this.stageList = res.data.list;
-                        // console.log('触发获取任务列表函数')
+                        // console.log('触发获取计划列表函数')
                         this.timess() // 处理时间的方法
                     } else {
                         this.$message({
@@ -2361,7 +2361,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                     });
                 });
             },
-            //删除当前编辑的任务
+            //删除当前编辑的计划
             deleteTask() {
                 var warning='';
                 if (this.addForm.subTaskList.length > 0) {
@@ -2501,7 +2501,7 @@ import { getThemeColor } from '@/utils/commonMethod.js'
                     });
                 });
             },
-            // 获取任务分组列表
+            // 获取计划分组列表
             getTaskGroupList() {
                 this.http.post('/task-group/list',{
                     projectId: this.screenProjectId