فهرست منبع

feat: 1.task's crud 2.result file

Blizzard 1 سال پیش
والد
کامیت
191a07c7d3
45فایلهای تغییر یافته به همراه1422 افزوده شده و 25 حذف شده
  1. 18 0
      blade-service-api/wt-okr-api/pom.xml
  2. 5 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/AuthUserInfo.java
  3. 42 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/IndexMessage.java
  4. 94 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/Task.java
  5. 36 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskFile.java
  6. 24 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskLog.java
  7. 21 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskToExecute.java
  8. 34 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/WorkStatus.java
  9. 22 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskFileVO.java
  10. 20 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskLogVO.java
  11. 35 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskVO.java
  12. 17 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/UserStatusVO.java
  13. 18 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/WorkStatusVO.java
  14. 0 10
      blade-service/wt-okr/pom.xml
  15. 40 1
      blade-service/wt-okr/src/main/java/com/wtkj/controller/CommonController.java
  16. 35 0
      blade-service/wt-okr/src/main/java/com/wtkj/controller/IndexController.java
  17. 135 0
      blade-service/wt-okr/src/main/java/com/wtkj/controller/TaskController.java
  18. 12 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/IndexMessageMapper.java
  19. 6 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/IndexMessageMapper.xml
  20. 14 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskFileMapper.java
  21. 10 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskFileMapper.xml
  22. 15 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskLogMapper.java
  23. 8 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskLogMapper.xml
  24. 12 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.java
  25. 5 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.xml
  26. 12 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/WorkStatusMapper.java
  27. 5 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/WorkStatusMapper.xml
  28. 9 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/IAsyncService.java
  29. 12 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/IIndexMessageService.java
  30. 17 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskFileService.java
  31. 15 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskLogService.java
  32. 22 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskService.java
  33. 14 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/IWorkStatusService.java
  34. 88 11
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java
  35. 1 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/DeptToDeptServiceImpl.java
  36. 18 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/IndexMessageServiceImpl.java
  37. 5 3
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ProjectServiceImpl.java
  38. 33 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskFileServiceImpl.java
  39. 24 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskLogServiceImpl.java
  40. 127 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java
  41. 48 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/WorkStatusServiceImpl.java
  42. 51 0
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskFileWrapper.java
  43. 52 0
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskLogWrapper.java
  44. 149 0
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskWrapper.java
  45. 42 0
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/UserListWrapper.java

+ 18 - 0
blade-service-api/wt-okr-api/pom.xml

@@ -19,5 +19,23 @@
             <artifactId>blade-user-api</artifactId>
             <version>2.9.1.RELEASE</version>
         </dependency>
+        <dependency>
+            <groupId>com.wtkj</groupId>
+            <artifactId>wutong-file-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-system-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-dict-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+
     </dependencies>
 </project>

+ 5 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/AuthUserInfo.java

@@ -19,4 +19,9 @@ public class AuthUserInfo extends BladeUser {
 
 	@ApiModelProperty(value = "机构类别")
 	private Integer deptCategory;
+
+
+	private String deptName;
+
+
 }

+ 42 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/IndexMessage.java

@@ -0,0 +1,42 @@
+package com.wtkj.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 22:10
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("blade_index_message_log")
+public class IndexMessage extends BaseEntity {
+
+	@TableField("category")
+	@ApiModelProperty("分类,1:待办 2:内容更新")
+	private Integer category;
+
+	@TableField("to_user")
+	@ApiModelProperty("接收者")
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long toUser;
+
+	@TableField("content")
+	@ApiModelProperty("提醒内容")
+	private String content;
+
+	@TableField("open_url")
+	@ApiModelProperty("")
+	private String openUrl;
+
+	@TableField("is_read")
+	@ApiModelProperty("已读未读")
+	private Integer isRead;
+}

+ 94 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/Task.java

@@ -0,0 +1,94 @@
+package com.wtkj.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 14:35
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("blade_task")
+public class Task extends BaseEntity {
+
+	private Long projectId;
+
+	private String title;
+
+	@ApiModelProperty(value = "派遣给哪个机构:顶级机构")
+	@NotNull(message = "orgDeptId不可为空")
+	private Long orgDeptId;
+
+	@TableField("task_status")
+	@ApiModelProperty("任务状态:最大数值代表完成 默认为1进行中")
+	private Integer taskStatus = 1;
+
+	@TableField("level")
+	@ApiModelProperty("优先级")
+	private Integer level;
+
+	@TableField("category")
+	@ApiModelProperty("类别:可研,方案、其他等")
+	private String category;
+
+	@TableField("tags")
+	@ApiModelProperty("标签:新写、修改等")
+	private String tags;
+
+	@TableField("start_time")
+	@ApiModelProperty("开始时间")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	private Date startTime;
+
+	@TableField("end_time")
+	@ApiModelProperty("截止时间")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	private Date endTime;
+
+	@TableField("confirm_time")
+	@ApiModelProperty("任务完成确认时间")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd")
+	private Date confirmTime;
+
+	@TableField("remark")
+	@ApiModelProperty("备注")
+	private String remark;
+
+	@TableField("task_process")
+	@ApiModelProperty("任务进展")
+	private String taskProcess;
+
+	@TableField("related_ids")
+	@ApiModelProperty("参考文件的主键id")
+	private String relatedIds;
+
+	@ApiModelProperty(value = "项目经理")
+	@TableField("project_manager")
+	private Long projectManager;
+
+	@ApiModelProperty(value = "审查人")
+	@TableField("check_user")
+	private String checkUser;
+
+	@ApiModelProperty(value = "实际执行部门")
+	@TableField("execute_dept")
+	private Long executeDept;
+
+	@ApiModelProperty(value = "执行人")
+	@TableField("execute_user")
+	private String executeUser;
+}

