|
@@ -226,24 +226,6 @@ public class TaskController {
|
|
task.setTaskPlan(1);
|
|
task.setTaskPlan(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-// TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
|
-// Integer taskFileCharge = timeType.getTaskFileCharge();
|
|
|
|
-// if(1 == taskFileCharge){
|
|
|
|
-// //主管: 员工所在部门[department]的manager_id 阶段一
|
|
|
|
-// //项目经理:project表的in_charge_id 阶段二
|
|
|
|
-// Department department = departmentMapper.selectById(user.getDepartmentId());
|
|
|
|
-// Project project = projectMapper.selectById(task.getProjectId());
|
|
|
|
-// if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
|
|
|
|
-// msg.setError("员工所在部门无负责人,请重新设置");
|
|
|
|
-// return msg;
|
|
|
|
-// }
|
|
|
|
-// if(org.apache.commons.lang3.StringUtils.isBlank(project.getInchargerId())){
|
|
|
|
-// msg.setError("该项目未设置项目经理,请重新设置");
|
|
|
|
-// return msg;
|
|
|
|
-// }
|
|
|
|
-// task.setChargeOneId(department.getManagerId());
|
|
|
|
-// task.setChargeTwoId(project.getInchargerId());
|
|
|
|
-// }
|
|
|
|
}
|
|
}
|
|
if (!StringUtils.isEmpty(executorListStr)) {
|
|
if (!StringUtils.isEmpty(executorListStr)) {
|
|
List<User> allUsers = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
|
|
List<User> allUsers = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
|
|
@@ -380,15 +362,6 @@ public class TaskController {
|
|
needRecalculateProgress = true;
|
|
needRecalculateProgress = true;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
-// task.setChargeOneId(null);
|
|
|
|
-// task.setChargeStage(null);
|
|
|
|
-// task.setChargeOneStatus(null);
|
|
|
|
-// task.setChargeOneTime(null);
|
|
|
|
-// task.setChargeTwoId(null);
|
|
|
|
-// task.setChargeTwoStatus(null);
|
|
|
|
-// task.setChargeTwoTime(null);
|
|
|
|
-// task.setFinalChargeStatus(null);
|
|
|
|
-// task.setFileRejectReason(null);
|
|
|
|
//更新的情况,需要对比是否修改了任务标题,更新子任务的parentTname
|
|
//更新的情况,需要对比是否修改了任务标题,更新子任务的parentTname
|
|
Task oldTask = taskService.getById(task.getId());
|
|
Task oldTask = taskService.getById(task.getId());
|
|
if (!oldTask.getName().equals(task.getName())) {
|
|
if (!oldTask.getName().equals(task.getName())) {
|
|
@@ -478,136 +451,9 @@ public class TaskController {
|
|
if ((oldTask.getTaskType() == 1 && task.getTaskType() != 1) || (oldTask.getTaskType() != 1 && task.getTaskType() == 1)) {
|
|
if ((oldTask.getTaskType() == 1 && task.getTaskType() != 1) || (oldTask.getTaskType() != 1 && task.getTaskType() == 1)) {
|
|
needRecalculateProgress = true;
|
|
needRecalculateProgress = true;
|
|
}
|
|
}
|
|
- // 未驳回之前 第一审核人 修改工作计划
|
|
|
|
- if (user.getCompanyId()==Constant.MLD_COMPANY_ID
|
|
|
|
- &&task.getIsTaskPlan()==1
|
|
|
|
- && org.apache.commons.lang3.StringUtils.isNotEmpty(task.getCheckFirstId())
|
|
|
|
- &&task.getCheckFirstId().equals(userId)
|
|
|
|
- &&task.getTaskStatus()==3){
|
|
|
|
- isUpdate=1;
|
|
|
|
- task.setTaskStatus(4);//待第二审核人审核
|
|
|
|
- } else if (user.getCompanyId() == Constant.MLD_COMPANY_ID
|
|
|
|
- && task.getIsTaskPlan() == 1
|
|
|
|
- && org.apache.commons.lang3.StringUtils.isNotEmpty(task.getCheckSecondId())
|
|
|
|
- && task.getCheckSecondId().equals(userId)
|
|
|
|
- &&task.getTaskStatus()==4) {
|
|
|
|
- isUpdate=2;
|
|
|
|
- task.setTaskStatus(0);//变化为进行中
|
|
|
|
- task.setIsTaskPlan(0);//不再是计划
|
|
|
|
- }
|
|
|
|
- // 驳回后,小组长对计划进行修改
|
|
|
|
- if (user.getCompanyId()==Constant.MLD_COMPANY_ID
|
|
|
|
- &&task.getIsTaskPlan()==1
|
|
|
|
- &&(task.getTaskStatus()==5||task.getTaskStatus()==6)
|
|
|
|
- &&(!userId.equals(task.getCheckFirstId())&&!userId.equals(task.getCheckSecondId()))
|
|
|
|
- ){
|
|
|
|
- isUpdate=3;
|
|
|
|
- task.setTaskStatus(3);//待第一审核人审核
|
|
|
|
- }
|
|
|
|
- // 撤回后,对计划进行修改
|
|
|
|
- if (user.getCompanyId()==Constant.MLD_COMPANY_ID
|
|
|
|
- &&task.getIsTaskPlan()==1
|
|
|
|
- &&(task.getTaskStatus()==2)
|
|
|
|
- ){
|
|
|
|
- if (user.getId().equals(task.getCheckFirstId())){
|
|
|
|
- task.setTaskStatus(4);//待第二审核人审核
|
|
|
|
- isUpdate=5;
|
|
|
|
- } else if (user.getId().equals(task.getCheckSecondId())) {
|
|
|
|
- task.setTaskStatus(0);//变化为进行中
|
|
|
|
- task.setIsTaskPlan(0);//不再是计划
|
|
|
|
- isUpdate=6;
|
|
|
|
- }else {
|
|
|
|
- task.setTaskStatus(3);//待第一审核人审核
|
|
|
|
- isUpdate=4;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (Constant.MLD_COMPANY_ID==user.getCompanyId()&&task.getIsTaskPlan()==1) {
|
|
|
|
- if (task.getCheckSecondId() != null && !task.getExecutorList().isEmpty()) {
|
|
|
|
- System.out.println("===>"+task.getExecutorList());
|
|
|
|
- List<User> userManagers = userMapper.selectList(new QueryWrapper<User>()
|
|
|
|
- .eq("role_name", "区域经理&PM").eq("company_id",user.getCompanyId()));
|
|
|
|
- for (TaskExecutor taskExecutor : task.getExecutorList()) {
|
|
|
|
- boolean b = userManagers.stream().anyMatch(u -> u.getId().equals(taskExecutor.getExecutorId()));
|
|
|
|
- if (b) {
|
|
|
|
- msg.setError("工作计划执行人不能选择区域经理");
|
|
|
|
- return msg;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
boolean saved = taskService.saveOrUpdate(task);
|
|
boolean saved = taskService.saveOrUpdate(task);
|
|
- //新增成功,给第一审核人发送信息提醒
|
|
|
|
- if (saved&&isInsert==1){
|
|
|
|
- if (user.getCompanyId()==Constant.MLD_COMPANY_ID&&task.getIsTaskPlan()==1&& org.apache.commons.lang3.StringUtils.isNotEmpty(task.getCheckFirstId())){
|
|
|
|
- //给第一审核人发送信息提醒
|
|
|
|
- msgRecepientList=new ArrayList<>();
|
|
|
|
- log.info("添加工作计划,给第一审核人发送信息提醒");
|
|
|
|
- User owner = userMapper.selectById(task.getCheckFirstId());
|
|
|
|
- Information information = new Information();
|
|
|
|
- Project project = projectMapper.selectById(task.getProjectId());
|
|
|
|
- information.setMsg(project.getProjectName()+"项目有新的预计FTE计划审批任务,请您查收.");
|
|
|
|
- information.setTaskId(task.getId());
|
|
|
|
- information.setType(11);
|
|
|
|
- information.setUserId(owner.getId());
|
|
|
|
- information.setTime(LocalDateTime.now());
|
|
|
|
- informationService.save(information);
|
|
|
|
- }
|
|
|
|
- } else if (saved && isUpdate > 0) {
|
|
|
|
- msgRecepientList=new ArrayList<>();
|
|
|
|
- //第一审核人修改后, 变成待第二审核人审核
|
|
|
|
- if (isUpdate==1||isUpdate==5){
|
|
|
|
- User owner = userMapper.selectById(task.getCheckSecondId());
|
|
|
|
- Information information = new Information();
|
|
|
|
- Project project = projectMapper.selectById(task.getProjectId());
|
|
|
|
- information.setMsg(project.getProjectName()+"项目有新的预计FTE计划审批任务,请您查收.");
|
|
|
|
- information.setTaskId(task.getId());
|
|
|
|
- information.setType(11);
|
|
|
|
- information.setUserId(owner.getId());
|
|
|
|
- information.setTime(LocalDateTime.now());
|
|
|
|
- informationService.save(information);
|
|
|
|
-
|
|
|
|
- }else if(isUpdate==2||isUpdate==6){
|
|
|
|
- List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", task.getId()));
|
|
|
|
- if(CollectionUtils.isNotEmpty(taskExecutorList)){
|
|
|
|
- for (TaskExecutor taskExecutor : taskExecutorList) {
|
|
|
|
- //给任务的执行人发送信息提醒
|
|
|
|
- User owner = userMapper.selectById(taskExecutor.getExecutorId());
|
|
|
|
- Information information = new Information();
|
|
|
|
- information.setMsg("您有新的任务");
|
|
|
|
- information.setContent(taskExecutor.getProjectId()==null?null:(""+taskExecutor.getProjectId()));
|
|
|
|
- information.setType(1);
|
|
|
|
- information.setUserId(owner.getId());
|
|
|
|
- information.setTime(LocalDateTime.now());
|
|
|
|
- informationService.save(information);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else if (isUpdate==3) {
|
|
|
|
- //给第一审核人发送信息提醒
|
|
|
|
- log.info("驳回后小组长修改,给第一审核人发送信息提醒");
|
|
|
|
- User owner = userMapper.selectById(task.getCheckFirstId());
|
|
|
|
- Information information = new Information();
|
|
|
|
- information.setType(11);
|
|
|
|
- Project project = projectMapper.selectById(task.getProjectId());
|
|
|
|
- information.setMsg(project.getProjectName()+"项目有新的预计FTE计划审批任务,请您查收.");
|
|
|
|
- information.setTaskId(task.getId());
|
|
|
|
- information.setUserId(owner.getId());
|
|
|
|
- information.setTime(LocalDateTime.now());
|
|
|
|
- informationService.save(information);
|
|
|
|
- } else if (isUpdate==4) {
|
|
|
|
- //给第一审核人发送信息提醒
|
|
|
|
- log.info("撤销后小组长修改,给第一审核人发送信息提醒");
|
|
|
|
- User owner = userMapper.selectById(task.getCheckFirstId());
|
|
|
|
- Information information = new Information();
|
|
|
|
- information.setType(11);
|
|
|
|
- Project project = projectMapper.selectById(task.getProjectId());
|
|
|
|
- information.setMsg(project.getProjectName()+"项目有新的预计FTE计划审批任务,请您查收.");
|
|
|
|
- information.setTaskId(task.getId());
|
|
|
|
- information.setUserId(owner.getId());
|
|
|
|
- information.setTime(LocalDateTime.now());
|
|
|
|
- informationService.save(information);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
if (task.getExecutorId() == null) {
|
|
if (task.getExecutorId() == null) {
|
|
//清空执行人
|
|
//清空执行人
|
|
if (!isNew) {
|
|
if (!isNew) {
|
|
@@ -631,7 +477,11 @@ public class TaskController {
|
|
comment.setUserName(user.getName());
|
|
comment.setUserName(user.getName());
|
|
comment.setType(isNew?1:2);
|
|
comment.setType(isNew?1:2);
|
|
//comment.setContent(user.getName()+(isNew?"创建":"编辑")+"了任务");
|
|
//comment.setContent(user.getName()+(isNew?"创建":"编辑")+"了任务");
|
|
- comment.setContent(user.getName()+(isNew?MessageUtils.message("entry.create"):MessageUtils.message("entry.editedTask"))+MessageUtils.message("entry.task")+(isNew?"":taskCommentString.toString()));
|
|
|
|
|
|
+ String content = user.getName()+(isNew?MessageUtils.message("entry.create"):MessageUtils.message("entry.editedTask"))+MessageUtils.message("entry.task")+(isNew?"":taskCommentString.toString());
|
|
|
|
+ if (content.length() > 1995) {
|
|
|
|
+ content = content.substring(0, 1995) + "...";
|
|
|
|
+ }
|
|
|
|
+ comment.setContent(content);
|
|
taskCommentMapper.insert(comment);
|
|
taskCommentMapper.insert(comment);
|
|
|
|
|
|
//需要重新计算项目进度
|
|
//需要重新计算项目进度
|