Bladeren bron

修改任务文件相关接口

zhouyy 4 maanden geleden
bovenliggende
commit
aa7a5d6cd4

+ 48 - 21
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskFilesController.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
+import com.management.platform.service.CompanyDingdingService;
 import com.management.platform.service.ProjectDocumentService;
 import com.management.platform.service.WxCorpInfoService;
 import com.management.platform.task.SFTPAsyncUploader;
@@ -13,6 +14,7 @@ import com.management.platform.util.DocumentTypeUtil;
 import com.management.platform.util.FileUtil;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.StringUtils;
@@ -27,7 +29,6 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.IOException;
 import java.time.LocalDateTime;
-import java.util.HashMap;
 import java.util.List;
 import java.util.UUID;
 
@@ -71,6 +72,9 @@ public class TaskFilesController {
     @Resource
     private WxCorpInfoMapper wxCorpInfoMapper;
 
+    @Resource
+    private CompanyDingdingService companyDingdingService;
+
     /**
      * 获取该项目下的所有有效的文件列表
      * @param keyword
@@ -341,35 +345,58 @@ public class TaskFilesController {
     public HttpRespMsg getTaskFiles(Integer taskId,HttpServletRequest request) {
         User user = userMapper.selectById(request.getHeader("Token"));
         Task task = taskMapper.selectById(taskId);
-        HashMap<String,Object> map = new HashMap<>();
         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()));
+        String fileChargeStatusText = "";
+        int fileChargeStatus = 0;
         if(1 == timeType.getTaskFileCharge()){
-            if(1 == task.getFinalChargeStatus()){
-                map.put("fileChargeStatusText","审核通过");
-            } else if (0 == task.getFinalChargeStatus()) {
-                String name = "";
-                String statusText = "";
-                int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
-                String userId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
-                User chargeUser = userMapper.selectById(userId);
-                if(null != chargeUser){
-                    name = chargeUser.getName();
-                }
-                switch (finalStatus)
-                {
-                    case 0:  statusText = "待审核";break;
-                    case 1:  statusText = "通过";break;
-                    case 2:  statusText = "驳回";break;
+            if(org.apache.commons.lang3.StringUtils.isNotBlank(task.getChargeOneId())
+                    &&org.apache.commons.lang3.StringUtils.isNotBlank(task.getChargeTwoId())){
+                if(1 == task.getFinalChargeStatus()){
+                    fileChargeStatusText = "审核通过";
+                    fileChargeStatus = 1;
+                } else if (0 == task.getFinalChargeStatus()) {
+                    String name = "";
+                    String statusText = "";
+                    String userWxId = "";
+                    int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
+                    String userId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
+                    User chargeUser = userMapper.selectById(userId);
+                    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 = "待审核";fileChargeStatus = 0;break;
+                        case 1:  statusText = "通过";break;
+                        case 2:  statusText = "驳回";fileChargeStatus = 2;break;
+                    }
+                    if(org.apache.commons.lang3.StringUtils.isBlank(userWxId)){
+                        fileChargeStatusText = statusText+"("+name+")";
+                    }else{
+                        fileChargeStatusText = statusText+"("+("$userName=" + userWxId + "$")+")";
+                    }
+
                 }
-                map.put("fileChargeStatusText",statusText+"("+name+")");
             }
         }
         List<TaskFiles> list = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
                 .eq(TaskFiles::getTaskId,taskId)
         );
-        map.put("fileList",list);
+        if(CollectionUtils.isNotEmpty(list)){
+            for (TaskFiles taskFiles : list) {
+                taskFiles.setFileChargeStatusText(fileChargeStatusText);
+                taskFiles.setFileChargeStatus(fileChargeStatus);
+            }
+        }
         HttpRespMsg msg = new HttpRespMsg();
-        msg.data = map;
+        msg.data = list;
         return msg;
     }
 

+ 7 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TaskFiles.java

@@ -71,6 +71,13 @@ public class TaskFiles extends Model<TaskFiles> {
     @TableField("document_id")
     private Integer documentId;
 
+    @TableField(exist = false)
+    private String fileChargeStatusText;
+
+    /**0 待审核 1通过 2驳回*/
+    @TableField(exist = false)
+    private Integer fileChargeStatus;
+
 
     @Override
     protected Serializable pkVal() {

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/bo/QueryTaskChargePage.java

@@ -6,7 +6,8 @@ import lombok.Data;
 public class QueryTaskChargePage {
     private Integer deptId;
     private Integer projectId;
-    private Integer taskId;
+//    private Integer taskId;
+    private String taskName;
     private Integer pageIndex = 1;
     private Integer pageSize;
     private String userId;

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/TaskChargePageVO.java

@@ -21,4 +21,6 @@ public class TaskChargePageVO {
     private String finalChargeName;
     private String executorId;
     private List<TaskExecutor> executorList;
+    private int fileChargeStatus;
+    private Integer groupId;
 }

+ 17 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -881,6 +881,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
         }
 
         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));