+ 36 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskFile.java

@@ -0,0 +1,36 @@
+package com.wtkj.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 21:09
+ * @describe 任务成果文件
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("blade_task_file")
+public class TaskFile extends BaseEntity {
+
+	@JsonSerialize(using = ToStringSerializer.class)
+	@TableField("task_id")
+	@ApiModelProperty("任务ID")
+	private Long taskId;
+
+	//blade_file 主键ID
+	@TableField("blade_file_id")
+	@JsonSerialize(using = ToStringSerializer.class)
+	@ApiModelProperty("文件上传完以后返回的主键id")
+	private Long bladeFileId;
+
+	@TableField("is_checked")
+	@ApiModelProperty("项目经理是否确认")
+	private Integer isChecked;
+}

+ 24 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskLog.java

@@ -0,0 +1,24 @@
+package com.wtkj.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:35
+ * @describe 任务相关动态
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("blade_task_log")
+public class TaskLog extends BaseEntity {
+
+	@TableField("task_id")
+	private Long taskId;
+
+	@TableField("content")
+	private String content;
+}

+ 21 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskToExecute.java

@@ -0,0 +1,21 @@
+package com.wtkj.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:03
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("blade_task_to_execute")
+public class TaskToExecute extends BaseEntity {
+
+	private Long taskId;
+
+
+}

+ 34 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/WorkStatus.java

@@ -0,0 +1,34 @@
+package com.wtkj.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 23:47
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("blade_work_status")
+public class WorkStatus extends BaseEntity {
+
+	@ApiModelProperty("用户id")
+	@TableField("user_id")
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long userId;
+
+	@TableField("work_status")
+	@ApiModelProperty("状态图标")
+	private Integer workStatus;
+
+	@TableField("work_status_describe")
+	@ApiModelProperty("状态词")
+	private String workStatusDescribe;
+}

+ 22 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskFileVO.java

@@ -0,0 +1,22 @@
+package com.wtkj.vo;
+
+import com.wtkj.entity.TaskFile;
+import com.wutong.file.vo.FileVO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 21:45
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class TaskFileVO extends TaskFile {
+
+	private FileVO fileVO;
+
+	private String fileName;
+
+	private String createUserName;
+}

+ 20 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskLogVO.java

@@ -0,0 +1,20 @@
+package com.wtkj.vo;
+
+import com.wtkj.entity.TaskLog;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.system.user.entity.User;
+
+import java.util.Set;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 16:58
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class TaskLogVO extends TaskLog {
+
+	private Set<User> users;
+}

+ 35 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskVO.java

@@ -0,0 +1,35 @@
+package com.wtkj.vo;
+
+import com.wtkj.entity.FileAndFolder;
+import com.wtkj.entity.Task;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.system.user.entity.User;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 16:18
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class TaskVO extends Task {
+
+	private User projectManagerUser;
+
+	private String dispatchUintName;
+
+	private String executeDeptName;
+
+	private String createUserName;
+
+	private List<FileAndFolder> files;
+
+	private List<User> checkUsers;
+
+	private List<User> executeUsers;
+
+	private List<String> tagsArray;
+}

+ 17 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/UserStatusVO.java

@@ -0,0 +1,17 @@
+package com.wtkj.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.system.user.entity.User;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-16 00:06
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class UserStatusVO extends User {
+
+	private String workStatus;
+}

+ 18 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/WorkStatusVO.java

@@ -0,0 +1,18 @@
+package com.wtkj.vo;
+
+import com.wtkj.entity.WorkStatus;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.system.user.entity.User;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-16 00:01
+ * @describe
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class WorkStatusVO extends WorkStatus {
+
+	private User user;
+}

+ 0 - 10
blade-service/wt-okr/pom.xml

@@ -30,16 +30,6 @@
             <artifactId>wt-okr-api</artifactId>
             <version>1.0.RELEASE</version>
         </dependency>
-        <dependency>
-            <groupId>org.springblade</groupId>
-            <artifactId>blade-system-api</artifactId>
-            <version>2.9.1.RELEASE</version>
-        </dependency>
-        <dependency>
-            <groupId>com.wtkj</groupId>
-            <artifactId>wutong-file-api</artifactId>
-            <version>2.9.1.RELEASE</version>
-        </dependency>
 
         <!--        分布式事务-->
         <dependency>

+ 40 - 1
blade-service/wt-okr/src/main/java/com/wtkj/controller/CommonController.java

@@ -4,14 +4,20 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.wtkj.entity.AuthUserInfo;
 import com.wtkj.entity.DeptToDept;
 import com.wtkj.service.IDeptToDeptService;
+import com.wtkj.wrapper.UserListWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springblade.core.tool.api.R;
 import org.springblade.system.entity.Dept;
+import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -26,6 +32,8 @@ import java.util.List;
 public class CommonController {
 
 	private final IDeptToDeptService deptToDeptService;
+	private final ISysClient sysClient;
+	private final IUserClient userClient;
 
 	/**
 	 * 当前登录用户信息
@@ -51,9 +59,40 @@ public class CommonController {
 	 * 机构搜索
 	 */
 	@GetMapping("/get-dept")
-	@ApiOperation(value = "当前登录用户信息", notes = "")
+	@ApiOperation(value = "搜索机构", notes = "")
 	@ApiOperationSupport(order = 3)
 	public R<List<Dept>> list(Long topDept, String areaCode, String name, Integer category) {
 		return R.data(deptToDeptService.getDept(topDept, areaCode, name, category));
 	}
+
+	/**
+	 * 本机构下的机构
+	 */
+	@GetMapping("/dept-by-parentId")
+	@ApiOperation(value = "机构下的子机构", notes = "传入上级机构id")
+	@ApiOperationSupport(order = 4)
+	public R<List<Dept>> deptList(@RequestParam Long parentId) {
+		List<Dept> result = new ArrayList<>();
+		R<List<Dept>> rpc = sysClient.getDeptChildByParentId(parentId);
+		if (rpc.isSuccess() && !CollectionUtils.isEmpty(rpc.getData())) {
+			result.addAll(rpc.getData());
+		}
+		return R.data(result);
+	}
+
+	/**
+	 * 机构下的人
+	 */
+	@GetMapping("/get-user-list")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "机构下用户列表", notes = "")
+	public R getUserList(@RequestParam Long deptId, String name) {
+		List<User> list = new ArrayList<>();
+		R<List<User>> rpc = userClient.getDeptUserList(deptId, name);
+		if (rpc.isSuccess()) {
+			list = rpc.getData();
+		}
+		return R.data(UserListWrapper.build().listVO(list));
+	}
+
 }

