Jelajahi Sumber

请假添加文件上传,添加文件下拉选择审核人

zhouyy 4 bulan lalu
induk
melakukan
2ba4159382

+ 27 - 10
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java

@@ -876,17 +876,34 @@ public class TaskController {
             String name = userMapper.selectById(list.get(0).getCreatorId()).getName();
             list.get(0).setCreatorName(name);
         }
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
         //查询任务的执行人
-        List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", t.getId()));
-        executorList.forEach(e->{
-            if(e.getServiceId()!=null){
-                Optional<SapProjectService> first = serviceList.stream().filter(s -> s.getId().equals(e.getServiceId())).findFirst();
-                if(first.isPresent()){
-                    e.setServiceName(first.get().getServiceName());
-                    e.setServiceCode(first.get().getServiceCode());
+//        List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", t.getId()));
+        List<TaskExecutor> executorList =taskExecutorMapper.getInfoWithFileCharge(t.getId());
+        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+            executorList.forEach(e->{
+                e.setFileChargeOneName("$userName="+e.getChargeOneWxId()+"$");
+                e.setFileChargeTwoName("$userName="+e.getChargeTwoWxId()+"$");
+                if(e.getServiceId()!=null){
+                    Optional<SapProjectService> first = serviceList.stream().filter(s -> s.getId().equals(e.getServiceId())).findFirst();
+                    if(first.isPresent()){
+                        e.setServiceName(first.get().getServiceName());
+                        e.setServiceCode(first.get().getServiceCode());
+                    }
                 }
-            }
-        });
+            });
+        }else{
+            executorList.forEach(e->{
+                if(e.getServiceId()!=null){
+                    Optional<SapProjectService> first = serviceList.stream().filter(s -> s.getId().equals(e.getServiceId())).findFirst();
+                    if(first.isPresent()){
+                        e.setServiceName(first.get().getServiceName());
+                        e.setServiceCode(first.get().getServiceCode());
+                    }
+                }
+            });
+        }
+
         t.setExecutorList(executorList);
         //设置人员选择下拉列表
         List<User> userList = null;
