Browse Source

任务详情中添加参与人字段。修改中添加参与人的判断

buzhanyi 7 months ago
parent
commit
6614c8e796

+ 22 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/entity/TaskInfoEntity.java

@@ -1,6 +1,12 @@
 package com.ankaibei.workFlow.webadmin.ankaibei.entity;
 
-import javax.persistence.*;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.util.Date;
 import java.util.Objects;
 
@@ -47,6 +53,21 @@ public class TaskInfoEntity {
      * 任务创建人
      */
     private String taskCreator;
+
+    /**
+     * 任务创建人 不在数据库中的字段
+     * 用于前端显示
+     */
+    private String taskCreatorName;
+
+    public String getTaskCreatorName() {
+        return taskCreatorName;
+    }
+
+    public void setTaskCreatorName(String taskCreatorName) {
+        this.taskCreatorName = taskCreatorName;
+    }
+
     /**
      * 量化指标
      */

+ 12 - 6
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/TaskInfoServiceImpl.java

@@ -22,7 +22,6 @@ import com.ankaibei.workFlow.webadmin.ankaibei.mapper.TaskInfoMapper;
 import com.ankaibei.workFlow.webadmin.ankaibei.mapper.UserInfoMapper;
 import com.ankaibei.workFlow.webadmin.ankaibei.service.TaskInfoService;
 import com.ankaibei.workFlow.webadmin.ankaibei.utils.FlowTaskStart;
-import com.ankaibei.workFlow.webadmin.ankaibei.vo.ManHourInfoVo;
 import com.ankaibei.workFlow.webadmin.ankaibei.vo.ResMsg;
 import com.ankaibei.workFlow.webadmin.ankaibei.vo.TaskInfoVo;
 import org.apache.commons.lang3.ObjectUtils;
@@ -33,12 +32,16 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.time.Duration;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 /**
@@ -195,6 +198,10 @@ public class TaskInfoServiceImpl implements TaskInfoService {
         if (ObjectUtils.isEmpty(taskInfoEntity.getStartTime()) || ObjectUtils.isEmpty(taskInfoEntity.getEndTime())) {
             return new ResMsg(CodeEnum.PARAM_IS_NULL, "请录入任务计划的开始时间和结束时间");
         }
+        //判断任务的参与人是否为空
+        if (ObjectUtils.isEmpty(taskParticipant)) {
+            return new ResMsg(CodeEnum.PARAM_IS_NULL, "任务参与人不能为空");
+        }
         StringBuffer str = new StringBuffer();
         for (Long id : taskParticipant) {
             str.append(id).append(",");
@@ -303,8 +310,7 @@ public class TaskInfoServiceImpl implements TaskInfoService {
             return new ResMsg(CodeEnum.NO_DATA);
         }
         //任务发起人
-        byId.get().setTaskCreator(userInfoMapper.getById(byId.get().getTaskCreator()).getShowName());
-
+        byId.get().setTaskCreatorName(userInfoMapper.getById(byId.get().getTaskCreator()).getShowName());
         return new ResMsg(CodeEnum.OK, byId.orElse(null));
     }