+ 35 - 0
blade-service/wt-okr/src/main/java/com/wtkj/controller/IndexController.java

@@ -0,0 +1,35 @@
+package com.wtkj.controller;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.wtkj.service.IWorkStatusService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 23:58
+ * @describe
+ */
+@RestController
+@RequestMapping("/index")
+@Api(value = "首页", tags = "首页")
+@AllArgsConstructor
+public class IndexController {
+
+	private final IWorkStatusService workStatus;
+
+	/**
+	 * 用户工作状态
+	 */
+	@GetMapping("/work-status")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "我的状态", notes = "")
+	public R wordStatus() {
+		return R.data(workStatus.workStatus());
+	}
+}

+ 135 - 0
blade-service/wt-okr/src/main/java/com/wtkj/controller/TaskController.java

@@ -0,0 +1,135 @@
+package com.wtkj.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.wtkj.entity.Task;
+import com.wtkj.entity.TaskFile;
+import com.wtkj.entity.TaskLog;
+import com.wtkj.service.ITaskFileService;
+import com.wtkj.service.ITaskLogService;
+import com.wtkj.service.ITaskService;
+import com.wtkj.vo.TaskFileVO;
+import com.wtkj.vo.TaskLogVO;
+import com.wtkj.vo.TaskVO;
+import com.wtkj.wrapper.TaskFileWrapper;
+import com.wtkj.wrapper.TaskLogWrapper;
+import com.wtkj.wrapper.TaskWrapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:20
+ * @describe
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/task")
+@Api(value = "任务模块", tags = "任务模块")
+public class TaskController {
+
+	private final ITaskService taskService;
+
+	private final ITaskLogService taskLogService;
+
+	private final ITaskFileService taskFileService;
+
+	@PostMapping("/submit")
+	@ApiOperation(value = "创建、修改任务", notes = "")
+	@ApiOperationSupport(order = 1)
+	public R<Boolean> submitTask(@RequestBody @Valid Task task) {
+		return R.status(taskService.submit(task));
+	}
+
+	/**
+	 * 项目任务列表
+	 */
+	@GetMapping("/project-task-page")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "项目任务列表", notes = "传入projectId,分页参数")
+	public R<IPage<TaskVO>> projectTask(@RequestParam Long projectId, Query query) {
+		IPage<Task> page = taskService.projectTaskPage(projectId, Condition.getPage(query));
+		return R.data(TaskWrapper.build().pageVO(page));
+	}
+
+	/**
+	 * 任务详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "任务详情", notes = "传入任务主键id")
+	public R<TaskVO> detail(@RequestParam Long id) {
+		Task detail = taskService.getById(id);
+		return R.data(TaskWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 任务成果文件
+	 */
+	@GetMapping("/result-file")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "任务成果文件", notes = "传入任务主键id")
+	public R<List<TaskFileVO>> files(@RequestParam Long id) {
+		List<TaskFile> files = taskFileService.fileList(id);
+		return R.data(TaskFileWrapper.build().listVO(files));
+	}
+
+	/**
+	 * 上传成果文件
+	 */
+	@GetMapping("/upload-file")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "上传成果文件", notes = "传入任务主键id,文件ids")
+	public R saveFile(@RequestParam Long taskId, @RequestParam String ids) {
+		return R.status(taskService.uploadFile(taskId, ids));
+	}
+
+	/**
+	 * 删除附件
+	 */
+	@GetMapping("/delete-file")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "删除附件", notes = "传入主键ids")
+	public R deleteFile(@RequestParam String ids) {
+		return R.status(taskService.deleteFile(ids));
+	}
+
+	/**
+	 * 移动文件
+	 */
+	@GetMapping("/move-file")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "移动文件", notes = "")
+	public R moveFile(@RequestParam Long stageId, @RequestParam Long folderId, @RequestParam String fileIds) {
+		return R.status(taskService.moveFile(stageId, folderId, fileIds));
+	}
+
+	/**
+	 * 任务相关动态
+	 */
+	@GetMapping("/task-log")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "任务相关动态", notes = "传入任务主键id")
+	public R<IPage<TaskLogVO>> taskLog(Long id, Query query) {
+		LambdaQueryWrapper<TaskLog> lqw = new LambdaQueryWrapper<>();
+		lqw.eq(TaskLog::getTaskId, id);
+		lqw.orderByDesc(TaskLog::getCreateTime);
+		IPage<TaskLog> page = taskLogService.page(Condition.getPage(query), lqw);
+		return R.data(TaskLogWrapper.build().pageVO(page));
+	}
+
+	/**
+	 *
+	 */
+
+
+}

+ 12 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/IndexMessageMapper.java

@@ -0,0 +1,12 @@
+package com.wtkj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.wtkj.entity.IndexMessage;
+
+/**
+ * @author Blizzard
+ * @create at 2023-08-21 15:24
+ * @describe
+ */
+public interface IndexMessageMapper extends BaseMapper<IndexMessage> {
+}

