|
@@ -5,19 +5,17 @@ import com.aliyun.dingtalkcontact_1_0.models.SearchUserResponse;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.github.pagehelper.util.StringUtil;
|
|
import com.github.pagehelper.util.StringUtil;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.bo.QueryTaskChargePage;
|
|
import com.management.platform.entity.bo.QueryTaskChargePage;
|
|
-import com.management.platform.entity.vo.TaskChargePageVO;
|
|
|
|
|
|
+import com.management.platform.entity.vo.TaskFileChargePageVO;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.service.*;
|
|
import com.management.platform.service.*;
|
|
import com.management.platform.util.ExcelUtil;
|
|
import com.management.platform.util.ExcelUtil;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.MessageUtils;
|
|
import com.management.platform.util.MessageUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
@@ -36,7 +34,6 @@ import java.io.*;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
-import java.time.LocalDateTime;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -781,95 +778,95 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- @Transactional
|
|
|
|
- public HttpRespMsg auditFile(Integer taskId, String projectId, Integer auditStatus, String reason, HttpServletRequest request) {
|
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
- User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
|
- //获取该任务的文件审核阶段
|
|
|
|
- Task task = taskMapper.selectById(taskId);
|
|
|
|
- if(1 == auditStatus){
|
|
|
|
- //通过
|
|
|
|
- if(1 == task.getChargeStage()){
|
|
|
|
- //阶段一,更新阶段一状态
|
|
|
|
- taskMapper.update(null,new LambdaUpdateWrapper<Task>()
|
|
|
|
- .set(Task::getChargeStage,2)
|
|
|
|
- .set(Task::getChargeOneStatus,1)
|
|
|
|
- .set(Task::getChargeOneTime,new Date())
|
|
|
|
- .eq(Task::getId,taskId)
|
|
|
|
- );
|
|
|
|
- } else if (2 == task.getChargeStage()) {
|
|
|
|
- taskMapper.update(null,new LambdaUpdateWrapper<Task>()
|
|
|
|
- .set(Task::getChargeStage,3)
|
|
|
|
- .set(Task::getFinalChargeStatus,1)
|
|
|
|
- .set(Task::getChargeTwoStatus,1)
|
|
|
|
- .set(Task::getChargeTwoTime,new Date())
|
|
|
|
- .eq(Task::getId,taskId)
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- //添加动态消息
|
|
|
|
- String content = user.getName()+"审核通过了任务:"+task.getName();
|
|
|
|
- TaskComment comment = new TaskComment();
|
|
|
|
- comment.setTaskId(taskId);
|
|
|
|
- comment.setUserId(user.getId());
|
|
|
|
- comment.setContent(content);
|
|
|
|
- comment.setCreateTime(LocalDateTime.now());
|
|
|
|
- comment.setUserColor(user.getColor());
|
|
|
|
- comment.setUserName(user.getName());
|
|
|
|
- taskCommentMapper.insert(comment);
|
|
|
|
-
|
|
|
|
- } else if (2 == auditStatus) {
|
|
|
|
- //驳回
|
|
|
|
- WxCorpInfo info = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
- if(1 == task.getChargeStage()){
|
|
|
|
- //阶段一,更新阶段一状态
|
|
|
|
- taskMapper.update(null,new LambdaUpdateWrapper<Task>()
|
|
|
|
- .set(Task::getFileRejectReason,reason)
|
|
|
|
- .set(Task::getChargeOneTime,new Date())
|
|
|
|
- .set(Task::getChargeOneStatus,2)
|
|
|
|
- .eq(Task::getId,taskId)
|
|
|
|
- );
|
|
|
|
- } else if (2 == task.getChargeStage()) {
|
|
|
|
- taskMapper.update(null,new LambdaUpdateWrapper<Task>()
|
|
|
|
- .set(Task::getFileRejectReason,reason)
|
|
|
|
- .set(Task::getChargeTwoTime,new Date())
|
|
|
|
- .set(Task::getChargeTwoStatus,2)
|
|
|
|
- .eq(Task::getId,taskId)
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- List<TaskFiles> taskFiles = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
|
|
|
|
- .eq(TaskFiles::getTaskId, task.getId())
|
|
|
|
- );
|
|
|
|
- List<String> creatorIds = taskFiles.stream().filter(t -> StringUtils.isNotBlank(t.getCreatorId()))
|
|
|
|
- .map(TaskFiles::getCreatorId).collect(Collectors.toList());
|
|
|
|
- if(CollectionUtils.isNotEmpty(creatorIds)){
|
|
|
|
- List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
|
|
|
|
- .eq(User::getIsActive, 1)
|
|
|
|
- .in(User::getId, creatorIds)
|
|
|
|
- );
|
|
|
|
- if(CollectionUtils.isNotEmpty(users)){
|
|
|
|
- List<String> wxCorpIds = users.stream().filter(t -> StringUtils.isNotBlank(t.getCorpwxUserid()))
|
|
|
|
- .map(User::getCorpwxUserid).collect(Collectors.toList());
|
|
|
|
- if(CollectionUtils.isNotEmpty(wxCorpIds)){
|
|
|
|
- String join = StringUtils.join(wxCorpIds, ",");
|
|
|
|
- wxCorpInfoService.sendWXCorpMsg(info,join,"任务:"+task.getName()+"的文件因【"+reason+"】被驳回,请及时处理",null
|
|
|
|
- , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_REJECT);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- String content = user.getName()+"审核驳回了任务:"+task.getName();
|
|
|
|
- TaskComment comment = new TaskComment();
|
|
|
|
- comment.setTaskId(taskId);
|
|
|
|
- comment.setUserId(user.getId());
|
|
|
|
- comment.setContent(content);
|
|
|
|
- comment.setCreateTime(LocalDateTime.now());
|
|
|
|
- comment.setUserColor(user.getColor());
|
|
|
|
- comment.setUserName(user.getName());
|
|
|
|
- taskCommentMapper.insert(comment);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return msg;
|
|
|
|
- }
|
|
|
|
|
|
+// @Override
|
|
|
|
+// @Transactional
|
|
|
|
+// public HttpRespMsg auditFile(Integer taskId, String projectId, Integer auditStatus, String reason, HttpServletRequest request) {
|
|
|
|
+// HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+// User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
|
+// //获取该任务的文件审核阶段
|
|
|
|
+// Task task = taskMapper.selectById(taskId);
|
|
|
|
+// if(1 == auditStatus){
|
|
|
|
+// //通过
|
|
|
|
+// if(1 == task.getChargeStage()){
|
|
|
|
+// //阶段一,更新阶段一状态
|
|
|
|
+// taskMapper.update(null,new LambdaUpdateWrapper<Task>()
|
|
|
|
+// .set(Task::getChargeStage,2)
|
|
|
|
+// .set(Task::getChargeOneStatus,1)
|
|
|
|
+// .set(Task::getChargeOneTime,new Date())
|
|
|
|
+// .eq(Task::getId,taskId)
|
|
|
|
+// );
|
|
|
|
+// } else if (2 == task.getChargeStage()) {
|
|
|
|
+// taskMapper.update(null,new LambdaUpdateWrapper<Task>()
|
|
|
|
+// .set(Task::getChargeStage,3)
|
|
|
|
+// .set(Task::getFinalChargeStatus,1)
|
|
|
|
+// .set(Task::getChargeTwoStatus,1)
|
|
|
|
+// .set(Task::getChargeTwoTime,new Date())
|
|
|
|
+// .eq(Task::getId,taskId)
|
|
|
|
+// );
|
|
|
|
+// }
|
|
|
|
+// //添加动态消息
|
|
|
|
+// String content = user.getName()+"审核通过了任务:"+task.getName();
|
|
|
|
+// TaskComment comment = new TaskComment();
|
|
|
|
+// comment.setTaskId(taskId);
|
|
|
|
+// comment.setUserId(user.getId());
|
|
|
|
+// comment.setContent(content);
|
|
|
|
+// comment.setCreateTime(LocalDateTime.now());
|
|
|
|
+// comment.setUserColor(user.getColor());
|
|
|
|
+// comment.setUserName(user.getName());
|
|
|
|
+// taskCommentMapper.insert(comment);
|
|
|
|
+//
|
|
|
|
+// } else if (2 == auditStatus) {
|
|
|
|
+// //驳回
|
|
|
|
+// WxCorpInfo info = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
+// if(1 == task.getChargeStage()){
|
|
|
|
+// //阶段一,更新阶段一状态
|
|
|
|
+// taskMapper.update(null,new LambdaUpdateWrapper<Task>()
|
|
|
|
+// .set(Task::getFileRejectReason,reason)
|
|
|
|
+// .set(Task::getChargeOneTime,new Date())
|
|
|
|
+// .set(Task::getChargeOneStatus,2)
|
|
|
|
+// .eq(Task::getId,taskId)
|
|
|
|
+// );
|
|
|
|
+// } else if (2 == task.getChargeStage()) {
|
|
|
|
+// taskMapper.update(null,new LambdaUpdateWrapper<Task>()
|
|
|
|
+// .set(Task::getFileRejectReason,reason)
|
|
|
|
+// .set(Task::getChargeTwoTime,new Date())
|
|
|
|
+// .set(Task::getChargeTwoStatus,2)
|
|
|
|
+// .eq(Task::getId,taskId)
|
|
|
|
+// );
|
|
|
|
+// }
|
|
|
|
+// List<TaskFiles> taskFiles = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
|
|
|
|
+// .eq(TaskFiles::getTaskId, task.getId())
|
|
|
|
+// );
|
|
|
|
+// List<String> creatorIds = taskFiles.stream().filter(t -> StringUtils.isNotBlank(t.getCreatorId()))
|
|
|
|
+// .map(TaskFiles::getCreatorId).collect(Collectors.toList());
|
|
|
|
+// if(CollectionUtils.isNotEmpty(creatorIds)){
|
|
|
|
+// List<User> users = userMapper.selectList(new LambdaQueryWrapper<User>()
|
|
|
|
+// .eq(User::getIsActive, 1)
|
|
|
|
+// .in(User::getId, creatorIds)
|
|
|
|
+// );
|
|
|
|
+// if(CollectionUtils.isNotEmpty(users)){
|
|
|
|
+// List<String> wxCorpIds = users.stream().filter(t -> StringUtils.isNotBlank(t.getCorpwxUserid()))
|
|
|
|
+// .map(User::getCorpwxUserid).collect(Collectors.toList());
|
|
|
|
+// if(CollectionUtils.isNotEmpty(wxCorpIds)){
|
|
|
|
+// String join = StringUtils.join(wxCorpIds, ",");
|
|
|
|
+// wxCorpInfoService.sendWXCorpMsg(info,join,"任务:"+task.getName()+"的文件因【"+reason+"】被驳回,请及时处理",null
|
|
|
|
+// , WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_REJECT);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// String content = user.getName()+"审核驳回了任务:"+task.getName();
|
|
|
|
+// TaskComment comment = new TaskComment();
|
|
|
|
+// comment.setTaskId(taskId);
|
|
|
|
+// comment.setUserId(user.getId());
|
|
|
|
+// comment.setContent(content);
|
|
|
|
+// comment.setCreateTime(LocalDateTime.now());
|
|
|
|
+// comment.setUserColor(user.getColor());
|
|
|
|
+// comment.setUserName(user.getName());
|
|
|
|
+// taskCommentMapper.insert(comment);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// return msg;
|
|
|
|
+// }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg getFileRejectReason(String taskId, HttpServletRequest request) {
|
|
public HttpRespMsg getFileRejectReason(String taskId, HttpServletRequest request) {
|
|
@@ -906,6 +903,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
User user = userMapper.selectById(userId);
|
|
User user = userMapper.selectById(userId);
|
|
Integer companyId = user.getCompanyId();
|
|
Integer companyId = user.getCompanyId();
|
|
queryBO.setUserId(userId);
|
|
queryBO.setUserId(userId);
|
|
|
|
+ queryBO.setCompanyId(companyId);
|
|
|
|
|
|
queryBO.setPageIndex((queryBO.getPageIndex()-1)*queryBO.getPageSize());
|
|
queryBO.setPageIndex((queryBO.getPageIndex()-1)*queryBO.getPageSize());
|
|
|
|
|
|
@@ -915,41 +913,66 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
branchDepartment= getBranchDepartment(queryBO.getDeptId(), departmentList);
|
|
branchDepartment= getBranchDepartment(queryBO.getDeptId(), departmentList);
|
|
}
|
|
}
|
|
|
|
|
|
- List<TaskChargePageVO> taskChargePage = taskMapper.getTaskChargePage(queryBO, branchDepartment);
|
|
|
|
- WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
|
|
|
|
- CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
|
|
|
|
- List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id",user.getCompanyId()));
|
|
|
|
- Map<String, User> companyUserMap = users.stream().collect(Collectors.toMap(User::getId, t -> t));
|
|
|
|
|
|
+ //文件处于审核阶段,且该阶段审核人为当前登录人
|
|
|
|
+// List<TaskChargePageVO> taskChargePage = taskMapper.getTaskChargePage(queryBO, branchDepartment);
|
|
|
|
+
|
|
|
|
+ List<TaskFileChargePageVO> taskFileChargePageList = taskMapper.getTaskFileChargePage(queryBO,branchDepartment);
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(taskChargePage)){
|
|
|
|
- List<Integer> collect = taskChargePage.stream()
|
|
|
|
- .map(TaskChargePageVO::getTaskId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+// WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
|
|
|
|
+// CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
|
|
|
|
+// List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id",user.getCompanyId()));
|
|
|
|
+// Map<String, User> companyUserMap = users.stream().collect(Collectors.toMap(User::getId, t -> t));
|
|
|
|
+
|
|
|
|
+ if(CollectionUtils.isNotEmpty(taskFileChargePageList)){
|
|
|
|
+ List<Integer> collect = taskFileChargePageList.stream()
|
|
|
|
+ .map(TaskFileChargePageVO::getTaskId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().in("task_id", collect));
|
|
List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().in("task_id", collect));
|
|
|
|
|
|
- taskChargePage.forEach(t->{
|
|
|
|
|
|
+ taskFileChargePageList.forEach(t->{
|
|
List<TaskExecutor> executorList = taskExecutorList.stream()
|
|
List<TaskExecutor> executorList = taskExecutorList.stream()
|
|
.filter(te -> te.getTaskId().equals(t.getTaskId())&&te.getExecutorId()!=null).collect(Collectors.toList());
|
|
.filter(te -> te.getTaskId().equals(t.getTaskId())&&te.getExecutorId()!=null).collect(Collectors.toList());
|
|
t.setExecutorList(executorList);
|
|
t.setExecutorList(executorList);
|
|
- String userWxId = "";
|
|
|
|
- User tmpUser = companyUserMap.get(t.getFinalChargeId());
|
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
- userWxId = tmpUser.getCorpwxRealUserid();
|
|
|
|
- }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
|
- userWxId = tmpUser.getDingdingUserid();
|
|
|
|
- }
|
|
|
|
- if(StringUtils.isNotBlank(userWxId)){
|
|
|
|
- t.setFinalChargeName("$userName=" + userWxId + "$");
|
|
|
|
- }
|
|
|
|
- int finalStatus = 1==t.getChargeStage()?t.getChargeOneStatus():t.getChargeTwoStatus();
|
|
|
|
- t.setFileChargeStatus(finalStatus);
|
|
|
|
|
|
+// String userWxId = "";
|
|
|
|
+// User tmpUser = companyUserMap.get(t.getFinalChargeId());
|
|
|
|
+// if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+// userWxId = tmpUser.getCorpwxRealUserid();
|
|
|
|
+// }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
|
+// userWxId = tmpUser.getDingdingUserid();
|
|
|
|
+// }
|
|
|
|
+// if(StringUtils.isNotBlank(userWxId)){
|
|
|
|
+// t.setFinalChargeName("$userName=" + userWxId + "$");
|
|
|
|
+// }else{
|
|
|
|
+// t.setFinalChargeName(tmpUser.getName());
|
|
|
|
+// }
|
|
|
|
+// List<TaskFiles> childFiles = t.getChildFiles();
|
|
|
|
+// //是否存在驳回
|
|
|
|
+// long rejectCount = childFiles.stream().filter(tmp -> {
|
|
|
|
+// if (2 == tmp.getChargeOneStatus() || 2 == tmp.getChargeTwoStatus()) {
|
|
|
|
+// return true;
|
|
|
|
+// } else {
|
|
|
|
+// return false;
|
|
|
|
+// }
|
|
|
|
+// }).count();
|
|
|
|
+// //是否都是全部通过
|
|
|
|
+// long allPassCount = childFiles.stream().filter(tmp -> 1 == tmp.getFinalChargeStatus()).count();
|
|
|
|
+// if(rejectCount > 0 ){
|
|
|
|
+// t.setTaskChargeStatus(2);
|
|
|
|
+// } else if (allPassCount == childFiles.size()) {
|
|
|
|
+// t.setTaskChargeStatus(3);
|
|
|
|
+// }else {
|
|
|
|
+// t.setTaskChargeStatus(1);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// int finalStatus = 1==t.getChargeStage()?t.getChargeOneStatus():t.getChargeTwoStatus();
|
|
|
|
+// t.setFileChargeStatus(finalStatus);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- int total = taskMapper.getTaskChargePageTotal(queryBO,branchDepartment);
|
|
|
|
|
|
+// int total = taskMapper.getTaskChargePageTotal(queryBO,branchDepartment);
|
|
|
|
+ int total = taskMapper.getTaskFileChargePageTotal(queryBO,branchDepartment);
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
- map.put("records", taskChargePage);
|
|
|
|
|
|
+ map.put("records", taskFileChargePageList);
|
|
map.put("total", total);
|
|
map.put("total", total);
|
|
msg.data = map;
|
|
msg.data = map;
|
|
return msg;
|
|
return msg;
|