@@ -1373,7 +1390,7 @@ public class TaskController {
         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()){
+        if(0 != timeType.getTaskFileCharge()){
             //根据该任务下的文件所处的状态判断
             for (Task task : list) {
                 /**

+ 72 - 12
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskFilesController.java

@@ -84,6 +84,8 @@ public class TaskFilesController {
 
     @Resource
     private TaskFilesService taskFilesService;
+    @Autowired
+    private TaskExecutorMapper taskExecutorMapper;
 
     @PostMapping("/reUploadFile")
     public HttpRespMsg reUploadFile(@RequestParam Integer projectId,
@@ -102,14 +104,6 @@ public class TaskFilesController {
             msg.setError("您非文件上传人,无法重新上传");
             return msg;
         }
-        if (oldTaskFile.getDocumentId() == null) {
-            //仅当前任务上传的,需要把文件删掉
-            File dir = new File(uploadPath);
-            File targetFile = new File(dir, oldTaskFile.getServerName());
-            if (targetFile.exists()) {
-                targetFile.delete();
-            }
-        }
 
 //        StringBuilder fileNames = new StringBuilder();
         TaskFiles record = new TaskFiles();
@@ -119,8 +113,11 @@ public class TaskFilesController {
         record.setDocumentName(file.getOriginalFilename());
         record.setTaskId(taskId);
         record.setProjectId(projectId);
-        if(1 == timeType.getTaskFileCharge()){
+        record.setFileRejectReason(null);
+        if(0 != timeType.getTaskFileCharge()){
             record.setNeedFileCharge(1);
+        }
+        if(1 == timeType.getTaskFileCharge()){
             if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
                 msg.setError("员工所在部门无负责人,请重新设置");
                 return msg;
@@ -142,7 +139,40 @@ public class TaskFilesController {
                 record.setChargeOneStatus(0);
                 record.setChargeTwoStatus(0);
             }
+        } else if (2 == timeType.getTaskFileCharge()) {
+            record.setFinalChargeStatus(0);
+            if(1 == oldTaskFile.getChargeStage()){
+                record.setChargeOneStatus(0);
+            }else if(2 == oldTaskFile.getChargeStage()){
+                record.setChargeTwoStatus(0);
+            } else if (3 == oldTaskFile.getChargeStage()) {
+                record.setChargeStage(1);
+                record.setChargeOneStatus(0);
+                record.setChargeTwoStatus(0);
+            }
+            //重新上传文件根据文件上传人的该任务执行的审核人一、二
+            TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
+                    .eq(TaskExecutor::getTaskId, taskId)
+                    .eq(TaskExecutor::getExecutorId, user.getId())
+            );
+            if(null == taskExecutor){
+                msg.setError("该任务下执行人无当前用户");
+                return msg;
+            }else{
+                record.setChargeOneId(taskExecutor.getFileChargeOneId());
+                record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+            }
+        }
+
+        if (oldTaskFile.getDocumentId() == null) {
+            //仅当前任务上传的,需要把文件删掉
+            File dir = new File(uploadPath);
+            File targetFile = new File(dir, oldTaskFile.getServerName());
+            if (targetFile.exists()) {
+                targetFile.delete();
+            }
         }
+
         if (file != null && !file.isEmpty()) {
             //截取文件后缀
             String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
@@ -264,8 +294,10 @@ public class TaskFilesController {
         record.setServerName(document.getServerName());
         record.setUrl(document.getUrl());
         TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
-        if(1 == timeType.getTaskFileCharge()){
+        if(0 != timeType.getTaskFileCharge()){
             record.setNeedFileCharge(1);
+        }
+        if(1 == timeType.getTaskFileCharge()){
             Department department = departmentMapper.selectById(user.getDepartmentId());
             Project project = projectMapper.selectById(taskId);
             if(org.apache.commons.lang3.StringUtils.isBlank(department.getManagerId())){
@@ -278,6 +310,19 @@ public class TaskFilesController {
             }
             record.setChargeOneId(department.getManagerId());
             record.setChargeTwoId(project.getInchargerId());
+        } else if (2 == timeType.getTaskFileCharge()) {
+            //重新上传文件根据文件上传人的该任务执行的审核人一、二
+            TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
+                    .eq(TaskExecutor::getTaskId, taskId)
+                    .eq(TaskExecutor::getExecutorId, user.getId())
+            );
+            if(null == taskExecutor){
+                msg.setError("该任务下执行人无当前用户");
+                return msg;
+            }else{
+                record.setChargeOneId(taskExecutor.getFileChargeOneId());
+                record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+            }
         }
         taskFilesMapper.insert(record);
 
@@ -340,8 +385,10 @@ public class TaskFilesController {
             fileNames.append(file.getOriginalFilename()).append(",");
             record.setTaskId(taskId);
             record.setProjectId(projectId);
-            if(1 == timeType.getTaskFileCharge()){
+            if(0 != timeType.getTaskFileCharge()){
                 record.setNeedFileCharge(1);
+            }
+            if(1 == timeType.getTaskFileCharge()){
                 if (department == null) {
                     msg.setError("您无所属部门,请重新设置");
                     return msg;
@@ -356,6 +403,19 @@ public class TaskFilesController {
                 }
                 record.setChargeOneId(department.getManagerId());
                 record.setChargeTwoId(project.getInchargerId());
+            }else if(2 == timeType.getTaskFileCharge()) {
+                //重新上传文件根据文件上传人的该任务执行的审核人一、二
+                TaskExecutor taskExecutor = taskExecutorMapper.selectOne(new LambdaQueryWrapper<TaskExecutor>()
+                        .eq(TaskExecutor::getTaskId, taskId)
+                        .eq(TaskExecutor::getExecutorId, user.getId())
+                );
+                if(null == taskExecutor){
+                    msg.setError("该任务下执行人无当前用户");
+                    return msg;
+                }else{
+                    record.setChargeOneId(taskExecutor.getFileChargeOneId());
+                    record.setChargeTwoId(taskExecutor.getFileChargeTwoId());
+                }
             }
             if (file != null && !file.isEmpty()) {
                 //截取文件后缀
@@ -560,7 +620,7 @@ public class TaskFilesController {
             for (TaskFiles taskFiles : list) {
                 String fileChargeStatusText = "";
                 int fileChargeStatus = 0;
-                if(1 == timeType.getTaskFileCharge()){
+                if(0 != timeType.getTaskFileCharge()){
                     if(0 == taskFiles.getNeedFileCharge()){
                         fileChargeStatusText = "无审核状态";
                         fileChargeStatus = 3;

+ 10 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/LeaveSheet.java

@@ -1,19 +1,20 @@
 package com.management.platform.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
-import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+
 /**
  * <p>
  * 
@@ -161,6 +162,9 @@ public class LeaveSheet extends Model<LeaveSheet> {
     @TableField(exist = false)
     private String dept;
 
+    @TableField(exist = false)
+    private List<LeaveSheetFiles> leaveSheetFiles;
+
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 24 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TaskExecutor.java

@@ -1,17 +1,17 @@
 package com.management.platform.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * <p>
  * 
@@ -79,6 +79,24 @@ public class TaskExecutor extends Model<TaskExecutor> {
     @TableField(exist = false)
     private String serviceCode;
 
+    /**文件审核人一[自选]id*/
+    @TableField("file_charge_one_id")
+    private String fileChargeOneId;
+
+    @TableField(exist = false)
+    private String fileChargeOneName;
+
+    @TableField(exist = false)
+    private String chargeOneWxId;
+    /**文件审核人二[自选]id*/
+    @TableField("file_charge_two_id")
+    private String fileChargeTwoId;
+
+    @TableField(exist = false)
+    private String fileChargeTwoName;
+
+    @TableField(exist = false)
+    private String chargeTwoWxId;
 
     @Override
     protected Serializable pkVal() {

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -621,7 +621,7 @@ public class TimeType extends Model<TimeType> {
     private Integer forceRejectReason;
 
     /**
-     * 任务文件审核 0不启用 1启用
+     * 任务文件审核 0不启用 1启用且自动填充 2启用且下拉选择
      */
     @TableField("task_file_charge")
     private Integer taskFileCharge;

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/TaskExecutorMapper.java

@@ -2,6 +2,9 @@ package com.management.platform.mapper;
 
 import com.management.platform.entity.TaskExecutor;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface TaskExecutorMapper extends BaseMapper<TaskExecutor> {
 
+    List<TaskExecutor> getInfoWithFileCharge(@Param("taskId") Integer taskId);
 }

+ 74 - 62
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/LeaveSheetServiceImpl.java

@@ -15,9 +15,7 @@ import com.management.platform.exception.FileCheckException;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
 import com.management.platform.task.SFTPAsyncUploader;
-import com.management.platform.util.HttpRespMsg;
-import com.management.platform.util.MessageUtils;
-import com.management.platform.util.WorkDayCalculateUtils;
+import com.management.platform.util.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -28,6 +26,8 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -105,16 +105,16 @@ public class LeaveSheetServiceImpl extends ServiceImpl<LeaveSheetMapper, LeaveSh
     @Override
     public HttpRespMsg add(LeaveSheet sheet, String userId, MultipartFile[] files) {
         HttpRespMsg msg = new HttpRespMsg();
-//        if(null != files && files.length > 0){
-//            try {
-//                for (MultipartFile file : files) {
-//                    checkFile(file);
-//                }
-//            } catch (FileCheckException e) {
-//                msg.setError(e.getMessage());
-//                return msg;
-//            }
-//        }
+        if(null != files && files.length > 0){
+            try {
+                for (MultipartFile file : files) {
+                    checkFile(file);
+                }
+            } catch (FileCheckException e) {
+                msg.setError(e.getMessage());
+                return msg;
+            }
+        }
         boolean isNew = false;
         if (sheet.getId() == null) {
             isNew = true;
@@ -186,55 +186,55 @@ public class LeaveSheetServiceImpl extends ServiceImpl<LeaveSheetMapper, LeaveSh
         if (wxCorpInfo != null) {
             sendAuditNotifyMsg(wxCorpInfo, user, sheet);
         }
-//        if(null != files && files.length > 0){
-//            for (MultipartFile file : files) {
-//                LeaveSheetFiles leaveSheetFiles = new LeaveSheetFiles();
-//                leaveSheetFiles.setDocumentName(file.getOriginalFilename());
-//                leaveSheetFiles.setLeaveSheetId(sheet.getId());
-//                leaveSheetFiles.setCreatorId(userId);
-//                leaveSheetFiles.setCreatorName(user.getName());
-//                String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
-//                leaveSheetFiles.setDocumentType(DocumentTypeUtil.DocumentType(fileSuffix));
-//                //处理文件
-//                File dir = new File(path);
-//                if (!dir.exists()) {
-//                    dir.mkdir();
-//                }
-//                String fileName = "";
-//                if (file != null && !file.isEmpty()) {
-//                    fileName = file.getOriginalFilename();
-//
-//                    int pos = fileName.lastIndexOf(".");
-//                    String suffix = fileName.substring(pos).toLowerCase();
-//                    //用uuid替换原始的文件名
-//                    String purFName = UUID.randomUUID().toString().replaceAll("-", "");
-//                    fileName = purFName + suffix;
-//                    File saveFile = new File(dir, fileName);
-//                    try {
-//                        saveFile.createNewFile();
-//                        file.transferTo(saveFile);
-//                        //异步上传到备份服务器
-//                        sftpAsyncUploader.uploadFileAsync(saveFile);
-//                        //计算文件大小
-//                        long fileSize = saveFile.length();
-//                        String fileLength = FileUtil.getReadableFileSize(fileSize);
-//                        leaveSheetFiles.setServerName(path + fileName);
-//                        leaveSheetFiles.setSize(fileLength);
-//                        String pathPrefix = "/upload/";
-//                        leaveSheetFiles.setUrl(pathPrefix + fileName);
-//                        leaveSheetFilesMapper.insert(leaveSheetFiles);
-//                    } catch (IOException e) {
-//                        e.printStackTrace();
-//                        fileName = null;
-//                        msg.setError(e.getMessage() + ", path=" + dir.getAbsolutePath());
-//                    } catch (Exception e) {
-//                        e.printStackTrace();
-//                        fileName = null;
-//                        msg.setError(e.getMessage() + ", path=" + dir.getAbsolutePath());
-//                    }
-//                }
-//            }
-//        }
+        if(null != files && files.length > 0){
+            for (MultipartFile file : files) {
+                LeaveSheetFiles leaveSheetFiles = new LeaveSheetFiles();
+                leaveSheetFiles.setDocumentName(file.getOriginalFilename());
+                leaveSheetFiles.setLeaveSheetId(sheet.getId());
+                leaveSheetFiles.setCreatorId(userId);
+                leaveSheetFiles.setCreatorName(user.getName());
+                String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
+                leaveSheetFiles.setDocumentType(DocumentTypeUtil.DocumentType(fileSuffix));
+                //处理文件
+                File dir = new File(path);
+                if (!dir.exists()) {
+                    dir.mkdir();
+                }
+                String fileName = "";
+                if (file != null && !file.isEmpty()) {
+                    fileName = file.getOriginalFilename();
+
+                    int pos = fileName.lastIndexOf(".");
+                    String suffix = fileName.substring(pos).toLowerCase();
+                    //用uuid替换原始的文件名
+                    String purFName = UUID.randomUUID().toString().replaceAll("-", "");
+                    fileName = purFName + suffix;
+                    File saveFile = new File(dir, fileName);
+                    try {
+                        saveFile.createNewFile();
+                        file.transferTo(saveFile);
+                        //异步上传到备份服务器
+                        sftpAsyncUploader.uploadFileAsync(saveFile);
+                        //计算文件大小
+                        long fileSize = saveFile.length();
+                        String fileLength = FileUtil.getReadableFileSize(fileSize);
+                        leaveSheetFiles.setServerName(path + fileName);
+                        leaveSheetFiles.setSize(fileLength);
+                        String pathPrefix = "/upload/";
+                        leaveSheetFiles.setUrl(pathPrefix + fileName);
+                        leaveSheetFilesMapper.insert(leaveSheetFiles);
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                        fileName = null;
+                        msg.setError(e.getMessage() + ", path=" + dir.getAbsolutePath());
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        fileName = null;
+                        msg.setError(e.getMessage() + ", path=" + dir.getAbsolutePath());
+                    }
+                }
+            }
+        }
 
         return msg;
     }
@@ -411,6 +411,18 @@ public class LeaveSheetServiceImpl extends ServiceImpl<LeaveSheetMapper, LeaveSh
                 }
             });
         }
+        if(!CollectionUtils.isEmpty(records)){
+            List<Integer> leavesheetIds = records.stream().map(LeaveSheet::getId).collect(Collectors.toList());
+            List<LeaveSheetFiles> leaveSheetFiles = leaveSheetFilesMapper.selectList(new LambdaQueryWrapper<LeaveSheetFiles>()
+                            .select(LeaveSheetFiles::getDocumentName,LeaveSheetFiles::getServerName,LeaveSheetFiles::getUrl)
+                    .in(LeaveSheetFiles::getLeaveSheetId, leavesheetIds)
+            );
+            Map<Integer, List<LeaveSheetFiles>> collect = leaveSheetFiles.stream().collect(Collectors.groupingBy(LeaveSheetFiles::getLeaveSheetId));
+            for (LeaveSheet record : records) {
+                List<LeaveSheetFiles> tmpList = collect.get(record.getId());
+                record.setLeaveSheetFiles(tmpList);
+            }
+        }
 
         Long total = listIPager.getTotal();
 

+ 94 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskFilesServiceImpl.java

@@ -66,11 +66,27 @@ public class TaskFilesServiceImpl extends ServiceImpl<TaskFilesMapper, TaskFiles
                             .eq(TaskFiles::getFinalChargeStatus,0)
                             .eq(TaskFiles::getNeedFileCharge,1)
                     .in(TaskFiles::getId,ids));
+            List<TaskFiles> multiChargeList = taskFilesList.stream().filter(t -> {
+                if (t.getChargeOneId().equals(t.getChargeTwoId())) {
+                    return false;
+                } else {
+                    return true;
+                }
+            }).collect(Collectors.toList());
+            List<TaskFiles> singleChargeList = taskFilesList.stream().filter(t -> {
+                if (t.getChargeOneId().equals(t.getChargeTwoId())) {
+                    return true;
+                } else {
+                    return false;
+                }
+            }).collect(Collectors.toList());
+
             //通过
             List<Integer> stageOneToUpdateList = new ArrayList<>();
             List<Integer> stageTwoToUpdateList = new ArrayList<>();
+            //审核人一、二如果是同一个,则通过直接结束,驳回返回阶段一
             List<TaskComment> commentList = new ArrayList<>();
-            for (TaskFiles taskFiles : taskFilesList) {
+            for (TaskFiles taskFiles : multiChargeList) {
                 //判断所处阶段
                 if(1 == taskFiles.getChargeStage()){
                     stageOneToUpdateList.add(taskFiles.getId());
@@ -87,6 +103,17 @@ public class TaskFilesServiceImpl extends ServiceImpl<TaskFilesMapper, TaskFiles
                 comment.setUserName(user.getName());
                 commentList.add(comment);
             }
+            for (TaskFiles taskFiles : singleChargeList) {
+                String content = user.getName()+"审核通过了任务文件【"+taskFiles.getDocumentName()+"】";
+                TaskComment comment =  new TaskComment();
+                comment.setTaskId(taskFiles.getTaskId());
+                comment.setUserId(user.getId());
+                comment.setContent(content);
+                comment.setCreateTime(LocalDateTime.now());
+                comment.setUserColor(user.getColor());
+                comment.setUserName(user.getName());
+                commentList.add(comment);
+            }
             if(CollectionUtils.isNotEmpty(stageOneToUpdateList)){
                 taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
                         .set(TaskFiles::getChargeStage,2)
@@ -106,6 +133,19 @@ public class TaskFilesServiceImpl extends ServiceImpl<TaskFilesMapper, TaskFiles
                         .in(TaskFiles::getId,stageTwoToUpdateList)
                 );
             }
+            if(CollectionUtils.isNotEmpty(singleChargeList)){
+                List<Integer> collect = singleChargeList.stream().map(TaskFiles::getId).collect(Collectors.toList());
+                taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
+                        .set(TaskFiles::getChargeStage,3)
+                        .set(TaskFiles::getFinalChargeStatus,1)
+                        .set(TaskFiles::getChargeOneStatus,1)
+                        .set(TaskFiles::getChargeTwoStatus,1)
+                        .set(TaskFiles::getChargeOneTime,new Date())
+                        .set(TaskFiles::getChargeTwoTime,new Date())
+                        .set(TaskFiles::getFileRejectReason,null)
+                        .in(TaskFiles::getId,collect)
+                );
+            }
             if(CollectionUtils.isNotEmpty(commentList)){
                 taskCommentMapper.insertBatch(commentList);
             }
@@ -132,12 +172,26 @@ public class TaskFilesServiceImpl extends ServiceImpl<TaskFilesMapper, TaskFiles
                     .eq(TaskFiles::getFinalChargeStatus,0)
                     .in(TaskFiles::getId,ids)
             );