+ 6 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/IndexMessageMapper.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.wtkj.mapper.IndexMessageMapper">
+
+
+</mapper>

+ 14 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskFileMapper.java

@@ -0,0 +1,14 @@
+package com.wtkj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.wtkj.entity.TaskFile;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 21:17
+ * @describe
+ */
+public interface TaskFileMapper extends BaseMapper<TaskFile> {
+	TaskFile getByBladeFileId(Long taskId, Long bladeFileId);
+
+}

+ 10 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskFileMapper.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.wtkj.mapper.TaskFileMapper">
+
+    <select id="getByBladeFileId" resultType="com.wtkj.entity.TaskFile">
+        select * from blade_task_management_file where is_deleted = 0 and task_id = #{param1} and blade_file_id =
+        #{param2}
+
+    </select>
+</mapper>

+ 15 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskLogMapper.java

@@ -0,0 +1,15 @@
+package com.wtkj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.wtkj.entity.TaskLog;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:54
+ * @describe
+ */
+public interface TaskLogMapper extends BaseMapper<TaskLog> {
+	List<TaskLog> listByTaskId(Long taskId);
+}

+ 8 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskLogMapper.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.wtkj.mapper.TaskLogMapper">
+
+    <select id="listByTaskId" resultType="com.wtkj.entity.TaskLog">
+        select * from blade_task_log where is_deleted = 0 and task_id =#{param}
+    </select>
+</mapper>

+ 12 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.java

@@ -0,0 +1,12 @@
+package com.wtkj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.wtkj.entity.Task;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:17
+ * @describe
+ */
+public interface TaskMapper extends BaseMapper<Task> {
+}

+ 5 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.wtkj.mapper.TaskMapper">
+
+</mapper>

+ 12 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/WorkStatusMapper.java

@@ -0,0 +1,12 @@
+package com.wtkj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.wtkj.entity.WorkStatus;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 23:50
+ * @describe
+ */
+public interface WorkStatusMapper extends BaseMapper<WorkStatus> {
+}

+ 5 - 0
blade-service/wt-okr/src/main/java/com/wtkj/mapper/WorkStatusMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.wtkj.mapper.WorkStatusMapper">
+
+</mapper>

+ 9 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/IAsyncService.java

@@ -1,6 +1,7 @@
 package com.wtkj.service;
 
 import com.wtkj.entity.Project;
+import com.wtkj.entity.Task;
 import org.springblade.core.secure.BladeUser;
 
 import java.util.List;
@@ -21,4 +22,12 @@ public interface IAsyncService {
 	 * 异步删除项目  项目阶段 文件夹/文件等
 	 */
 	void removeProject(List<Long> projectIds);
+
+	void createTaskLog(Task task);
+
+	//创建任务日志
+	void submitTaskMessage(Long userId, Task task);
+
+	//指定执行单位日志
+	void submitTaskOrgDept(Long userId, Task task);
 }

+ 12 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/IIndexMessageService.java

@@ -0,0 +1,12 @@
+package com.wtkj.service;
+
+import com.wtkj.entity.IndexMessage;
+import org.springblade.core.mp.base.BaseService;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 22:13
+ * @describe
+ */
+public interface IIndexMessageService extends BaseService<IndexMessage> {
+}

+ 17 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskFileService.java

@@ -0,0 +1,17 @@
+package com.wtkj.service;
+
+import com.wtkj.entity.TaskFile;
+import org.springblade.core.mp.base.BaseService;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 21:22
+ * @describe
+ */
+public interface ITaskFileService extends BaseService<TaskFile> {
+	List<TaskFile> fileList(Long id);
+
+	TaskFile getByBladeFileId(Long taskId, Long bladeFileId);
+}

+ 15 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskLogService.java

@@ -0,0 +1,15 @@
+package com.wtkj.service;
+
+import com.wtkj.entity.TaskLog;
+import org.springblade.core.mp.base.BaseService;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:55
+ * @describe
+ */
+public interface ITaskLogService extends BaseService<TaskLog> {
+	List<TaskLog> listByTaskId(Long taskId);
+}

+ 22 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskService.java

@@ -0,0 +1,22 @@
+package com.wtkj.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.wtkj.entity.Task;
+import org.springblade.core.mp.base.BaseService;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:18
+ * @describe
+ */
+public interface ITaskService extends BaseService<Task> {
+	boolean submit(Task task);
+
+	IPage<Task> projectTaskPage(Long projectId, IPage<Task> page);
+
+	boolean uploadFile(Long taskId, String ids);
+
+	boolean moveFile(Long stageId, Long folderId, String fileIds);
+
+	boolean deleteFile(String ids);
+}

+ 14 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/IWorkStatusService.java

@@ -0,0 +1,14 @@
+package com.wtkj.service;
+
+import com.wtkj.entity.WorkStatus;
+import com.wtkj.vo.WorkStatusVO;
+import org.springblade.core.mp.base.BaseService;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 23:52
+ * @describe
+ */
+public interface IWorkStatusService extends BaseService<WorkStatus> {
+	WorkStatusVO workStatus();
+}

+ 88 - 11
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java

@@ -1,13 +1,7 @@
 package com.wtkj.service.impl;
 