+
         if(CollectionUtils.isNotEmpty(taskChargePage)){
             List<Integer> collect = taskChargePage.stream()
                     .map(TaskChargePageVO::getTaskId).distinct().collect(Collectors.toList());
@@ -891,6 +896,18 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 List<TaskExecutor> executorList = taskExecutorList.stream()
                         .filter(te -> te.getTaskId().equals(t.getTaskId())&&te.getExecutorId()!=null).collect(Collectors.toList());
                 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);
             });
         }
 

+ 10 - 10
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml

@@ -414,7 +414,7 @@
         from
             (
                 select tf.task_id,tf.creator_id,task.name as taskName,task.charge_stage
-                     ,task.charge_one_id,task.charge_one_status,task.executor_id
+                     ,task.charge_one_id,task.charge_one_status,task.executor_id,task.group_id
                      ,task.charge_two_id,task.charge_two_status,p.id as projectId,p.project_name,
                     case task.charge_stage
                         when 1 then task.charge_one_id
@@ -433,8 +433,8 @@
                     <if test="queryBO.projectId != null">
                         and tf.project_id = #{queryBO.projectId}
                     </if>
-                    <if test="queryBO.taskId != null">
-                        and tf.task_id = #{queryBO.taskId}
+                    <if test="queryBO.taskName != null and queryBO.taskName != ''">
+                        and task.name like concat('%',#{queryBO.taskName},'%')
                     </if>
                     <if test="deptIds!=null and deptIds.size()>0">
                         and p.dept_id in
@@ -452,7 +452,7 @@
         from
             (
                 select tf.task_id,tf.creator_id,task.name as taskName,task.charge_stage
-                     ,task.charge_one_id,task.charge_one_status,task.executor_id
+                     ,task.charge_one_id,task.charge_one_status,task.executor_id,task.group_id
                      ,task.charge_two_id,task.charge_two_status,project.id as projectId,project.project_name,
                     case task.charge_stage
                         when 1 then task.charge_one_id
@@ -473,8 +473,8 @@
                     <if test="queryBO.projectId != null">
                         and tf.project_id = #{queryBO.projectId}
                     </if>
-                    <if test="queryBO.taskId != null">
-                        and tf.task_id = #{queryBO.taskId}
+                    <if test="queryBO.taskName != null and queryBO.taskName != ''">
+                        and task.name like concat('%',#{queryBO.taskName},'%')
                     </if>
                     <if test="deptIds!=null and deptIds.size()>0">
                         and project.dept_id in
@@ -518,8 +518,8 @@
             <if test="queryBO.projectId != null">
                 and tf.project_id = #{queryBO.projectId}
             </if>
-            <if test="queryBO.taskId != null">
-                and tf.task_id = #{queryBO.taskId}
+            <if test="queryBO.taskName != null and queryBO.taskName != ''">
+                and task.task_name like concat('%',#{queryBO.taskName},'%')
             </if>
             <if test="deptIds!=null and deptIds.size()>0">
                 and p.dept_id in
@@ -558,8 +558,8 @@
             <if test="queryBO.projectId != null">
                 and tf.project_id = #{queryBO.projectId}
             </if>
-            <if test="queryBO.taskId != null">
-                and tf.task_id = #{queryBO.taskId}
+            <if test="queryBO.taskName != null and queryBO.taskName != ''">
+                and task.task_name like concat('%',#{queryBO.taskName},'%')
             </if>
             <if test="deptIds!=null and deptIds.size()>0">
                 and project.dept_id in