|
@@ -101,6 +101,8 @@ public class TaskController {
|
|
|
@Resource
|
|
|
private TaskGroupService taskGroupService;
|
|
|
@Resource
|
|
|
+ private CompanyMapper companyMapper;
|
|
|
+ @Resource
|
|
|
private TaskAddCtrlMapper taskAddCtrlMapper;
|
|
|
@Resource
|
|
|
private TaskRestartMapper taskRestartMapper;
|
|
@@ -197,6 +199,7 @@ public class TaskController {
|
|
|
//当前用户
|
|
|
User user = userMapper.selectById(userId);
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
int isInsert=0;
|
|
|
int isUpdate=0;
|
|
@@ -358,7 +361,7 @@ public class TaskController {
|
|
|
if (task.getExecutorId() != null) {
|
|
|
msgRecepientList = task.getExecutorList().stream().filter(exe->!StringUtils.isEmpty(exe.getExecutorId())).map(TaskExecutor::getExecutorId).collect(Collectors.toList());
|
|
|
}
|
|
|
- if (task.getTaskType()!=null&&task.getTaskType() == 1) {
|
|
|
+ if (task.getTaskType()!=null&&((company.getProjectProgressMode() == 0 && task.getTaskType() == 1) || company.getProjectProgressMode() == 1)) {
|
|
|
needRecalculateProgress = true;
|
|
|
}
|
|
|
} else {
|
|
@@ -448,7 +451,7 @@ public class TaskController {
|
|
|
if(task.getFinishDate()==null){
|
|
|
taskMapper.updateFinishDate(task.getId());
|
|
|
}
|
|
|
- if ((oldTask.getTaskType() == 1 && task.getTaskType() != 1) || (oldTask.getTaskType() != 1 && task.getTaskType() == 1)) {
|
|
|
+ if (company.getProjectProgressMode() == 0 && ((oldTask.getTaskType() == 1 && task.getTaskType() != 1) || (oldTask.getTaskType() != 1 && task.getTaskType() == 1))) {
|
|
|
needRecalculateProgress = true;
|
|
|
}
|
|
|
}
|
|
@@ -486,7 +489,7 @@ public class TaskController {
|
|
|
|
|
|
//需要重新计算项目进度
|
|
|
if (needRecalculateProgress) {
|
|
|
- updateProjectProgress(task.getProjectId());
|
|
|
+ updateProjectProgress(company.getProjectProgressMode(), task.getProjectId());
|
|
|
}
|
|
|
if (msgRecepientList.size() > 0) {
|
|
|
//发消息通知执行人, 带项目id
|
|
@@ -526,60 +529,16 @@ public class TaskController {
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
- //撤回工作计划
|
|
|
- @RequestMapping("/withdrawalTaskPlan")
|
|
|
- public HttpRespMsg withdrawalTaskPlan(Integer taskId,HttpServletRequest request) {
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- String token = request.getHeader("TOKEN");
|
|
|
- User user = userMapper.selectById(token);
|
|
|
- Task task = taskMapper.selectById(taskId);
|
|
|
- if (task.getTaskPlan()!=1&&task.getIsTaskPlan()!=1){
|
|
|
- msg.setError("当前计划已变成任务不能撤回计划");
|
|
|
- return msg;
|
|
|
- }
|
|
|
- /**
|
|
|
- * 任务状态,0-进行中 1-已完成 2-已撤销 3-待第一审核人审核 4-待第二审核人审核 5-第一审核人驳回 6-第二审核人驳回
|
|
|
- */
|
|
|
- int count= projectLeaderMapper.selectCountIsLeader(taskId,user.getId());
|
|
|
- //是这个计划的小组长
|
|
|
- if (count>0){
|
|
|
- //待第一审核人审核
|
|
|
- if (task.getTaskStatus()==3){
|
|
|
- task.setTaskStatus(2);
|
|
|
- taskMapper.updateById(task);
|
|
|
- Information information = new Information();
|
|
|
- User owner = userMapper.selectById(task.getCheckFirstId());
|
|
|
- Project project = projectMapper.selectById(task.getProjectId());
|
|
|
- information.setMsg(project.getProjectName()+"项目有预计FTE计划撤销");
|
|
|
-// information.setTaskId(task.getId());
|
|
|
- information.setUserId(owner.getId());
|
|
|
- information.setType(11);
|
|
|
- information.setTime(LocalDateTime.now());
|
|
|
- informationMapper.insert(information);
|
|
|
- }else {
|
|
|
- msg.setError("当前计划已处于二级审核或已审核通过,不能撤回");
|
|
|
- return msg;
|
|
|
- }
|
|
|
- }
|
|
|
- //计划的第一审核人
|
|
|
- String checkFirstId = task.getCheckFirstId();
|
|
|
- if (checkFirstId!=null&&checkFirstId.equals(user.getId())){
|
|
|
- msg.setError("项目经理不能撤回");
|
|
|
- return msg;
|
|
|
- }
|
|
|
|
|
|
- //计划的第二审核人
|
|
|
- String checkSecondId = task.getCheckSecondId();
|
|
|
- if (checkSecondId!=null&&checkSecondId.equals(user.getId())){
|
|
|
- msg.setError("区域经理不能撤回");
|
|
|
- return msg;
|
|
|
- }
|
|
|
- return msg;
|
|
|
- }
|
|
|
-
|
|
|
- private void updateProjectProgress(Integer projectId) {
|
|
|
+ private void updateProjectProgress(Integer mode, Integer projectId) {
|
|
|
//只有里程碑才更新项目进度, 非已撤销状态的
|
|
|
- List<Task> all = taskMapper.simpleList(new QueryWrapper<Task>().eq("project_id", projectId).ne("task_status", 2).eq("task_type",1),null,null);
|
|
|
+ QueryWrapper<Task> queryWrapper = new QueryWrapper<Task>().eq("project_id", projectId)
|
|
|
+ .ne("task_status", 2)
|
|
|
+ .isNull("parent_tid");
|
|
|
+ if (mode == 0) {//仅统计里程碑
|
|
|
+ queryWrapper.eq("task_type",1);
|
|
|
+ }
|
|
|
+ List<Task> all = taskMapper.simpleList(queryWrapper,null,null);
|
|
|
Project project = new Project();
|
|
|
project.setId(projectId);
|
|
|
if (all.size() > 0) {
|
|
@@ -598,6 +557,7 @@ public class TaskController {
|
|
|
DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
User user = userMapper.selectById(token);
|
|
|
+ Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
//进行完成操作时需要检查子任务是否全部完成
|
|
|
if (task.getTaskStatus() == 0) {
|
|
|
QueryWrapper<Task> subQuery = new QueryWrapper<Task>();
|
|
@@ -717,9 +677,9 @@ public class TaskController {
|
|
|
}
|
|
|
|
|
|
//如果是里程碑,需要更新项目完成度
|
|
|
- if (curTask.getTaskType() == 1) {
|
|
|
+ if ((company.getProjectProgressMode() == 0 && curTask.getTaskType() == 1) || company.getProjectProgressMode() == 1) {
|
|
|
Integer projectId = curTask.getProjectId();
|
|
|
- updateProjectProgress(projectId);
|
|
|
+ updateProjectProgress(company.getProjectProgressMode(), projectId);
|
|
|
}
|
|
|
return msg;
|
|
|
}
|
|
@@ -1198,8 +1158,9 @@ public class TaskController {
|
|
|
|
|
|
|
|
|
//删除里程碑,需要重新计算项目进度
|
|
|
- if (task.getTaskType() == 1) {
|
|
|
- updateProjectProgress(task.getProjectId());
|
|
|
+ Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
+ if ((company.getProjectProgressMode() == 0 && task.getTaskType() == 1) || company.getProjectProgressMode() == 1) {
|
|
|
+ updateProjectProgress(company.getProjectProgressMode(), task.getProjectId());
|
|
|
}
|
|
|
return new HttpRespMsg();
|
|
|
}
|