-import com.wtkj.entity.Project;
-import com.wtkj.entity.ProjectAuth;
-import com.wtkj.entity.ProjectStage;
-import com.wtkj.entity.TemplateTypeAndStage;
-import com.wtkj.service.IAsyncService;
-import com.wtkj.service.IProjectAuthService;
-import com.wtkj.service.IProjectStageService;
-import com.wtkj.service.ITypeAndStageService;
+import com.wtkj.entity.*;
+import com.wtkj.service.*;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.tool.api.R;
@@ -15,6 +9,8 @@ import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -37,7 +33,10 @@ public class AsyncServiceImpl implements IAsyncService {
 	private final IProjectStageService stageService;
 	private final IProjectAuthService projectAuthService;
 	private final ISysClient sysClient;
-
+	private final IUserClient userClient;
+	private final ITaskLogService taskLogService;
+	private final IProjectService projectService;
+	private final IIndexMessageService indexMessageService;
 
 	@Override
 	@Async("asyncPoolTaskExecutor")
@@ -78,8 +77,12 @@ public class AsyncServiceImpl implements IAsyncService {
 					String ancestors = rpc.getData().getAncestors();
 					if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
 						List<Long> longList = Func.toLongList(ancestors);
-						if (!CollectionUtils.isEmpty(longList) && longList.size() > 2) {
-							auth.setTopDept(longList.get(1));
+						if (!CollectionUtils.isEmpty(longList)) {
+							if (longList.size() > 2) {
+								auth.setTopDept(longList.get(1));
+							} else {
+								auth.setTopDept(Long.valueOf(deptIdStr));
+							}
 						}
 					}
 				}
@@ -97,4 +100,78 @@ public class AsyncServiceImpl implements IAsyncService {
 
 	}
 
+	@Override
+	public void createTaskLog(Task task) {
+		//1.任务日志
+		Long createUser = task.getCreateUser();
+		if (createUser != null) {
+			R<User> userR = userClient.userInfoById(createUser);
+			if (userR.isSuccess()) {
+				List<TaskLog> logs = new ArrayList<>();
+				TaskLog log = new TaskLog();
+				log.setTaskId(task.getId());
+				log.setContent(userR.getData().getName() + " 创建了任务");
+				log.setCreateDept(task.getCreateDept());
+				log.setCreateUser(task.getCreateUser());
+				log.setUpdateUser(task.getUpdateUser());
+				log.setCreateTime(DateUtil.now());
+				log.setUpdateTime(DateUtil.now());
+				logs.add(log);
+				if (task.getOrgDeptId() != null) {
+					TaskLog taskLog = new TaskLog();
+					taskLog.setTaskId(task.getId());
+					taskLog.setContent(userR.getData().getName() + " 指定了执行单位");
+					taskLog.setCreateDept(task.getCreateDept());
+					taskLog.setCreateUser(task.getCreateUser());
+					taskLog.setUpdateUser(task.getUpdateUser());
+					taskLog.setCreateTime(DateUtil.now());
+					taskLog.setUpdateTime(DateUtil.now());
+					logs.add(log);
+				}
+				taskLogService.saveBatch(logs);
+			}
+		}
+		// todo 2.任务下发通知
+	}
+
+	@Override
+	public void submitTaskOrgDept(Long userId, Task task) {
+		R<User> userR = userClient.userInfoById(userId);
+		if (userR.isSuccess()) {
+			TaskLog log = new TaskLog();
+			log.setTaskId(task.getId());
+			log.setContent(userR.getData().getName() + " 指定了执行单位");
+			log.setCreateDept(task.getCreateDept());
+			log.setCreateUser(task.getCreateUser());
+			log.setUpdateUser(task.getUpdateUser());
+			log.setCreateTime(DateUtil.now());
+			log.setUpdateTime(DateUtil.now());
+			taskLogService.save(log);
+		}
+	}
+
+	@Override
+	public void submitTaskMessage(Long userId, Task task) {
+		Long createUser = task.getCreateUser();
+		Long projectId = task.getProjectId();
+		String title = task.getTitle();
+		R<User> userR = userClient.userInfoById(userId);
+		Project project = projectService.getById(projectId);
+		if (userR.isSuccess() && project != null) {
+			IndexMessage message = new IndexMessage();
+			message.setCategory(1);
+			//发送给任务创建者
+			message.setToUser(createUser);
+			message.setContent(userR.getData().getName() + "上传了" + project.getName() + title + "任务的文件,请查阅");
+			message.setOpenUrl("/task");
+			message.setCreateDept(task.getCreateDept());
+			message.setCreateUser(userId);
+			message.setUpdateUser(userId);
+			message.setCreateTime(DateUtil.now());
+			message.setUpdateTime(DateUtil.now());
+			indexMessageService.save(message);
+		}
+	}
+
+
 }

+ 1 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/DeptToDeptServiceImpl.java