+            List<TaskFiles> multiChargeList = taskFiles.stream().filter(t -> {
+                if (t.getChargeOneId().equals(t.getChargeTwoId())) {
+                    return false;
+                } else {
+                    return true;
+                }
+            }).collect(Collectors.toList());
+            List<TaskFiles> singleChargeList = taskFiles.stream().filter(t -> {
+                if (t.getChargeOneId().equals(t.getChargeTwoId())) {
+                    return true;
+                } else {
+                    return false;
+                }
+            }).collect(Collectors.toList());
             List<Integer> stageOneToUpdateList = new ArrayList<>();
             List<Integer> stageTwoToUpdateList = new ArrayList<>();
 //            StringBuilder userNames = new StringBuilder();
             Map<String,String> remindMap = new HashMap<>();
             List<TaskComment> commentList = new ArrayList<>();
-            for (TaskFiles taskFile : taskFiles) {
+            for (TaskFiles taskFile : multiChargeList) {
                 if(1 == taskFile.getChargeStage()){
                     //阶段一,更新阶段一状态
                     stageOneToUpdateList.add(taskFile.getId());
@@ -152,6 +206,13 @@ public class TaskFilesServiceImpl extends ServiceImpl<TaskFilesMapper, TaskFiles
 //                }else{
 //                    userNames.append(tmpUser.getName()).append(",");
 //                }
+                if(remindMap.containsKey(tmpUser.getCorpwxUserid())){
+                    String s = remindMap.get(tmpUser.getCorpwxUserid());
+                    s += "任务文件【"+taskFile.getDocumentName()+"】因【"+reason+"】被驳回,请及时处理";
+                    remindMap.put(tmpUser.getCorpwxUserid(),s);
+                }else{
+                    remindMap.put(tmpUser.getCorpwxUserid(),"任务文件【"+taskFile.getDocumentName()+"】因【"+reason+"】被驳回,请及时处理");
+                }
                 remindMap.put(tmpUser.getCorpwxUserid(),"任务文件【"+taskFile.getDocumentName()+"】因【"+reason+"】被驳回,请及时处理");
                 String content = user.getName()+"审核驳回了任务文件【"+taskFile.getDocumentName()+"】";
                 TaskComment comment =  new TaskComment();
@@ -163,6 +224,26 @@ public class TaskFilesServiceImpl extends ServiceImpl<TaskFilesMapper, TaskFiles
                 comment.setUserName(user.getName());
                 commentList.add(comment);
             }
+            for (TaskFiles taskFile : singleChargeList) {
+                User tmpUser = companyUserMap.get(taskFile.getCreatorId());
+                if(remindMap.containsKey(tmpUser.getCorpwxUserid())){
+                    String s = remindMap.get(tmpUser.getCorpwxUserid());
+                    s += "任务文件【"+taskFile.getDocumentName()+"】因【"+reason+"】被驳回,请及时处理";
+                    remindMap.put(tmpUser.getCorpwxUserid(),s);
+                }else{
+                    remindMap.put(tmpUser.getCorpwxUserid(),"任务文件【"+taskFile.getDocumentName()+"】因【"+reason+"】被驳回,请及时处理");
+                }
+
+                String content = user.getName()+"审核驳回了任务文件【"+taskFile.getDocumentName()+"】";
+                TaskComment comment =  new TaskComment();
+                comment.setTaskId(taskFile.getTaskId());
+                comment.setUserId(user.getId());
+                comment.setContent(content);
+                comment.setCreateTime(LocalDateTime.now());
+                comment.setUserColor(user.getColor());
+                comment.setUserName(user.getName());
+                commentList.add(comment);
+            }
             if(CollectionUtils.isNotEmpty(stageOneToUpdateList)){
                 //阶段一,更新阶段一状态
                 taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
@@ -180,6 +261,17 @@ public class TaskFilesServiceImpl extends ServiceImpl<TaskFilesMapper, TaskFiles
                         .in(TaskFiles::getId,stageTwoToUpdateList)
                 );
             }
+            if(CollectionUtils.isNotEmpty(singleChargeList)){
+                List<Integer> collect = singleChargeList.stream().map(TaskFiles::getId).collect(Collectors.toList());
+                taskFilesMapper.update(null,new LambdaUpdateWrapper<TaskFiles>()
+                        .set(TaskFiles::getFileRejectReason,reason)
+                        .set(TaskFiles::getChargeOneTime,new Date())
+                        .set(TaskFiles::getChargeTwoTime,new Date())
+                        .set(TaskFiles::getChargeOneStatus,2)
+                        .set(TaskFiles::getChargeStage,1)
+                        .in(TaskFiles::getId,collect)
+                );
+            }
 
             if(CollectionUtils.isNotEmpty(commentList)){
                 taskCommentMapper.insertBatch(commentList);

+ 11 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskExecutorMapper.xml

@@ -17,7 +17,17 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, task_id, executor_id, executor_name, executor_color, plan_hours, project_id, service_id, real_cost
+        id, task_id, executor_id, executor_name, executor_color, plan_hours, project_id, service_id, real_cost, file_charge_one_id, file_charge_two_id
     </sql>
+    <select id="getInfoWithFileCharge" resultType="com.management.platform.entity.TaskExecutor">
+        select task_id, executor_id, executor_name, executor_color, plan_hours, project_id
+             , service_id, real_cost, file_charge_one_id, file_charge_two_id
+             , u1.name as fileChargeOneName,u1.corpwx_userid as chargeOneWxId
+             ,u2.name as fileChargeTwoName,u2.corpwx_userid  as chargeTwoWxId
+        from task_executor te
+                 left join man_dev.user u1 on te.file_charge_one_id = u1.id
+                 left join man_dev.user u2 on te.file_charge_two_id = u2.id
+        where task_id = #{taskId}
+    </select>
 
 </mapper>