|
@@ -12,7 +12,6 @@ import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.*;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
import com.management.platform.util.MessageUtils;
|
|
|
-import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
|
import org.assertj.core.util.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -145,23 +144,23 @@ public class TaskController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /***
|
|
|
- * 文件审核
|
|
|
- * @param taskId 任务id
|
|
|
- * @param projectId 项目id
|
|
|
- * @param auditStatus 审核状态 1通过 2驳回
|
|
|
- * @param reason 驳回理由
|
|
|
- * @param request
|
|
|
- * @return
|
|
|
- */
|
|
|
- @PostMapping("/auditFile")
|
|
|
- public HttpRespMsg auditFile(@RequestParam("taskId")Integer taskId
|
|
|
- ,@RequestParam("projectId")String projectId
|
|
|
- ,@RequestParam("auditStatus")Integer auditStatus
|
|
|
- ,@RequestParam(value = "reason",required = false)String reason
|
|
|
- ,HttpServletRequest request) {
|
|
|
- return taskService.auditFile(taskId,projectId,auditStatus,reason,request);
|
|
|
- }
|
|
|
+// /***
|
|
|
+// * 文件审核
|
|
|
+// * @param taskId 任务id
|
|
|
+// * @param projectId 项目id
|
|
|
+// * @param auditStatus 审核状态 1通过 2驳回
|
|
|
+// * @param reason 驳回理由
|
|
|
+// * @param request
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @PostMapping("/auditFile")
|
|
|
+// public HttpRespMsg auditFile(@RequestParam("taskId")Integer taskId
|
|
|
+// ,@RequestParam("projectId")String projectId
|
|
|
+// ,@RequestParam("auditStatus")Integer auditStatus
|
|
|
+// ,@RequestParam(value = "reason",required = false)String reason
|
|
|
+// ,HttpServletRequest request) {
|
|
|
+// return taskService.auditFile(taskId,projectId,auditStatus,reason,request);
|
|
|
+// }
|
|
|
|
|
|
@RequestMapping("/save")
|
|
|
@Transactional
|
|
@@ -180,24 +179,24 @@ public class TaskController {
|
|
|
task.setCreaterName(user.getName());
|
|
|
task.setCreatorColor(user.getColor());
|
|
|
task.setCompanyId(user.getCompanyId());
|
|
|
- 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());
|
|
|
- }
|
|
|
+// 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)) {
|
|
|
List<User> allUsers = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
|
|
@@ -332,15 +331,15 @@ public class TaskController {
|
|
|
needRecalculateProgress = true;
|
|
|
}
|
|
|
} 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);
|
|
|
+// 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
|
|
|
Task oldTask = taskService.getById(task.getId());
|
|
|
if (!oldTask.getName().equals(task.getName())) {
|
|
@@ -1368,77 +1367,76 @@ public class TaskController {
|
|
|
List<Integer> collect = list.stream().map(l -> l.getId()).distinct().collect(Collectors.toList());
|
|
|
collect.add(-1);
|
|
|
List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().in("task_id", collect));
|
|
|
- List<TaskFiles> taskFilesList = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>().in(TaskFiles::getTaskId, collect));
|
|
|
+// List<TaskFiles> taskFilesList = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>().in(TaskFiles::getTaskId, collect));
|
|
|
List<Integer> pids = list.stream().map(Task::getProjectId).collect(Collectors.toList());
|
|
|
pids.add(-1);
|
|
|
List<Project> projectList = projectService.list(new QueryWrapper<Project>().in("id", pids));
|
|
|
- TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
- WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
|
|
|
- CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
|
|
|
- if(1 == timeType.getTaskFileCharge()){
|
|
|
- List<String> userIds = new ArrayList<>();
|
|
|
- List<String> chargeOneIds = list.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeOneId()))
|
|
|
- .map(Task::getChargeOneId).collect(Collectors.toList());
|
|
|
- List<String> chargeTwoIds = list.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeTwoId()))
|
|
|
- .map(Task::getChargeTwoId).collect(Collectors.toList());
|
|
|
- userIds.addAll(chargeOneIds);
|
|
|
- userIds.addAll(chargeTwoIds);
|
|
|
-
|
|
|
- Map<String, User> userIdMap = new HashMap<>();
|
|
|
- if(CollectionUtils.isNotEmpty(userIds)){
|
|
|
- userIds = userIds.stream().distinct().collect(Collectors.toList());
|
|
|
- List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
|
|
|
- .select(User::getId,User::getName)
|
|
|
- .in(User::getId, userIds)
|
|
|
- );
|
|
|
- userIdMap = users.stream().collect(Collectors.toMap(User::getId, t->t));
|
|
|
- }
|
|
|
- Map<Integer, List<TaskFiles>> taskFilesMap = new HashMap<>();
|
|
|
- if(CollectionUtils.isNotEmpty(taskFilesList)){
|
|
|
- taskFilesMap = taskFilesList.stream().collect(Collectors.groupingBy(TaskFiles::getTaskId));
|
|
|
- }
|
|
|
- for (Task task : list) {
|
|
|
- List<TaskFiles> tmp = taskFilesMap.get(task.getId());
|
|
|
- if(CollectionUtils.isEmpty(tmp)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(org.apache.commons.lang3.StringUtils.isBlank(task.getChargeOneId()) || org.apache.commons.lang3.StringUtils.isBlank(task.getChargeTwoId())){
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(1 == task.getFinalChargeStatus()){
|
|
|
- task.setFinalChargeStatusText("审核通过");
|
|
|
- task.setFileChargeStatus(1);
|
|
|
- } else if (0 == task.getFinalChargeStatus()) {
|
|
|
- String name = "";
|
|
|
- String statusText = "";
|
|
|
- String userWxId = "";
|
|
|
- String fileChargeStatusText = "";
|
|
|
- int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
|
|
|
- String tmpUserId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
|
|
|
- User chargeUser = userIdMap.get(tmpUserId);
|
|
|
- if(null != chargeUser){
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- userWxId = chargeUser.getCorpwxRealUserid();
|
|
|
- }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
- userWxId = chargeUser.getDingdingUserid();
|
|
|
- }
|
|
|
- name = chargeUser.getName();
|
|
|
- }
|
|
|
- switch (finalStatus)
|
|
|
- {
|
|
|
- case 0: statusText = "待审核"; task.setFileChargeStatus(0);break;
|
|
|
- case 1: statusText = "通过";break;
|
|
|
- case 2: statusText = "驳回"; task.setFileChargeStatus(2);break;
|
|
|
- }
|
|
|
- if(org.apache.commons.lang3.StringUtils.isBlank(userWxId)){
|
|
|
- fileChargeStatusText = statusText+"("+name+")";
|
|
|
- }else{
|
|
|
- fileChargeStatusText = statusText+"("+("$userName=" + userWxId + "$")+")";
|
|
|
- }
|
|
|
- task.setFinalChargeStatusText(fileChargeStatusText);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
+// WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
|
|
|
+// CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
|
|
|
+// if(1 == timeType.getTaskFileCharge()){
|
|
|
+// List<String> userIds = new ArrayList<>();
|
|
|
+// List<String> chargeOneIds = list.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeOneId()))
|
|
|
+// .map(Task::getChargeOneId).collect(Collectors.toList());
|
|
|
+// List<String> chargeTwoIds = list.stream().filter(t-> org.apache.commons.lang3.StringUtils.isNotBlank(t.getChargeTwoId()))
|
|
|
+// .map(Task::getChargeTwoId).collect(Collectors.toList());
|
|
|
+// userIds.addAll(chargeOneIds);
|
|
|
+// userIds.addAll(chargeTwoIds);
|
|
|
+// Map<String, User> userIdMap = new HashMap<>();
|
|
|
+// if(CollectionUtils.isNotEmpty(userIds)){
|
|
|
+// userIds = userIds.stream().distinct().collect(Collectors.toList());
|
|
|
+// List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
|
|
|
+// .select(User::getId,User::getName)
|
|
|
+// .in(User::getId, userIds)
|
|
|
+// );
|
|
|
+// userIdMap = users.stream().collect(Collectors.toMap(User::getId, t->t));
|
|
|
+// }
|
|
|
+// Map<Integer, List<TaskFiles>> taskFilesMap = new HashMap<>();
|
|
|
+// if(CollectionUtils.isNotEmpty(taskFilesList)){
|
|
|
+// taskFilesMap = taskFilesList.stream().collect(Collectors.groupingBy(TaskFiles::getTaskId));
|
|
|
+// }
|
|
|
+// for (Task task : list) {
|
|
|
+// List<TaskFiles> tmp = taskFilesMap.get(task.getId());
|
|
|
+// if(CollectionUtils.isEmpty(tmp)){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// if(org.apache.commons.lang3.StringUtils.isBlank(task.getChargeOneId()) || org.apache.commons.lang3.StringUtils.isBlank(task.getChargeTwoId())){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// if(1 == task.getFinalChargeStatus()){
|
|
|
+// task.setFinalChargeStatusText("审核通过");
|
|
|
+// task.setFileChargeStatus(1);
|
|
|
+// } else if (0 == task.getFinalChargeStatus()) {
|
|
|
+// String name = "";
|
|
|
+// String statusText = "";
|
|
|
+// String userWxId = "";
|
|
|
+// String fileChargeStatusText = "";
|
|
|
+// int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
|
|
|
+// String tmpUserId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
|
|
|
+// User chargeUser = userIdMap.get(tmpUserId);
|
|
|
+// if(null != chargeUser){
|
|
|
+// if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+// userWxId = chargeUser.getCorpwxRealUserid();
|
|
|
+// }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
+// userWxId = chargeUser.getDingdingUserid();
|
|
|
+// }
|
|
|
+// name = chargeUser.getName();
|
|
|
+// }
|
|
|
+// switch (finalStatus)
|
|
|
+// {
|
|
|
+// case 0: statusText = "待审核"; task.setFileChargeStatus(0);break;
|
|
|
+// case 1: statusText = "通过";break;
|
|
|
+// case 2: statusText = "驳回"; task.setFileChargeStatus(2);break;
|
|
|
+// }
|
|
|
+// if(org.apache.commons.lang3.StringUtils.isBlank(userWxId)){
|
|
|
+// fileChargeStatusText = statusText+"("+name+")";
|
|
|
+// }else{
|
|
|
+// fileChargeStatusText = statusText+"("+("$userName=" + userWxId + "$")+")";
|
|
|
+// }
|
|
|
+// task.setFinalChargeStatusText(fileChargeStatusText);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
list.forEach(l->{
|
|
|
List<TaskExecutor> executorList = taskExecutorList.stream().filter(tl -> tl.getTaskId().equals(l.getId())&&tl.getExecutorId()!=null).collect(Collectors.toList());
|
|
|
l.setExecutorList(executorList);
|