@@ -44,6 +44,7 @@ public class DeptToDeptServiceImpl extends BaseServiceImpl<DeptToDeptMapper, Dep
 				R<Dept> rpc = sysClient.getDept(Long.valueOf(deptIdStr));
 				if (rpc.isSuccess()) {
 					userInfo.setDeptCategory(rpc.getData().getDeptCategory());
+					userInfo.setDeptName(rpc.getData().getDeptName());
 					String ancestors = rpc.getData().getAncestors();
 					// ancestors 0,1689540492698267649
 					if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {

+ 18 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/IndexMessageServiceImpl.java

@@ -0,0 +1,18 @@
+package com.wtkj.service.impl;
+
+import com.wtkj.entity.IndexMessage;
+import com.wtkj.mapper.IndexMessageMapper;
+import com.wtkj.service.IIndexMessageService;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 22:13
+ * @describe
+ */
+@AllArgsConstructor
+@Service
+public class IndexMessageServiceImpl extends BaseServiceImpl<IndexMessageMapper, IndexMessage> implements IIndexMessageService {
+}

+ 5 - 3
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ProjectServiceImpl.java

@@ -61,11 +61,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 		R<Dept> rpc = sysClient.getDept(deptId);
 		if (rpc.isSuccess()) {
 			//项目名称
-			if (dto.getName() != null) {
+			if (StringUtil.isNotBlank(dto.getName())) {
 				lqw.eq(Project::getName, dto.getName());
 			}
 			//区域
-			if (dto.getAreaCode() != null) {
+			if (StringUtil.isNotBlank(dto.getAreaCode())) {
 				lqw.eq(Project::getAreaCode, dto.getAreaCode());
 			}
 			Integer deptCategory = rpc.getData().getDeptCategory();
@@ -77,7 +77,9 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 				lqw.like(StringUtil.isNotBlank(dto.getCooperationUint()), Project::getCooperationUint, dto.getCooperationUint());
 			} else {
 				//主管单位
-				lqw.eq(Project::getCompetentUnit, dto.getCompetentUnit());
+				if (dto.getCompetentUnit() != null) {
+					lqw.eq(Project::getCompetentUnit, dto.getCompetentUnit());
+				}
 				//如果不是业主 ---> 判断是否是服务商的管理员  服务商管理员可以查看所有的项目
 				String userRole = AuthUtil.getUserRole();
 				if (userRole != null && userRole.equals(STAFF_ADMIN)) {

+ 33 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskFileServiceImpl.java

@@ -0,0 +1,33 @@
+package com.wtkj.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.wtkj.entity.TaskFile;
+import com.wtkj.mapper.TaskFileMapper;
+import com.wtkj.service.ITaskFileService;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 21:23
+ * @describe
+ */
+@Service
+@AllArgsConstructor
+public class TaskFileServiceImpl extends BaseServiceImpl<TaskFileMapper, TaskFile> implements ITaskFileService {
+
+	@Override
+	public List<TaskFile> fileList(Long id) {
+		LambdaQueryWrapper<TaskFile> lqw = new LambdaQueryWrapper<>();
+		lqw.eq(TaskFile::getTaskId, id);
+		return this.list(lqw);
+	}
+
+	@Override
+	public TaskFile getByBladeFileId(Long taskId, Long bladeFileId) {
+		return baseMapper.getByBladeFileId(taskId, bladeFileId);
+	}
+}

+ 24 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskLogServiceImpl.java

@@ -0,0 +1,24 @@
+package com.wtkj.service.impl;
+
+import com.wtkj.entity.TaskLog;
+import com.wtkj.mapper.TaskLogMapper;
+import com.wtkj.service.ITaskLogService;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:56
+ * @describe
+ */
+@Service
+@AllArgsConstructor
+public class TaskLogServiceImpl extends BaseServiceImpl<TaskLogMapper, TaskLog> implements ITaskLogService {
+	@Override
+	public List<TaskLog> listByTaskId(Long taskId) {
+		return baseMapper.listByTaskId(taskId);
+	}
+}

+ 127 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java

@@ -0,0 +1,127 @@
+package com.wtkj.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.wtkj.entity.FileAndFolder;
+import com.wtkj.entity.Task;
+import com.wtkj.entity.TaskFile;
+import com.wtkj.mapper.TaskMapper;
+import com.wtkj.service.IAsyncService;
+import com.wtkj.service.IFileAndFolderService;
+import com.wtkj.service.ITaskFileService;
+import com.wtkj.service.ITaskService;
+import com.wutong.file.feign.IFileClient;
+import com.wutong.file.vo.FileVO;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 15:18
+ * @describe
+ */
+@AllArgsConstructor
+@Service
+public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implements ITaskService {
+
+	private final IAsyncService asyncService;
+	private final ITaskFileService taskFileService;
+	private final IFileAndFolderService fileAndFolderService;
+	private final IFileClient fileClient;
+
+	@Override
+	public boolean submit(Task task) {
+		boolean flag = false;
+		Long taskId = task.getId();
+		if (taskId == null) {
+			flag = this.save(task);
+			asyncService.createTaskLog(task);
+		} else {
+			//todo 任务状态处理
+			//执行的顶级单位
+			Long orgDeptId = task.getOrgDeptId();
+			Task byId = this.getById(taskId);
+			if (byId != null) {
+				//指定了执行单位
+				if (byId.getOrgDeptId() == null && orgDeptId != null) {
+					asyncService.submitTaskOrgDept(AuthUtil.getUserId(), task);
+				}
+			}
+			flag = this.updateById(task);
+		}
+		return flag;
+	}
+
+	@Override
+	public IPage<Task> projectTaskPage(Long projectId, IPage<Task> page) {
+		LambdaQueryWrapper<Task> lqw = new LambdaQueryWrapper<>();
+		lqw.eq(Task::getProjectId, projectId);
+		lqw.orderByAsc(Task::getTaskStatus);
+		return baseMapper.selectPage(page, lqw);
+	}
+
+	@Override
+	public boolean uploadFile(Long taskId, String ids) {
+		boolean flag = false;
+		if (ids != null) {
+			List<TaskFile> files = new ArrayList<>();
+			List<Long> fileIds = Func.toLongList(ids);
+			fileIds.forEach(id -> {
+				//判断这个文件是否已经存在
+				TaskFile file = taskFileService.getByBladeFileId(taskId, id);
+				//不存在 才保存
+				if (file == null) {
+					TaskFile taskFile = new TaskFile();
+					taskFile.setTaskId(taskId);
+					taskFile.setBladeFileId(id);
+					files.add(taskFile);
+				}
+			});
+			//提交任务消息
+			asyncService.submitTaskMessage(AuthUtil.getUserId(), this.getById(taskId));
+			flag = taskFileService.saveBatch(files);
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean moveFile(Long stageId, Long parentId, String fileIds) {
+
+		boolean flag = false;
+		List<Long> ids = Func.toLongList(fileIds);
+		if (!CollectionUtils.isEmpty(ids)) {
+			List<FileAndFolder> files = new ArrayList<>();
+			FileAndFolder folder = fileAndFolderService.getById(parentId);
+			if (folder != null) {
+				ids.forEach(id -> {
+					R<FileVO> rpc = fileClient.findById(id);
+					if (rpc.isSuccess()) {
+						FileAndFolder file = new FileAndFolder();
+						file.setProjectId(folder.getProjectId());
+						file.setStageId(stageId);
+						file.setParentId(parentId);
+						file.setType(1);
+						file.setTitle(rpc.getData().getOriginalFileName());
+						file.setBladeFileId(id);
+						files.add(file);
+					}
+				});
+				flag = fileAndFolderService.saveBatch(files);
+			}
+		}
+		return flag;
+	}
+
+	@Override
+	public boolean deleteFile(String ids) {
+		return taskFileService.removeBatchByIds(Func.toLongList(ids));
+	}
+}

+ 48 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/WorkStatusServiceImpl.java

@@ -0,0 +1,48 @@
+package com.wtkj.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.wtkj.entity.WorkStatus;
+import com.wtkj.mapper.WorkStatusMapper;
+import com.wtkj.service.IWorkStatusService;
+import com.wtkj.vo.WorkStatusVO;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 23:55
+ * @describe
+ */
+@AllArgsConstructor
+@Service
+public class WorkStatusServiceImpl extends BaseServiceImpl<WorkStatusMapper, WorkStatus> implements IWorkStatusService {
+
+	private final IUserClient userClient;
+
+	@Override
+	public WorkStatusVO workStatus() {
+		WorkStatusVO vo = new WorkStatusVO();
+		Long userId = AuthUtil.getUserId();
+		LambdaQueryWrapper<WorkStatus> lqw = new LambdaQueryWrapper<>();
+		lqw.eq(WorkStatus::getUserId, userId);
+		lqw.orderByDesc(WorkStatus::getCreateTime);
+		lqw.last("limit 1");
+		WorkStatus one = this.getOne(lqw);
+		if (one != null) {
+			vo = Objects.requireNonNull(BeanUtil.copy(one, WorkStatusVO.class));
+		}
+		R<User> userR = userClient.userInfoById(userId);
+		if (userR.isSuccess()) {
+			vo.setUser(userR.getData());
+		}
+		return vo;
+	}
+}

+ 51 - 0
blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskFileWrapper.java

@@ -0,0 +1,51 @@
+package com.wtkj.wrapper;
+
+import com.wtkj.entity.TaskFile;
+import com.wtkj.vo.TaskFileVO;
+import com.wutong.file.feign.IFileClient;
+import com.wutong.file.vo.FileVO;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+
+import java.util.Objects;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 21:49
+ * @describe
+ */
+public class TaskFileWrapper extends BaseEntityWrapper<TaskFile, TaskFileVO> {
+
+	private static IFileClient fileClient;
+	private static IUserClient userClient;
+
+	public static TaskFileWrapper build() {
+		fileClient = SpringUtil.getBean(IFileClient.class);
+		userClient = SpringUtil.getBean(IUserClient.class);
+		return new TaskFileWrapper();
+	}
+
+	@Override
+	public TaskFileVO entityVO(TaskFile entity) {
+		TaskFileVO vo = Objects.requireNonNull(BeanUtil.copy(entity, TaskFileVO.class));
+		//文件名
+		Long fileId = entity.getBladeFileId();
+		if (fileId != null) {
+			R<FileVO> rpc = fileClient.findById(fileId);
+			if (rpc.isSuccess()) {
+				vo.setFileVO(rpc.getData());
+			}
+		}
+		//文件上传人
+		Long createUser = entity.getCreateUser();
+		R<User> rpc = userClient.userInfoById(createUser);
+		if (rpc.isSuccess()) {
+			vo.setCreateUserName(rpc.getData().getName());
+		}
+		return vo;
+	}
+}

+ 52 - 0
blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskLogWrapper.java

@@ -0,0 +1,52 @@
+package com.wtkj.wrapper;
+
+import com.wtkj.entity.TaskLog;
+import com.wtkj.service.ITaskLogService;
+import com.wtkj.vo.TaskLogVO;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 16:18
+ * @describe
+ */
+public class TaskLogWrapper extends BaseEntityWrapper<TaskLog, TaskLogVO> {
+
+	private static IUserClient userClient;
+	private static ITaskLogService taskLogService;
+
+
+	public static TaskLogWrapper build() {
+		userClient = SpringUtil.getBean(IUserClient.class);
+		taskLogService = SpringUtil.getBean(ITaskLogService.class);
+		return new TaskLogWrapper();
+	}
+
+	@Override
+	public TaskLogVO entityVO(TaskLog entity) {
+		TaskLogVO vo = Objects.requireNonNull(BeanUtil.copy(entity, TaskLogVO.class));
+
+		//项目组成员
+		Long taskId = entity.getTaskId();
+		if (taskId != null) {
+			List<TaskLog> logs = taskLogService.listByTaskId(taskId);
+			if (!CollectionUtils.isEmpty(logs)) {
+				Set<User> users = logs.stream().map(TaskLog::getCreateUser).filter(Objects::nonNull).map(m -> userClient.userInfoById(m))
+					.filter(f -> f.isSuccess()).map(R::getData).collect(Collectors.toSet());
+				vo.setUsers(users);
+			}
+		}
+		return vo;
+	}
+}

+ 149 - 0
blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskWrapper.java

@@ -0,0 +1,149 @@
+package com.wtkj.wrapper;
+
+import com.wtkj.entity.FileAndFolder;
+import com.wtkj.entity.Task;
+import com.wtkj.service.IFileAndFolderService;
+import com.wtkj.vo.TaskVO;
+import com.wutong.file.feign.IFileClient;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.system.entity.Dept;
+import org.springblade.system.entity.DictBiz;
+import org.springblade.system.feign.IDictBizClient;
+import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-15 16:18
+ * @describe
+ */
+public class TaskWrapper extends BaseEntityWrapper<Task, TaskVO> {
+
+	private static IUserClient userClient;
+	private static ISysClient sysClient;
+	private static IFileClient fileClient;
+	private static IFileAndFolderService fileAndFolderService;
+	private static IDictBizClient dictBizClient;
+
+
+	public static TaskWrapper build() {
+		userClient = SpringUtil.getBean(IUserClient.class);
+		sysClient = SpringUtil.getBean(ISysClient.class);
+		fileClient = SpringUtil.getBean(IFileClient.class);
+		fileAndFolderService = SpringUtil.getBean(IFileAndFolderService.class);
+		dictBizClient = SpringUtil.getBean(IDictBizClient.class);
+		return new TaskWrapper();
+	}
+
+	@Override
+	public TaskVO entityVO(Task entity) {
+		TaskVO vo = Objects.requireNonNull(BeanUtil.copy(entity, TaskVO.class));
+		//联系人
+		Long projectManager = vo.getProjectManager();
+		if (projectManager != null) {
+			R<User> userR = userClient.userInfoById(projectManager);
+			if (userR.isSuccess()) {
+				vo.setProjectManagerUser(userR.getData());
+			}
+		}
+		//协作单位
+		Long orgDeptId = vo.getOrgDeptId();
+		if (orgDeptId != null) {
+			R<Dept> rpc = sysClient.getDept(orgDeptId);
+			if (rpc.isSuccess()) {
+				vo.setDispatchUintName(rpc.getData().getDeptName());
+			}
+		}
+		//执行机构
+		Long executeDept = vo.getExecuteDept();
+		if (executeDept != null) {
+			R<Dept> dept = sysClient.getDept(executeDept);
+			if (dept.isSuccess()) {
+				vo.setExecuteDeptName(dept.getData().getDeptName());
+			}
+		}
+
+		//任务创建人
+		Long createUser = entity.getCreateUser();
+		R<User> rpc = userClient.userInfoById(createUser);
+		if (rpc.isSuccess()) {
+			vo.setCreateUserName(rpc.getData().getName());
+		}
+
+		//审核人
+		String checkUser = entity.getCheckUser();
+		if (checkUser != null) {
+			List<User> users = new ArrayList<>();
+			List<Long> userIds = Func.toLongList(checkUser);
+			userIds.forEach(userId -> {
+				R<User> userR = userClient.userInfoById(userId);
+				if (userR.isSuccess()) {
+					users.add(userR.getData());
+				}
+			});
+			vo.setCheckUsers(users);
+		}
+
+		//任务执行人
+		String executeUser = entity.getExecuteUser();
+		if (executeUser != null) {
+			List<User> users = new ArrayList<>();
+			List<Long> userIds = Func.toLongList(executeUser);
+			userIds.forEach(userId -> {
+				R<User> userR = userClient.userInfoById(userId);
+				if (userR.isSuccess()) {
+					users.add(userR.getData());
+				}
+			});
+			vo.setExecuteUsers(users);
+		}
+
+		//任务相关联文件
+		String relatedIds = entity.getRelatedIds();
+		if (StringUtil.isNotBlank(relatedIds)) {
+			List<FileAndFolder> files = new ArrayList<>();
+			List<Long> fileIds = Func.toLongList(relatedIds);
+			fileIds.forEach(fileId -> {
+				FileAndFolder byId = fileAndFolderService.getById(fileId);
+				if (byId != null) {
+					files.add(byId);
+				}
+			});
+			vo.setFiles(files);
+		}
+		//任务标签的数组
+		String tags = entity.getTags();
+		String category = entity.getCategory();
+		List<String> dictBizs = new ArrayList<>();
+		if (StringUtil.isNotBlank(tags)) {
+			List<Long> intList = Func.toLongList(tags);
+			intList.forEach(f -> {
+				R<DictBiz> byId = dictBizClient.getById(f);
+				if (byId.isSuccess()) {
+					dictBizs.add(byId.getData().getDictValue());
+				}
+			});
+		}
+		if (StringUtil.isNotBlank(category)) {
+			List<Long> intList = Func.toLongList(category);
+			intList.forEach(f -> {
+				R<DictBiz> byId = dictBizClient.getById(f);
+				if (byId.isSuccess()) {
+					dictBizs.add(byId.getData().getDictValue());
+				}
+			});
+		}
+		vo.setTagsArray(dictBizs);
+		return vo;
+	}
+}

+ 42 - 0
blade-service/wt-okr/src/main/java/com/wtkj/wrapper/UserListWrapper.java

@@ -0,0 +1,42 @@
+package com.wtkj.wrapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.wtkj.entity.WorkStatus;
+import com.wtkj.service.IWorkStatusService;
+import com.wtkj.vo.UserStatusVO;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.system.user.entity.User;
+
+import java.util.Objects;
+
+/**
+ * @author Blizzard
+ * @create at 2023-09-16 00:05
+ * @describe
+ */
+public class UserListWrapper extends BaseEntityWrapper<User, UserStatusVO> {
+
+	private static IWorkStatusService workStatusService;
+
+	public static UserListWrapper build() {
+		workStatusService = SpringUtil.getBean(IWorkStatusService.class);
+		return new UserListWrapper();
+	}
+
+	@Override
+	public UserStatusVO entityVO(User entity) {
+		UserStatusVO vo = Objects.requireNonNull(BeanUtil.copy(entity, UserStatusVO.class));
+		Long userId = vo.getId();
+		LambdaQueryWrapper<WorkStatus> lqw = new LambdaQueryWrapper<>();
+		lqw.eq(WorkStatus::getUserId, userId);
+		lqw.orderByDesc(WorkStatus::getCreateTime);
+		lqw.last("limit 1");
+		WorkStatus one = workStatusService.getOne(lqw);
+		if (one != null) {
+			vo.setWorkStatus(one.getWorkStatusDescribe());
+		}
+		return vo;
+	}
+}