Ver Fonte

fix: statistics fix

Blizzard há 1 ano atrás
pai
commit
f8b342a3e1
43 ficheiros alterados com 637 adições e 532 exclusões
  1. 2 6
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/FileAndFolderHistory.java
  2. 4 1
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/FileRead.java
  3. 4 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskContract.java
  4. 3 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/TaskLog.java
  5. 3 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/AuthUserInfo.java
  6. 1 6
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/FileAndFolderVO.java
  7. 6 1
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/IndexProjectAndTaskSummaryVO.java
  8. 6 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/ProjectStatisticsVO.java
  9. 0 4
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskLogVO.java
  10. 20 0
      blade-service/wt-okr/src/main/java/com/wtkj/config/NacosConfigValue.java
  11. 26 1
      blade-service/wt-okr/src/main/java/com/wtkj/controller/FileAndFolderController.java
  12. 9 11
      blade-service/wt-okr/src/main/java/com/wtkj/controller/ProjectController.java
  13. 28 11
      blade-service/wt-okr/src/main/java/com/wtkj/controller/TaskController.java
  14. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileAndFolderHistoryMapper.java
  15. 2 2
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileAndFolderMapper.xml
  16. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileReadMapper.java
  17. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/ProjectGroupMapper.java
  18. 2 2
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/ProjectGroupMapper.xml
  19. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskContractMapper.java
  20. 14 1
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskContractMapper.xml
  21. 2 6
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.java
  22. 15 9
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.xml
  23. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/IFileAndFolderHistoryService.java
  24. 5 2
      blade-service/wt-okr/src/main/java/com/wtkj/service/IFileReadService.java
  25. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/IProjectGroupService.java
  26. 4 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/IProjectService.java
  27. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskContractService.java
  28. 3 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskLogService.java
  29. 3 6
      blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskService.java
  30. 182 291
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java
  31. 14 6
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/CommonServiceImpl.java
  32. 3 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ContactOuterServiceImpl.java
  33. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/FileAndFolderHistoryServiceImpl.java
  34. 33 4
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/FileReadServiceImpl.java
  35. 2 2
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ITaskContractServiceImpl.java
  36. 35 44
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/IndexServiceImpl.java
  37. 2 2
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ProjectGroupServiceImpl.java
  38. 140 43
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ProjectServiceImpl.java
  39. 28 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskLogServiceImpl.java
  40. 25 31
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java
  41. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/FileAndFolderHistoryWrapper.java
  42. 2 12
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/FileAndFolderWrapper.java
  43. 0 17
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskLogWrapper.java

+ 2 - 6
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/FileAndFolderHistory.java

@@ -2,8 +2,6 @@ package com.wtkj.entity;
 
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import org.springblade.core.mp.base.BaseEntity;
 import org.springblade.core.mp.base.BaseEntity;
@@ -21,12 +19,10 @@ public class FileAndFolderHistory extends BaseEntity {
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
 	//blade_file的主键id
 	//blade_file的主键id
-	@JsonSerialize(using = ToStringSerializer.class)
 	@TableField("latest_id")
 	@TableField("latest_id")
-	private Long latestId;
+	private String latestId;
 
 
 	//blade_file的主键id
 	//blade_file的主键id
-	@JsonSerialize(using = ToStringSerializer.class)
 	@TableField("history_id")
 	@TableField("history_id")
-	private Long historyId;
+	private String historyId;
 }
 }

+ 4 - 1
blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/FileRead.java

@@ -2,6 +2,8 @@ package com.wtkj.entity;
 
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 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 io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
@@ -21,9 +23,10 @@ public class FileRead extends BaseEntity {
 
 
 	@TableField("blade_file_id")
 	@TableField("blade_file_id")
 	@ApiModelProperty(value = "文件主键id")
 	@ApiModelProperty(value = "文件主键id")
-	private Long bladeFileId;
+	private String bladeFileId;
 
 
 	@TableField("user_id")
 	@TableField("user_id")
 	@ApiModelProperty(value = "用户id")
 	@ApiModelProperty(value = "用户id")
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long userId;
 	private Long userId;
 }
 }

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

@@ -52,4 +52,8 @@ public class TaskContract extends BaseEntity {
 	@ApiModelProperty(value = "未付金额")
 	@ApiModelProperty(value = "未付金额")
 	private BigDecimal unpaidAmount;
 	private BigDecimal unpaidAmount;
 
 
+	@TableField("year")
+	@ApiModelProperty(value = "签订年")
+	private Integer year;
+
 }
 }

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

@@ -27,4 +27,7 @@ public class TaskLog extends BaseEntity {
 
 
 	@TableField("content")
 	@TableField("content")
 	private String content;
 	private String content;
+
+	@TableField("related_user")
+	private String relatedUser;
 }
 }

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

@@ -21,6 +21,9 @@ public class AuthUserInfo extends BladeUser {
 	@ApiModelProperty(value = "当前登录用户的顶级部门ID")
 	@ApiModelProperty(value = "当前登录用户的顶级部门ID")
 	private Long topDept;
 	private Long topDept;
 
 
+	@ApiModelProperty(value = "当前登录用户的顶级部门")
+	private String topDeptName;
+
 	@ApiModelProperty(value = "机构类别")
 	@ApiModelProperty(value = "机构类别")
 	private Integer deptCategory;
 	private Integer deptCategory;
 
 

+ 1 - 6
blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/FileAndFolderVO.java

@@ -4,9 +4,6 @@ import com.wtkj.entity.FileAndFolder;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
-import org.springblade.system.user.entity.User;
-
-import java.util.Set;
 
 
 /**
 /**
  * @author Blizzard
  * @author Blizzard
@@ -20,7 +17,7 @@ public class FileAndFolderVO extends FileAndFolder {
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
 	@ApiModelProperty(value = "权限 0:无 1:有")
 	@ApiModelProperty(value = "权限 0:无 1:有")
-	private Integer auth = 0;
+	private Integer auth = 1;
 
 
 	private String uploadUser;
 	private String uploadUser;
 
 
@@ -34,7 +31,5 @@ public class FileAndFolderVO extends FileAndFolder {
 
 
 	private String url;
 	private String url;
 
 
-	private Set<User> readUsers;
-
 	private String projectName;
 	private String projectName;
 }
 }

+ 6 - 1
blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/IndexProjectAndTaskSummaryVO.java

@@ -1,5 +1,6 @@
 package com.wtkj.vo;
 package com.wtkj.vo;
 
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -14,14 +15,18 @@ public class IndexProjectAndTaskSummaryVO implements Serializable {
 
 
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
-
+	@ApiModelProperty(value = "项目总数")
 	private Integer projectCount = 0;
 	private Integer projectCount = 0;
 
 
+	@ApiModelProperty(value = "我参与的")
 	private Integer myProjectCount = 0;
 	private Integer myProjectCount = 0;
 
 
+	@ApiModelProperty(value = "任务总数")
 	private Integer taskCount = 0;
 	private Integer taskCount = 0;
 
 
+	@ApiModelProperty(value = "我的任务")
 	private Integer myTaskCount = 0;
 	private Integer myTaskCount = 0;
 
 
+	@ApiModelProperty(value = "今日任务")
 	private Integer todayTask = 0;
 	private Integer todayTask = 0;
 }
 }

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

@@ -1,5 +1,6 @@
 package com.wtkj.vo;
 package com.wtkj.vo;
 
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -15,13 +16,18 @@ public class ProjectStatisticsVO implements Serializable {
 
 
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
+	@ApiModelProperty(value = "项目总数")
 	private Integer projectCount = 0;
 	private Integer projectCount = 0;
 
 
+	@ApiModelProperty(value = "项目总投资")
 	private BigDecimal totalAmount = BigDecimal.valueOf(0);
 	private BigDecimal totalAmount = BigDecimal.valueOf(0);
 
 
+	@ApiModelProperty(value = "服务合同总投资")
 	private BigDecimal contractAmount = BigDecimal.valueOf(0);
 	private BigDecimal contractAmount = BigDecimal.valueOf(0);
 
 
+	@ApiModelProperty(value = "待完成任务总数")
 	private Integer todoTask = 0;
 	private Integer todoTask = 0;
 
 
+	@ApiModelProperty(value = "风险预警")
 	private Integer warns = 0;
 	private Integer warns = 0;
 }
 }

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

@@ -3,9 +3,6 @@ package com.wtkj.vo;
 import com.wtkj.entity.TaskLog;
 import com.wtkj.entity.TaskLog;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
-import org.springblade.system.user.entity.User;
-
-import java.util.Set;
 
 
 /**
 /**
  * @author Blizzard
  * @author Blizzard
@@ -18,5 +15,4 @@ public class TaskLogVO extends TaskLog {
 
 
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
-	private Set<User> users;
 }
 }

+ 20 - 0
blade-service/wt-okr/src/main/java/com/wtkj/config/NacosConfigValue.java

@@ -16,6 +16,11 @@ public class NacosConfigValue {
 
 
 	public static long scanCount;
 	public static long scanCount;
 
 
+	public static String corpId;
+	public static String qyAgentId;
+
+	public static String qySecret;
+
 	@Value("${qrcode.expireIn}")
 	@Value("${qrcode.expireIn}")
 	public void setExpireIn(Long expireIn) {
 	public void setExpireIn(Long expireIn) {
 		NacosConfigValue.expireIn = expireIn;
 		NacosConfigValue.expireIn = expireIn;
@@ -25,4 +30,19 @@ public class NacosConfigValue {
 	public void setScanCount(Long scanCount) {
 	public void setScanCount(Long scanCount) {
 		NacosConfigValue.scanCount = scanCount;
 		NacosConfigValue.scanCount = scanCount;
 	}
 	}
+
+	@Value("${qy.corpId}")
+	public void setCorpId(String corpId) {
+		NacosConfigValue.corpId = corpId;
+	}
+
+	@Value("${qy.agentId}")
+	public void setCpAgentId(String qyAgentId) {
+		NacosConfigValue.qyAgentId = qyAgentId;
+	}
+
+	@Value("${qy.secret}")
+	public void setCpSecret(String qySecret) {
+		NacosConfigValue.qySecret = qySecret;
+	}
 }
 }

+ 26 - 1
blade-service/wt-okr/src/main/java/com/wtkj/controller/FileAndFolderController.java

@@ -22,6 +22,7 @@ import lombok.AllArgsConstructor;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.Func;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -63,6 +64,9 @@ public class FileAndFolderController {
 		lqw.eq(FileAndFolder::getStageId, folder.getStageId());
 		lqw.eq(FileAndFolder::getStageId, folder.getStageId());
 		lqw.eq(FileAndFolder::getTitle, folder.getTitle());
 		lqw.eq(FileAndFolder::getTitle, folder.getTitle());
 		lqw.eq(FileAndFolder::getParentId, folder.getParentId());
 		lqw.eq(FileAndFolder::getParentId, folder.getParentId());
+		if (folder.getIsPrivate() == 1) {
+			folder.setPrivateUser(AuthUtil.getUserId());
+		}
 		if (Objects.equals(folder.getType(), ONE)) {
 		if (Objects.equals(folder.getType(), ONE)) {
 			lqw.eq(FileAndFolder::getType, ONE);
 			lqw.eq(FileAndFolder::getType, ONE);
 			long cnt = fileAndFolderService.count(lqw);
 			long cnt = fileAndFolderService.count(lqw);
@@ -201,11 +205,32 @@ public class FileAndFolderController {
 	@GetMapping("/v2/file-history")
 	@GetMapping("/v2/file-history")
 	@ApiOperationSupport(order = 21)
 	@ApiOperationSupport(order = 21)
 	@ApiOperation(value = "文件历史", notes = "传入fileId字段,注意非主键id")
 	@ApiOperation(value = "文件历史", notes = "传入fileId字段,注意非主键id")
-	public R fileHistory(@RequestParam Long fileId, Query query) {
+	public R fileHistory(@RequestParam String fileId, Query query) {
 		IPage<FileAndFolderHistory> page = historyService.getPage(fileId, Condition.getPage(query));
 		IPage<FileAndFolderHistory> page = historyService.getPage(fileId, Condition.getPage(query));
 		return R.data(FileAndFolderHistoryWrapper.build().pageVO(page));
 		return R.data(FileAndFolderHistoryWrapper.build().pageVO(page));
 	}
 	}
 
 
+	/**
+	 * 文件阅读记录
+	 */
+	@GetMapping("/file-read-user")
+	@ApiOperationSupport(order = 22)
+	@ApiOperation(value = "文件阅读人", notes = "传入文件id")
+	public R fileRead(@RequestParam String bladeFileId) {
+		return R.data(fileReadService.fileRead(bladeFileId));
+	}
+
+	/**
+	 * 是否阅读过
+	 */
+	@GetMapping("/is-read")
+	@ApiOperationSupport(order = 23)
+	@ApiOperation(value = "是否阅过文件", notes = "传入文件id")
+	public R isRead(@RequestParam String bladeFileId) {
+		return R.data(fileReadService.isRead(bladeFileId, AuthUtil.getUserId()));
+	}
+
+
 
 
 
 
 }
 }

+ 9 - 11
blade-service/wt-okr/src/main/java/com/wtkj/controller/ProjectController.java

@@ -6,7 +6,10 @@ import com.wtkj.dto.ProjectPageDTO;
 import com.wtkj.entity.Project;
 import com.wtkj.entity.Project;
 import com.wtkj.entity.ProjectGroup;
 import com.wtkj.entity.ProjectGroup;
 import com.wtkj.entity.ProjectStage;
 import com.wtkj.entity.ProjectStage;
-import com.wtkj.service.*;
+import com.wtkj.service.IProjectGroupService;
+import com.wtkj.service.IProjectService;
+import com.wtkj.service.IProjectStageService;
+import com.wtkj.service.ITaskService;
 import com.wtkj.vo.MyTaskStatistics;
 import com.wtkj.vo.MyTaskStatistics;
 import com.wtkj.vo.ProjectStageVO;
 import com.wtkj.vo.ProjectStageVO;
 import com.wtkj.wrapper.ProjectGroupWrapper;
 import com.wtkj.wrapper.ProjectGroupWrapper;
@@ -37,7 +40,6 @@ public class ProjectController {
 
 
 	private final IProjectService projectService;
 	private final IProjectService projectService;
 
 
-	private final IAsyncService asyncService;
 
 
 	private final IProjectStageService stageService;
 	private final IProjectStageService stageService;
 
 
@@ -75,12 +77,8 @@ public class ProjectController {
 	@ApiOperation(value = "删除", notes = "传入ids")
 	@ApiOperation(value = "删除", notes = "传入ids")
 	@ApiOperationSupport(order = 3)
 	@ApiOperationSupport(order = 3)
 	public R<Boolean> delete(String ids) {
 	public R<Boolean> delete(String ids) {
-		boolean b = projectService.removeBatchByIds(Func.toLongList(ids));
-		if (b) {
-			//todo 项目相关的信息删除
-			asyncService.removeProject(Func.toLongList(ids));
-		}
-		return R.status(b);
+		boolean flag = projectService.delete(Func.toLongList(ids));
+		return R.status(flag);
 	}
 	}
 
 
 	/**
 	/**
@@ -129,10 +127,10 @@ public class ProjectController {
 	 * 项目小组
 	 * 项目小组
 	 */
 	 */
 	@GetMapping("/project-group-mem")
 	@GetMapping("/project-group-mem")
-	@ApiOperation(value = "项目组成员", notes = "传入projectId,competentUnit:主管单位")
+	@ApiOperation(value = "项目组成员", notes = "传入stageId")
 	@ApiOperationSupport(order = 7)
 	@ApiOperationSupport(order = 7)
-	public R groupMem(@RequestParam Long projectId, @RequestParam Long competentUnit) {
-		List<ProjectGroup> list = projectGroupService.getGroupByProjectId(projectId, competentUnit);
+	public R groupMem(@RequestParam Long stageId) {
+		List<ProjectGroup> list = projectGroupService.getGroupByStageId(stageId);
 		return R.data(ProjectGroupWrapper.build().listVO(list));
 		return R.data(ProjectGroupWrapper.build().listVO(list));
 	}
 	}
 
 

+ 28 - 11
blade-service/wt-okr/src/main/java/com/wtkj/controller/TaskController.java

@@ -18,9 +18,11 @@ import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.system.user.entity.User;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import javax.validation.Valid;
 import javax.validation.Valid;
+import java.time.LocalDate;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -48,7 +50,7 @@ public class TaskController {
 	 * 我的任务分页
 	 * 我的任务分页
 	 */
 	 */
 
 
-	@GetMapping("/my-task-page")
+	@PostMapping("/my-task-page")
 	@ApiOperationSupport(order = 1)
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "我的任务列表", notes = "")
 	@ApiOperation(value = "我的任务列表", notes = "")
 	public R<IPage<TaskVO>> myTaskPage(@RequestBody @Valid MyTaskPageDTO dto) {
 	public R<IPage<TaskVO>> myTaskPage(@RequestBody @Valid MyTaskPageDTO dto) {
@@ -169,13 +171,28 @@ public class TaskController {
 		return R.data(TaskLogWrapper.build().pageVO(page));
 		return R.data(TaskLogWrapper.build().pageVO(page));
 	}
 	}
 
 
+	/**
+	 * 任务组成员
+	 */
+	@GetMapping("/task-group-mem")
+	@ApiOperationSupport(order = 12)
+	@ApiOperation(value = "任务组成员", notes = "传入任务主键id")
+	public R<List<User>> taskGroup(@RequestParam Long id) {
+		//todo 任务组成员
+		return R.data(taskLogService.getTaskGroupMen(id));
+	}
+
 	/**
 	/**
 	 * 添加任务相关合同
 	 * 添加任务相关合同
 	 */
 	 */
 	@PostMapping("/submit-task-contract")
 	@PostMapping("/submit-task-contract")
-	@ApiOperationSupport(order = 12)
+	@ApiOperationSupport(order = 13)
 	@ApiOperation(value = "新增或者修改任务合同", notes = "")
 	@ApiOperation(value = "新增或者修改任务合同", notes = "")
 	public R<Boolean> submitContracts(@RequestBody @Valid TaskContract contract) {
 	public R<Boolean> submitContracts(@RequestBody @Valid TaskContract contract) {
+		if (contract.getId() == null) {
+			int year = LocalDate.now().getYear();
+			contract.setYear(year);
+		}
 		return R.status(taskContractService.saveOrUpdate(contract));
 		return R.status(taskContractService.saveOrUpdate(contract));
 
 
 	}
 	}
@@ -184,7 +201,7 @@ public class TaskController {
 	 * 删除任务合同
 	 * 删除任务合同
 	 */
 	 */
 	@GetMapping("/delete-task-contract")
 	@GetMapping("/delete-task-contract")
-	@ApiOperationSupport(order = 13)
+	@ApiOperationSupport(order = 14)
 	@ApiOperation(value = "删除任务合同", notes = "传入主键ids")
 	@ApiOperation(value = "删除任务合同", notes = "传入主键ids")
 	public R<Boolean> deleteContracts(@RequestParam String ids) {
 	public R<Boolean> deleteContracts(@RequestParam String ids) {
 		return R.status(taskContractService.removeByIds(Func.toLongList(ids)));
 		return R.status(taskContractService.removeByIds(Func.toLongList(ids)));
@@ -194,7 +211,7 @@ public class TaskController {
 	 * 任务合同分页
 	 * 任务合同分页
 	 */
 	 */
 	@GetMapping("/task-contract-page")
 	@GetMapping("/task-contract-page")
-	@ApiOperationSupport(order = 14)
+	@ApiOperationSupport(order = 15)
 	@ApiOperation(value = "任务合同分页", notes = "传入主键taskId,分页参数")
 	@ApiOperation(value = "任务合同分页", notes = "传入主键taskId,分页参数")
 	public R<IPage<TaskContractVO>> contractPage(@RequestParam Long taskId, Query query) {
 	public R<IPage<TaskContractVO>> contractPage(@RequestParam Long taskId, Query query) {
 		IPage<TaskContract> page = taskContractService.pageByTaskId(taskId, Condition.getPage(query));
 		IPage<TaskContract> page = taskContractService.pageByTaskId(taskId, Condition.getPage(query));
@@ -206,7 +223,7 @@ public class TaskController {
 	 * 任务成本核算
 	 * 任务成本核算
 	 */
 	 */
 	@PostMapping("/submit-task-cost")
 	@PostMapping("/submit-task-cost")
-	@ApiOperationSupport(order = 15)
+	@ApiOperationSupport(order = 16)
 	@ApiOperation(value = "新增或修改任务成本", notes = "")
 	@ApiOperation(value = "新增或修改任务成本", notes = "")
 	public R<Boolean> submitCost(@RequestBody TaskCost cost) {
 	public R<Boolean> submitCost(@RequestBody TaskCost cost) {
 		return R.data(taskCostService.saveOrUpdate(cost));
 		return R.data(taskCostService.saveOrUpdate(cost));
@@ -216,7 +233,7 @@ public class TaskController {
 	 * 任务成本详情
 	 * 任务成本详情
 	 */
 	 */
 	@GetMapping("/task-cost-detail")
 	@GetMapping("/task-cost-detail")
-	@ApiOperationSupport(order = 16)
+	@ApiOperationSupport(order = 17)
 	@ApiOperation(value = "成本详情", notes = "")
 	@ApiOperation(value = "成本详情", notes = "")
 	public R<TaskCostVO> costDetail(@RequestParam Long id) {
 	public R<TaskCostVO> costDetail(@RequestParam Long id) {
 		TaskCost detail = taskCostService.getById(id);
 		TaskCost detail = taskCostService.getById(id);
@@ -227,7 +244,7 @@ public class TaskController {
 	 * 删除成本记录
 	 * 删除成本记录
 	 */
 	 */
 	@GetMapping("/delete-task-cost")
 	@GetMapping("/delete-task-cost")
-	@ApiOperationSupport(order = 17)
+	@ApiOperationSupport(order = 18)
 	@ApiOperation(value = "删除成本记录", notes = "传入主键ids")
 	@ApiOperation(value = "删除成本记录", notes = "传入主键ids")
 	public R<Boolean> deleteCost(@RequestParam String ids) {
 	public R<Boolean> deleteCost(@RequestParam String ids) {
 		return R.status(taskCostService.removeByIds(Func.toLongList(ids)));
 		return R.status(taskCostService.removeByIds(Func.toLongList(ids)));
@@ -237,7 +254,7 @@ public class TaskController {
 	 * 成本分页
 	 * 成本分页
 	 */
 	 */
 	@GetMapping("/task-cost-page")
 	@GetMapping("/task-cost-page")
-	@ApiOperationSupport(order = 18)
+	@ApiOperationSupport(order = 19)
 	@ApiOperation(value = "成本分页", notes = "传入taskId,分页参数")
 	@ApiOperation(value = "成本分页", notes = "传入taskId,分页参数")
 	public R<IPage<TaskCostVO>> costPage(@RequestParam Long taskId, Query query) {
 	public R<IPage<TaskCostVO>> costPage(@RequestParam Long taskId, Query query) {
 		IPage<TaskCost> page = taskCostService.pageByTaskId(taskId, Condition.getPage(query));
 		IPage<TaskCost> page = taskCostService.pageByTaskId(taskId, Condition.getPage(query));
@@ -248,7 +265,7 @@ public class TaskController {
 	 * 成本统计
 	 * 成本统计
 	 */
 	 */
 	@GetMapping("/task-cost-statistics")
 	@GetMapping("/task-cost-statistics")
-	@ApiOperationSupport(order = 19)
+	@ApiOperationSupport(order = 20)
 	@ApiOperation(value = "任务成本统计", notes = "传入taskId")
 	@ApiOperation(value = "任务成本统计", notes = "传入taskId")
 	public R<JSONObject> costStatistics(@RequestParam Long taskId) {
 	public R<JSONObject> costStatistics(@RequestParam Long taskId) {
 		return R.data(taskCostService.costStatistics(taskId));
 		return R.data(taskCostService.costStatistics(taskId));
@@ -258,7 +275,7 @@ public class TaskController {
 	 * 今日待完成
 	 * 今日待完成
 	 */
 	 */
 	@GetMapping("/today-todo-task")
 	@GetMapping("/today-todo-task")
-	@ApiOperationSupport(order = 20)
+	@ApiOperationSupport(order = 21)
 	@ApiOperation(value = "登录用户指定日期待完成任务", notes = "")
 	@ApiOperation(value = "登录用户指定日期待完成任务", notes = "")
 	public R<List<Task>> todayTodo(@RequestParam String date) {
 	public R<List<Task>> todayTodo(@RequestParam String date) {
 		return R.data(taskService.todayTodo(AuthUtil.getUserId(), date));
 		return R.data(taskService.todayTodo(AuthUtil.getUserId(), date));
@@ -268,7 +285,7 @@ public class TaskController {
 	 * 今日逾期
 	 * 今日逾期
 	 */
 	 */
 	@GetMapping("/today-expire-task")
 	@GetMapping("/today-expire-task")
-	@ApiOperationSupport(order = 21)
+	@ApiOperationSupport(order = 22)
 	@ApiOperation(value = "登录用户指定日期逾期任务", notes = "")
 	@ApiOperation(value = "登录用户指定日期逾期任务", notes = "")
 	public R<List<Task>> todayExpire(@RequestParam String date) {
 	public R<List<Task>> todayExpire(@RequestParam String date) {
 		return R.data(taskService.todayExpire(AuthUtil.getUserId(), date));
 		return R.data(taskService.todayExpire(AuthUtil.getUserId(), date));

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileAndFolderHistoryMapper.java

@@ -15,5 +15,5 @@ public interface FileAndFolderHistoryMapper extends BaseMapper<FileAndFolderHist
 	List<FileAndFolderHistory> selectByLatestId(Long bladeFileId);
 	List<FileAndFolderHistory> selectByLatestId(Long bladeFileId);
 
 
 
 
-	List<FileAndFolderHistory> getPage(Long fileId, IPage<FileAndFolderHistory> page);
+	List<FileAndFolderHistory> getPage(String fileId, IPage<FileAndFolderHistory> page);
 }
 }

+ 2 - 2
blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileAndFolderMapper.xml

@@ -5,7 +5,7 @@
 
 
     <select id="selectByStage" resultType="com.wtkj.entity.FileAndFolder">
     <select id="selectByStage" resultType="com.wtkj.entity.FileAndFolder">
         select * from blade_file_and_folder where is_deleted = 0 and parent_id = 0 and stage_id = #{param1}
         select * from blade_file_and_folder where is_deleted = 0 and parent_id = 0 and stage_id = #{param1}
-        order by type desc, is_private
+        order by type desc,create_time desc, is_private
     </select>
     </select>
 
 
     <select id="getFileAmountByFolderId" resultType="java.lang.Integer">
     <select id="getFileAmountByFolderId" resultType="java.lang.Integer">
@@ -30,7 +30,7 @@
 
 
     <select id="selectByParent" resultType="com.wtkj.entity.FileAndFolder">
     <select id="selectByParent" resultType="com.wtkj.entity.FileAndFolder">
         select * from blade_file_and_folder where is_deleted = 0 and parent_id = #{param1}
         select * from blade_file_and_folder where is_deleted = 0 and parent_id = #{param1}
-        order by type desc, is_private
+        order by type desc, create_time desc,is_private
     </select>
     </select>
 
 
     <select id="getChildrenFileList" resultType="com.wtkj.entity.FileAndFolder">
     <select id="getChildrenFileList" resultType="com.wtkj.entity.FileAndFolder">

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileReadMapper.java

@@ -12,7 +12,7 @@ import java.util.Set;
  * @describe
  * @describe
  */
  */
 public interface FileReadMapper extends BaseMapper<FileRead> {
 public interface FileReadMapper extends BaseMapper<FileRead> {
-	List<Long> getReadUser(Long fileId);
+	List<Long> getReadUser(String fileId);
 
 
 	List<FileRead> selectByFileIds(Set<Long> fileIds);
 	List<FileRead> selectByFileIds(Set<Long> fileIds);
 }
 }

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/mapper/ProjectGroupMapper.java

@@ -11,7 +11,7 @@ import java.util.List;
  * @describe
  * @describe
  */
  */
 public interface ProjectGroupMapper extends BaseMapper<ProjectGroup> {
 public interface ProjectGroupMapper extends BaseMapper<ProjectGroup> {
-	List<ProjectGroup> selectGroupByProjectId(Long projectId, Long competentUnit);
+	List<ProjectGroup> selectGroupByStageId(Long stageId);
 
 
 	List<ProjectGroup> selectUserByBeInvitedDept(Long projectId, Long beInvitedDept);
 	List<ProjectGroup> selectUserByBeInvitedDept(Long projectId, Long beInvitedDept);
 }
 }

+ 2 - 2
blade-service/wt-okr/src/main/java/com/wtkj/mapper/ProjectGroupMapper.xml

@@ -3,8 +3,8 @@
 <mapper namespace="com.wtkj.mapper.ProjectGroupMapper">
 <mapper namespace="com.wtkj.mapper.ProjectGroupMapper">
 
 
 
 
-    <select id="selectGroupByProjectId" resultType="com.wtkj.entity.ProjectGroup">
-        select * from blade_project_group where is_deleted = 0 and project_id = #{param1} and invite_dept = #{param2}
+    <select id="selectGroupByStageId" resultType="com.wtkj.entity.ProjectGroup">
+        select * from blade_project_group where is_deleted = 0 and stage_id = #{param}
     </select>
     </select>
 
 
     <select id="selectUserByBeInvitedDept" resultType="com.wtkj.entity.ProjectGroup">
     <select id="selectUserByBeInvitedDept" resultType="com.wtkj.entity.ProjectGroup">

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskContractMapper.java

@@ -17,5 +17,5 @@ public interface TaskContractMapper extends BaseMapper<TaskContract> {
 
 
 	List<TaskContract> getByProjectIds(Set<Long> projectIds);
 	List<TaskContract> getByProjectIds(Set<Long> projectIds);
 
 
-	List<TaskContract> getByOrgDeptId(Long topDept);
+	List<TaskContract> getByOrgDeptId(Long topDept, Integer year, Set<Long> taskIds);
 }
 }

+ 14 - 1
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskContractMapper.xml

@@ -14,6 +14,19 @@
     </select>
     </select>
 
 
     <select id="getByOrgDeptId" resultType="com.wtkj.entity.TaskContract">
     <select id="getByOrgDeptId" resultType="com.wtkj.entity.TaskContract">
-        select * from blade_task_contract where is_deleted = 0 and org_dept_id = #{param} order by create_time desc;
+        select * from blade_task_contract where is_deleted = 0
+        <if test="param1 != null">
+            and org_dept_id = #{param1}
+        </if>
+        <if test="param2 != null">
+            and year = #{param2}
+        </if>
+        <if test="param3 != null">
+            and task_id in
+            <foreach collection="param3" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        order by create_time desc;
     </select>
     </select>
 </mapper>
 </mapper>

+ 2 - 6
blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.java

@@ -12,11 +12,7 @@ import java.util.Set;
  * @describe
  * @describe
  */
  */
 public interface TaskMapper extends BaseMapper<Task> {
 public interface TaskMapper extends BaseMapper<Task> {
-	Set<Long> selectByExecute(Long deptId, String userId);
-
-	Set<Long> selectByUser(String userId);
-
-	Set<Long> selectTodayTask(Long userId, String now);
+	List<Task> selectByExecute(Long deptId, String userId);
 
 
 	List<Task> todayTo(String userId, String date);
 	List<Task> todayTo(String userId, String date);
 
 
@@ -24,7 +20,7 @@ public interface TaskMapper extends BaseMapper<Task> {
 
 
 	List<Task> getTodoAndExpireByUserId(String userId, String date);
 	List<Task> getTodoAndExpireByUserId(String userId, String date);
 
 
-	List<Task> getByOrgDeptId(Long topDept, String date);
+	List<Task> getByDeptAndDate(Long topDept, Long executeDept, String user, String date);
 
 
 	List<Task> getByExecuteDept(Long deptId);
 	List<Task> getByExecuteDept(Long deptId);
 
 

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

@@ -2,8 +2,8 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!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 namespace="com.wtkj.mapper.TaskMapper">
 
 
-    <select id="selectByExecute" resultType="java.lang.Long">
-        select distinct id from blade_task where is_deleted = 0
+    <select id="selectByExecute" resultType="com.wtkj.entity.Task">
+        select * from blade_task where is_deleted = 0
         <if test="param1 != null">
         <if test="param1 != null">
             and org_dept_id = #{param1}
             and org_dept_id = #{param1}
         </if>
         </if>
@@ -12,10 +12,6 @@
         </if>
         </if>
     </select>
     </select>
 
 
-    <select id="selectByUser" resultType="java.lang.Long">
-        select distinct id from blade_task where is_deleted = 0
-        and (execute_user like concat(concat('%',#{param}),'%') or create_user =#{param})
-    </select>
 
 
     <select id="selectTodayTask" resultType="java.lang.Long">
     <select id="selectTodayTask" resultType="java.lang.Long">
         select distinct id from blade_task where is_deleted = 0 and execute_user like concat(concat('%',#{param1}),'%')
         select distinct id from blade_task where is_deleted = 0 and execute_user like concat(concat('%',#{param1}),'%')
@@ -37,10 +33,19 @@
         order by create_time
         order by create_time
     </select>
     </select>
 
 
-    <select id="getByOrgDeptId" resultType="com.wtkj.entity.Task">
-        select * from blade_task where is_deleted = 0 and org_dept_id = #{param1}
+    <select id="getByDeptAndDate" resultType="com.wtkj.entity.Task">
+        select * from blade_task where is_deleted = 0
+        <if test="param1 != null">
+            and org_dept_id = #{param1}
+        </if>
         <if test="param2 != null">
         <if test="param2 != null">
-            and DATE_FORMAT(#{param2},'%Y-%m-%d') >= DATE_FORMAT(end_time,'%Y-%m-%d') and task_status != 4 and
+            and execute_dept = #{param2}
+        </if>
+        <if test="param3 != null">
+            and execute_user like concat(concat('%',#{param3}),'%')
+        </if>
+        <if test="param4 != null">
+            and DATE_FORMAT(#{param3},'%Y-%m-%d') >= DATE_FORMAT(end_time,'%Y-%m-%d') and task_status != 4 and
             task_status != 5
             task_status != 5
         </if>
         </if>
         order by create_time
         order by create_time
@@ -71,6 +76,7 @@
 
 
     <select id="getTodoByYear" resultType="com.wtkj.entity.Task">
     <select id="getTodoByYear" resultType="com.wtkj.entity.Task">
         select * from blade_task where is_deleted = 0 and year = #{param2} and task_status != 4 and task_status != 5 and
         select * from blade_task where is_deleted = 0 and year = #{param2} and task_status != 4 and task_status != 5 and
+        task_status != 6 and
         project_id in
         project_id in
         <foreach collection="param1" index="index" item="item" open="(" separator="," close=")">
         <foreach collection="param1" index="index" item="item" open="(" separator="," close=")">
             #{item}
             #{item}

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/service/IFileAndFolderHistoryService.java

@@ -15,5 +15,5 @@ public interface IFileAndFolderHistoryService extends BaseService<FileAndFolderH
 	List<FileAndFolderHistory> getByLatestId(Long bladeFileId);
 	List<FileAndFolderHistory> getByLatestId(Long bladeFileId);
 
 
 
 
-	IPage<FileAndFolderHistory> getPage(Long fileId, IPage<FileAndFolderHistory> page);
+	IPage<FileAndFolderHistory> getPage(String fileId, IPage<FileAndFolderHistory> page);
 }
 }

+ 5 - 2
blade-service/wt-okr/src/main/java/com/wtkj/service/IFileReadService.java

@@ -2,6 +2,7 @@ package com.wtkj.service;
 
 
 import com.wtkj.entity.FileRead;
 import com.wtkj.entity.FileRead;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.mp.base.BaseService;
+import org.springblade.system.user.entity.User;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Set;
 import java.util.Set;
@@ -14,7 +15,9 @@ import java.util.Set;
 public interface IFileReadService extends BaseService<FileRead> {
 public interface IFileReadService extends BaseService<FileRead> {
 	boolean readFile(FileRead read);
 	boolean readFile(FileRead read);
 
 
-	List<Long> getReadUser(Long fileId);
-
 	List<FileRead> getByFileIds(Set<Long> fileIds);
 	List<FileRead> getByFileIds(Set<Long> fileIds);
+
+	List<User> fileRead(String bladeFileId);
+
+	boolean isRead(String bladeFileId, Long userId);
 }
 }

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/service/IProjectGroupService.java

@@ -11,7 +11,7 @@ import java.util.List;
  * @describe
  * @describe
  */
  */
 public interface IProjectGroupService extends BaseService<ProjectGroup> {
 public interface IProjectGroupService extends BaseService<ProjectGroup> {
-	List<ProjectGroup> getGroupByProjectId(Long projectId, Long competentUnit);
+	List<ProjectGroup> getGroupByStageId(Long stageId);
 
 
 	List<ProjectGroup> getUserByBeInvitedDept(Long projectId, Long beInvitedDept);
 	List<ProjectGroup> getUserByBeInvitedDept(Long projectId, Long beInvitedDept);
 }
 }

+ 4 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/IProjectService.java

@@ -6,6 +6,7 @@ import com.wtkj.entity.Project;
 import com.wtkj.vo.ProjectStatisticsVO;
 import com.wtkj.vo.ProjectStatisticsVO;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.mp.base.BaseService;
 
 
+import java.util.List;
 import java.util.Set;
 import java.util.Set;
 
 
 /**
 /**
@@ -21,4 +22,7 @@ public interface IProjectService extends BaseService<Project> {
 	Set<Long> getByCreate(Long createDept, Long createUser);
 	Set<Long> getByCreate(Long createDept, Long createUser);
 
 
 	ProjectStatisticsVO projectStatistics(Long topDept, Integer deptCategory, String year);
 	ProjectStatisticsVO projectStatistics(Long topDept, Integer deptCategory, String year);
+
+	boolean delete(List<Long> projectIds);
+
 }
 }

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskContractService.java

@@ -17,6 +17,6 @@ public interface ITaskContractService extends BaseService<TaskContract> {
 
 
 	List<TaskContract> getByProjectIds(Set<Long> projectIds);
 	List<TaskContract> getByProjectIds(Set<Long> projectIds);
 
 
-	List<TaskContract> getByOrgDeptId(Long topDept);
+	List<TaskContract> getByDeptIdAndYear(Long topDept, Integer year, Set<Long> taskIds);
 
 
 }
 }

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

@@ -2,6 +2,7 @@ package com.wtkj.service;
 
 
 import com.wtkj.entity.TaskLog;
 import com.wtkj.entity.TaskLog;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.mp.base.BaseService;
+import org.springblade.system.user.entity.User;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -12,4 +13,6 @@ import java.util.List;
  */
  */
 public interface ITaskLogService extends BaseService<TaskLog> {
 public interface ITaskLogService extends BaseService<TaskLog> {
 	List<TaskLog> listByTaskId(Long taskId);
 	List<TaskLog> listByTaskId(Long taskId);
+
+	List<User> getTaskGroupMen(Long id);
 }
 }

+ 3 - 6
blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskService.java

@@ -45,11 +45,7 @@ public interface ITaskService extends BaseService<Task> {
 
 
 	List<Task> listByStageId(Long stageId);
 	List<Task> listByStageId(Long stageId);
 
 
-	Set<Long> getByExecute(Long deptId, String userId);
-
-	Set<Long> getByUser(String userId);
-
-	Set<Long> todayTask(Long deptId);
+	List<Task> getByExecute(Long deptId, String userId);
 
 
 	/**
 	/**
 	 * 用户当日待完成任务
 	 * 用户当日待完成任务
@@ -64,7 +60,7 @@ public interface ITaskService extends BaseService<Task> {
 	/**
 	/**
 	 * 机构下当日待完成的任务和逾期任务列表
 	 * 机构下当日待完成的任务和逾期任务列表
 	 */
 	 */
-	List<Task> getByOrgDeptId(Long topDept, String date);
+	List<Task> getByDeptAndDate(Long topDept, Long executeDept, String user, String date);
 
 
 	/**
 	/**
 	 * 用户当日待完成和逾期的任务
 	 * 用户当日待完成和逾期的任务
@@ -101,4 +97,5 @@ public interface ITaskService extends BaseService<Task> {
 	List<Task> getByExecuteDept(Long deptId);
 	List<Task> getByExecuteDept(Long deptId);
 
 
 	List<Task> getByCompetentUnit(Long deptId);
 	List<Task> getByCompetentUnit(Long deptId);
+
 }
 }

+ 182 - 291
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java

@@ -77,7 +77,7 @@ public class AsyncServiceImpl implements IAsyncService {
 			}
 			}
 		}
 		}
 
 
-		//3.如果主管单位和当前登录用户不是同一机构
+		//权限
 		String deptIdStr = user.getDeptId();
 		String deptIdStr = user.getDeptId();
 		if (deptIdStr != null) {
 		if (deptIdStr != null) {
 			Long deptId = Func.firstLong(deptIdStr);
 			Long deptId = Func.firstLong(deptIdStr);
@@ -89,7 +89,7 @@ public class AsyncServiceImpl implements IAsyncService {
 				if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
 				if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
 					List<Long> parentIds = Func.toLongList(ancestors);
 					List<Long> parentIds = Func.toLongList(ancestors);
 					if (!CollectionUtils.isEmpty(parentIds)) {
 					if (!CollectionUtils.isEmpty(parentIds)) {
-						if (parentIds.size() > 2) {
+						if (parentIds.size() > 1) {
 							auth.setTopDept(parentIds.get(1));
 							auth.setTopDept(parentIds.get(1));
 						} else {
 						} else {
 							auth.setTopDept(Long.valueOf(deptIdStr));
 							auth.setTopDept(Long.valueOf(deptIdStr));
@@ -122,12 +122,11 @@ public class AsyncServiceImpl implements IAsyncService {
 				R<User> userR = userClient.userInfoById(createUser);
 				R<User> userR = userClient.userInfoById(createUser);
 				if (userR.isSuccess()) {
 				if (userR.isSuccess()) {
 					List<TaskLog> logs = new ArrayList<>();
 					List<TaskLog> logs = new ArrayList<>();
-					List<ProjectAuth> auths = new ArrayList<>();
-					List<ProjectGroup> groups = new ArrayList<>();
 
 
 					TaskLog log = new TaskLog();
 					TaskLog log = new TaskLog();
 					log.setTaskId(task.getId());
 					log.setTaskId(task.getId());
 					log.setContent(userR.getData().getName() + " 创建了任务");
 					log.setContent(userR.getData().getName() + " 创建了任务");
+					log.setRelatedUser(String.valueOf(userR.getData().getId()));
 					log.setCreateDept(task.getCreateDept());
 					log.setCreateDept(task.getCreateDept());
 					log.setCreateUser(task.getCreateUser());
 					log.setCreateUser(task.getCreateUser());
 					log.setUpdateUser(task.getUpdateUser());
 					log.setUpdateUser(task.getUpdateUser());
@@ -142,163 +141,31 @@ public class AsyncServiceImpl implements IAsyncService {
 							TaskLog taskLog = new TaskLog();
 							TaskLog taskLog = new TaskLog();
 							taskLog.setTaskId(task.getId());
 							taskLog.setTaskId(task.getId());
 							taskLog.setContent(userR.getData().getName() + " 指定了执行单位为" + dept.getData().getDeptName());
 							taskLog.setContent(userR.getData().getName() + " 指定了执行单位为" + dept.getData().getDeptName());
+							taskLog.setRelatedUser(String.valueOf(userR.getData().getId()));
 							taskLog.setCreateDept(task.getCreateDept());
 							taskLog.setCreateDept(task.getCreateDept());
 							taskLog.setCreateUser(task.getCreateUser());
 							taskLog.setCreateUser(task.getCreateUser());
 							taskLog.setUpdateUser(task.getUpdateUser());
 							taskLog.setUpdateUser(task.getUpdateUser());
 							try {
 							try {
-								Thread.sleep(1000);
+								Thread.sleep(3000);
 							} catch (InterruptedException e) {
 							} catch (InterruptedException e) {
 								System.out.println("休眠异常:" + e.getMessage());
 								System.out.println("休眠异常:" + e.getMessage());
 							}
 							}
 							taskLog.setCreateTime(DateUtil.now());
 							taskLog.setCreateTime(DateUtil.now());
 							taskLog.setUpdateTime(DateUtil.now());
 							taskLog.setUpdateTime(DateUtil.now());
 							logs.add(taskLog);
 							logs.add(taskLog);
-						}
-					}
-					if (task.getExecuteDept() != null && task.getExecuteDept() > 0L) {
-						Long executeDept = task.getExecuteDept();
-						R<Dept> dept = sysClient.getDept(executeDept);
-						if (dept.isSuccess()) {
-							TaskLog taskLog = new TaskLog();
-							taskLog.setTaskId(task.getId());
-							taskLog.setContent(userR.getData().getName() + " 指定了任务执行部门为" + dept.getData().getDeptName());
-							taskLog.setCreateDept(task.getCreateDept());
-							taskLog.setCreateUser(task.getCreateUser());
-							taskLog.setUpdateUser(task.getUpdateUser());
-							taskLog.setCreateTime(DateUtil.now());
-							taskLog.setUpdateTime(DateUtil.now());
-							logs.add(taskLog);
-						}
-					}
-					if (task.getProjectManager() != null && task.getProjectManager() > 0L) {
-						Long projectManager = task.getProjectManager();
-						//1.任务动态
-						R<User> userR1 = userClient.userInfoById(projectManager);
-						if (userR1.isSuccess()) {
-							TaskLog taskLog = new TaskLog();
-							taskLog.setTaskId(task.getId());
-							taskLog.setContent(userR.getData().getName() + " 指定了项目经理为 " + userR1.getData().getName());
-							taskLog.setCreateDept(task.getCreateDept());
-							taskLog.setCreateUser(task.getCreateUser());
-							taskLog.setUpdateUser(task.getUpdateUser());
-							taskLog.setCreateTime(DateUtil.now());
-							taskLog.setUpdateTime(DateUtil.now());
-							logs.add(taskLog);
-
-							String deptStr = userR1.getData().getDeptId();
-							if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
-								//2.项目权限
-								Long deptId = Func.firstLong(deptStr);
-								ProjectAuth auth = new ProjectAuth();
-								auth.setTopDept(orgDeptId);
-								auth.setUserDept(deptId);
-								auth.setProjectId(projectId);
-								auth.setUserId(projectManager);
-								auths.add(auth);
-
-								//3.项目组成员
-								ProjectGroup group = new ProjectGroup();
-								group.setInviteDept(project.getCompetentUnit());
-								group.setProjectId(projectId);
-								group.setStageId(task.getStageId());
-								group.setBeInvitedDept(orgDeptId);
-								group.setUserId(projectManager);
-								groups.add(group);
-							}
 
 
+							ProjectAuth auth = new ProjectAuth();
+							auth.setTopDept(orgDeptId);
+							auth.setProjectId(task.getProjectId());
+							auth.setCreateDept(task.getCreateDept());
+							auth.setCreateUser(task.getCreateUser());
+							auth.setUpdateUser(task.getUpdateUser());
+							auth.setCreateTime(DateUtil.now());
+							auth.setUpdateTime(DateUtil.now());
+							projectAuthService.save(auth);
 						}
 						}
 					}
 					}
-					if (StringUtil.isNotBlank(task.getExecuteUser())) {
-						List<Long> userIds = Func.toLongList(task.getExecuteUser());
-						List<String> str = new ArrayList<>();
-						Long finalOrgDeptId = orgDeptId;
-						userIds.forEach(userId -> {
-							R<User> rpc = userClient.userInfoById(userId);
-							if (rpc.isSuccess()) {
-								str.add(rpc.getData().getName());
-
-								String deptStr = rpc.getData().getDeptId();
-								if (StringUtil.isNotBlank(deptStr) && finalOrgDeptId != null) {
-									Long deptId = Func.firstLong(deptStr);
-									ProjectAuth auth = new ProjectAuth();
-									auth.setTopDept(finalOrgDeptId);
-									auth.setUserDept(deptId);
-									auth.setProjectId(projectId);
-									auth.setUserId(userId);
-									auths.add(auth);
-
-									//项目组成员
-									ProjectGroup group = new ProjectGroup();
-									group.setInviteDept(project.getCompetentUnit());
-									group.setProjectId(projectId);
-									group.setStageId(task.getStageId());
-									group.setBeInvitedDept(finalOrgDeptId);
-									group.setUserId(userId);
-									groups.add(group);
-								}
-							}
-						});
-						if (!CollectionUtils.isEmpty(str)) {
-							TaskLog taskLog = new TaskLog();
-							taskLog.setTaskId(task.getId());
-							taskLog.setContent(userR.getData().getName() + " 指定了任务执行者 " + Func.join(str));
-							taskLog.setCreateDept(task.getCreateDept());
-							taskLog.setCreateUser(task.getCreateUser());
-							taskLog.setUpdateUser(task.getUpdateUser());
-							taskLog.setCreateTime(DateUtil.now());
-							taskLog.setUpdateTime(DateUtil.now());
-							logs.add(taskLog);
-						}
-					}
-
-					/*if (StringUtil.isNotBlank(task.getCheckUser())) {
-						List<Long> userIds = Func.toLongList(task.getCheckUser());
-						List<String> str = new ArrayList<>();
-						Long finalOrgDeptId1 = orgDeptId;
-						userIds.forEach(userId -> {
-							R<User> rpc = userClient.userInfoById(userId);
-							if (rpc.isSuccess()) {
-								str.add(rpc.getData().getName());
-
-								String deptStr = rpc.getData().getDeptId();
-								if (StringUtil.isNotBlank(deptStr) && finalOrgDeptId1 != null) {
-									Long deptId = Func.firstLong(deptStr);
-									ProjectAuth auth = new ProjectAuth();
-									auth.setTopDept(finalOrgDeptId1);
-									auth.setUserDept(deptId);
-									auth.setProjectId(projectId);
-									auth.setUserId(userId);
-									auths.add(auth);
-
-									ProjectGroup group = new ProjectGroup();
-									group.setInviteDept(project.getCompetentUnit());
-									group.setProjectId(projectId);
-									group.setStageId(task.getStageId());
-									group.setBeInvitedDept(finalOrgDeptId1);
-									group.setUserId(userId);
-									groups.add(group);
-								}
-							}
-						});
-						if (!CollectionUtils.isEmpty(str)) {
-							TaskLog taskLog = new TaskLog();
-							taskLog.setTaskId(task.getId());
-							taskLog.setContent(userR.getData().getName() + " 指定了任务审查者 " + Func.join(str));
-							taskLog.setCreateDept(task.getCreateDept());
-							taskLog.setCreateUser(task.getCreateUser());
-							taskLog.setUpdateUser(task.getUpdateUser());
-							taskLog.setCreateTime(DateUtil.now());
-							taskLog.setUpdateTime(DateUtil.now());
-							logs.add(taskLog);
-						}
-					}*/
 					taskLogService.saveBatch(logs);
 					taskLogService.saveBatch(logs);
-					if (!CollectionUtils.isEmpty(auths)) {
-						projectAuthService.saveBatch(auths);
-					}
-					if (!CollectionUtils.isEmpty(groups)) {
-						projectGroupService.saveBatch(groups);
-					}
 				}
 				}
 			}
 			}
 			// todo 2.任务下发通知
 			// todo 2.任务下发通知
@@ -315,172 +182,180 @@ public class AsyncServiceImpl implements IAsyncService {
 			List<ProjectGroup> groups = new ArrayList<>();
 			List<ProjectGroup> groups = new ArrayList<>();
 
 
 			Long orgDeptId = task.getOrgDeptId();
 			Long orgDeptId = task.getOrgDeptId();
-			switch (type) {
-				case 1:
-					R<Dept> dept = sysClient.getDept(orgDeptId);
-					if (dept.isSuccess()) {
-						TaskLog log = new TaskLog();
-						log.setTaskId(task.getId());
-						log.setContent(userR.getData().getName() + " 指定了执行单位为" + dept.getData().getDeptName());
-						log.setCreateDept(task.getCreateDept());
-						log.setCreateUser(task.getCreateUser());
-						log.setUpdateUser(task.getUpdateUser());
-						log.setCreateTime(DateUtil.now());
-						log.setUpdateTime(DateUtil.now());
-						logs.add(log);
+			if (type == 1) {
+				R<Dept> dept = sysClient.getDept(orgDeptId);
+				if (dept.isSuccess()) {
+					TaskLog log = new TaskLog();
+					log.setTaskId(task.getId());
+					log.setContent(userR.getData().getName() + " 指定了执行单位为" + dept.getData().getDeptName());
+					log.setRelatedUser(String.valueOf(userR.getData().getId()));
+					log.setCreateDept(task.getCreateDept());
+					log.setCreateUser(task.getCreateUser());
+					log.setUpdateUser(task.getUpdateUser());
+					log.setCreateTime(DateUtil.now());
+					log.setUpdateTime(DateUtil.now());
+					logs.add(log);
 
 
+					ProjectAuth auth = new ProjectAuth();
+					auth.setTopDept(orgDeptId);
+					auth.setProjectId(task.getProjectId());
+					auths.add(auth);
+				}
+			} else if (type == 2) {
+				Long executeDept = task.getExecuteDept();
+				R<Dept> dept1 = sysClient.getDept(executeDept);
+				if (dept1.isSuccess()) {
+					TaskLog log1 = new TaskLog();
+					log1.setTaskId(task.getId());
+					log1.setContent(userR.getData().getName() + " 指定了任务执行部门为" + dept1.getData().getDeptName());
+					log1.setRelatedUser(String.valueOf(userR.getData().getId()));
+					log1.setCreateDept(task.getCreateDept());
+					log1.setCreateUser(task.getCreateUser());
+					log1.setUpdateUser(task.getUpdateUser());
+					log1.setCreateTime(DateUtil.now());
+					log1.setUpdateTime(DateUtil.now());
+					logs.add(log1);
+
+					ProjectAuth auth = new ProjectAuth();
+					auth.setTopDept(orgDeptId);
+					auth.setUserDept(executeDept);
+					auth.setProjectId(task.getProjectId());
+					auths.add(auth);
+				}
+			} else if (type == 3) {
+				Long projectManager = task.getProjectManager();
+				R<User> userR1 = userClient.userInfoById(projectManager);
+				if (userR1.isSuccess()) {
+					TaskLog log2 = new TaskLog();
+					log2.setTaskId(task.getId());
+					log2.setContent(userR.getData().getName() + " 指定了项目经理为 " + userR1.getData().getName());
+					List<Long> users = new ArrayList<>();
+					users.add(userR.getData().getId());
+					users.add(userR1.getData().getId());
+					log2.setRelatedUser(Func.join(users));
+					log2.setCreateDept(task.getCreateDept());
+					log2.setCreateUser(task.getCreateUser());
+					log2.setUpdateUser(task.getUpdateUser());
+					log2.setCreateTime(DateUtil.now());
+					log2.setUpdateTime(DateUtil.now());
+					logs.add(log2);
+
+					String deptStr = userR1.getData().getDeptId();
+					if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
+						//项目权限
+						Long deptId = Func.firstLong(deptStr);
 						ProjectAuth auth = new ProjectAuth();
 						ProjectAuth auth = new ProjectAuth();
 						auth.setTopDept(orgDeptId);
 						auth.setTopDept(orgDeptId);
+						auth.setUserDept(deptId);
 						auth.setProjectId(task.getProjectId());
 						auth.setProjectId(task.getProjectId());
+						auth.setUserId(projectManager);
 						auths.add(auth);
 						auths.add(auth);
-					}
-					break;
-				case 2:
-					Long executeDept = task.getExecuteDept();
-					R<Dept> dept1 = sysClient.getDept(executeDept);
-					if (dept1.isSuccess()) {
-						TaskLog log1 = new TaskLog();
-						log1.setTaskId(task.getId());
-						log1.setContent(userR.getData().getName() + " 指定了任务执行部门为" + dept1.getData().getDeptName());
-						log1.setCreateDept(task.getCreateDept());
-						log1.setCreateUser(task.getCreateUser());
-						log1.setUpdateUser(task.getUpdateUser());
-						log1.setCreateTime(DateUtil.now());
-						log1.setUpdateTime(DateUtil.now());
-						logs.add(log1);
 
 
-						ProjectAuth auth = new ProjectAuth();
-						auth.setTopDept(orgDeptId);
-						auth.setUserDept(executeDept);
-						auth.setProjectId(task.getProjectId());
-						auths.add(auth);
+						//项目组
+						ProjectGroup group = new ProjectGroup();
+						group.setInviteDept(null);
+						group.setProjectId(task.getProjectId());
+						group.setStageId(task.getStageId());
+						group.setBeInvitedDept(orgDeptId);
+						group.setUserId(projectManager);
+						groups.add(group);
 					}
 					}
-					break;
-				case 3:
-					Long projectManager = task.getProjectManager();
-					R<User> userR1 = userClient.userInfoById(projectManager);
-					if (userR1.isSuccess()) {
-						TaskLog log2 = new TaskLog();
-						log2.setTaskId(task.getId());
-						log2.setContent(userR.getData().getName() + " 指定了项目经理为 " + userR1.getData().getName());
-						log2.setCreateDept(task.getCreateDept());
-						log2.setCreateUser(task.getCreateUser());
-						log2.setUpdateUser(task.getUpdateUser());
-						log2.setCreateTime(DateUtil.now());
-						log2.setUpdateTime(DateUtil.now());
-						logs.add(log2);
-
-						String deptStr = userR1.getData().getDeptId();
+				}
+			} else if (type == 4) {
+				List<Long> userIds = Func.toLongList(task.getExecuteUser());
+				List<String> str = new ArrayList<>();
+				userIds.forEach(id -> {
+					R<User> rpc = userClient.userInfoById(id);
+					if (rpc.isSuccess()) {
+						str.add(rpc.getData().getName());
+
+						String deptStr = rpc.getData().getDeptId();
 						if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
 						if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
-							//项目权限
 							Long deptId = Func.firstLong(deptStr);
 							Long deptId = Func.firstLong(deptStr);
 							ProjectAuth auth = new ProjectAuth();
 							ProjectAuth auth = new ProjectAuth();
 							auth.setTopDept(orgDeptId);
 							auth.setTopDept(orgDeptId);
 							auth.setUserDept(deptId);
 							auth.setUserDept(deptId);
 							auth.setProjectId(task.getProjectId());
 							auth.setProjectId(task.getProjectId());
-							auth.setUserId(projectManager);
+							auth.setUserId(id);
 							auths.add(auth);
 							auths.add(auth);
 
 
-							//项目组
 							ProjectGroup group = new ProjectGroup();
 							ProjectGroup group = new ProjectGroup();
 							group.setInviteDept(null);
 							group.setInviteDept(null);
 							group.setProjectId(task.getProjectId());
 							group.setProjectId(task.getProjectId());
 							group.setStageId(task.getStageId());
 							group.setStageId(task.getStageId());
 							group.setBeInvitedDept(orgDeptId);
 							group.setBeInvitedDept(orgDeptId);
-							group.setUserId(projectManager);
+							group.setUserId(id);
 							groups.add(group);
 							groups.add(group);
 						}
 						}
 					}
 					}
-					break;
-				case 4:
-					List<Long> userIds = Func.toLongList(task.getExecuteUser());
-					List<String> str = new ArrayList<>();
-					userIds.forEach(id -> {
-						R<User> rpc = userClient.userInfoById(id);
-						if (rpc.isSuccess()) {
-							str.add(rpc.getData().getName());
-
-							String deptStr = rpc.getData().getDeptId();
-							if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
-								Long deptId = Func.firstLong(deptStr);
-								ProjectAuth auth = new ProjectAuth();
-								auth.setTopDept(orgDeptId);
-								auth.setUserDept(deptId);
-								auth.setProjectId(task.getProjectId());
-								auth.setUserId(id);
-								auths.add(auth);
-
-								ProjectGroup group = new ProjectGroup();
-								group.setInviteDept(null);
-								group.setProjectId(task.getProjectId());
-								group.setStageId(task.getStageId());
-								group.setBeInvitedDept(orgDeptId);
-								group.setUserId(id);
-								groups.add(group);
-							}
-						}
-					});
-					if (!CollectionUtils.isEmpty(str)) {
-						TaskLog log3 = new TaskLog();
-						log3.setTaskId(task.getId());
-						log3.setContent(userR.getData().getName() + " 指定了任务执行者 " + Func.join(str));
-						log3.setCreateDept(task.getCreateDept());
-						log3.setCreateUser(task.getCreateUser());
-						log3.setUpdateUser(task.getUpdateUser());
-						log3.setCreateTime(DateUtil.now());
-						log3.setUpdateTime(DateUtil.now());
-						logs.add(log3);
-					}
-					break;
-				case 5:
-					Long first = task.getFirstCheckUser();
-					Long second = task.getSecondCheckUser();
-					List<Long> checkUsers = Arrays.asList(first, second);
-					List<String> checks = new ArrayList<>();
-					checkUsers.forEach(id -> {
-						R<User> rpc = userClient.userInfoById(id);
-						if (rpc.isSuccess()) {
-							checks.add(rpc.getData().getName());
-
-							String deptStr = rpc.getData().getDeptId();
-							if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
-								Long deptId = Func.firstLong(deptStr);
-								ProjectAuth auth = new ProjectAuth();
-								auth.setTopDept(orgDeptId);
-								auth.setUserDept(deptId);
-								auth.setProjectId(task.getProjectId());
-								auth.setUserId(id);
-								auths.add(auth);
-
-								ProjectGroup group = new ProjectGroup();
-								group.setInviteDept(null);
-								group.setProjectId(task.getProjectId());
-								group.setStageId(task.getStageId());
-								group.setBeInvitedDept(orgDeptId);
-								group.setUserId(id);
-								groups.add(group);
-							}
+				});
+				if (!CollectionUtils.isEmpty(str)) {
+					TaskLog log3 = new TaskLog();
+					log3.setTaskId(task.getId());
+					log3.setContent(userR.getData().getName() + " 指定了任务执行者 " + Func.join(str));
+					List<Long> users = new ArrayList<>();
+					users.add(userR.getData().getId());
+					users.addAll(userIds);
+					log3.setRelatedUser(Func.join(users));
+					log3.setCreateDept(task.getCreateDept());
+					log3.setCreateUser(task.getCreateUser());
+					log3.setUpdateUser(task.getUpdateUser());
+					log3.setCreateTime(DateUtil.now());
+					log3.setUpdateTime(DateUtil.now());
+					logs.add(log3);
+				}
+			} else if (type == 5) {
+				Long first = task.getFirstCheckUser();
+				Long second = task.getSecondCheckUser();
+				List<Long> checkUsers = Arrays.asList(first, second);
+				List<String> checks = new ArrayList<>();
+				checkUsers.forEach(id -> {
+					R<User> rpc = userClient.userInfoById(id);
+					if (rpc.isSuccess()) {
+						checks.add(rpc.getData().getName());
+
+						String deptStr = rpc.getData().getDeptId();
+						if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
+							Long deptId = Func.firstLong(deptStr);
+							ProjectAuth auth = new ProjectAuth();
+							auth.setTopDept(orgDeptId);
+							auth.setUserDept(deptId);
+							auth.setProjectId(task.getProjectId());
+							auth.setUserId(id);
+							auths.add(auth);
+
+							ProjectGroup group = new ProjectGroup();
+							group.setInviteDept(null);
+							group.setProjectId(task.getProjectId());
+							group.setStageId(task.getStageId());
+							group.setBeInvitedDept(orgDeptId);
+							group.setUserId(id);
+							groups.add(group);
 						}
 						}
-					});
-					if (!CollectionUtils.isEmpty(checks)) {
-						TaskLog log4 = new TaskLog();
-						log4.setTaskId(task.getId());
-						log4.setContent(userR.getData().getName() + " 指定了任务审查者 " + Func.join(checks));
-						log4.setCreateDept(task.getCreateDept());
-						log4.setCreateUser(task.getCreateUser());
-						log4.setUpdateUser(task.getUpdateUser());
-						log4.setCreateTime(DateUtil.now());
-						log4.setUpdateTime(DateUtil.now());
-						logs.add(log4);
 					}
 					}
-					break;
-				case 6:
-					// todo 提交任务
-					break;
-				case 7:
-					//确认任务
-					break;
+				});
+				if (!CollectionUtils.isEmpty(checks)) {
+					TaskLog log4 = new TaskLog();
+					log4.setTaskId(task.getId());
+					log4.setContent(userR.getData().getName() + " 指定了任务审查者 " + Func.join(checks));
+					List<Long> users = new ArrayList<>();
+					users.add(userR.getData().getId());
+					users.addAll(checkUsers);
+					log4.setRelatedUser(Func.join(users));
+
+					log4.setCreateDept(task.getCreateDept());
+					log4.setCreateUser(task.getCreateUser());
+					log4.setUpdateUser(task.getUpdateUser());
+					log4.setCreateTime(DateUtil.now());
+					log4.setUpdateTime(DateUtil.now());
+					logs.add(log4);
+				}
+			} else if (type == 6) {
+				//todo  提交、确认任务
+			} else if (type == 7) {
+
 			}
 			}
+
 			taskLogService.saveBatch(logs);
 			taskLogService.saveBatch(logs);
 			if (!CollectionUtils.isEmpty(auths)) {
 			if (!CollectionUtils.isEmpty(auths)) {
 				projectAuthService.saveBatch(auths);
 				projectAuthService.saveBatch(auths);
@@ -494,15 +369,17 @@ public class AsyncServiceImpl implements IAsyncService {
 	@Override
 	@Override
 	@Async("asyncPoolTaskExecutor")
 	@Async("asyncPoolTaskExecutor")
 	public void submitTaskMessage(Long userId, Task task) {
 	public void submitTaskMessage(Long userId, Task task) {
-		Long createUser = task.getCreateUser();
+		Long firstCheckUser = task.getFirstCheckUser();
+		Long secondCheckUser = task.getSecondCheckUser();
+
 		Long projectId = task.getProjectId();
 		Long projectId = task.getProjectId();
 		String title = task.getTitle();
 		String title = task.getTitle();
 		R<User> userR = userClient.userInfoById(userId);
 		R<User> userR = userClient.userInfoById(userId);
 		if (userR.isSuccess()) {
 		if (userR.isSuccess()) {
+			List<IndexMessage> list = new ArrayList<>();
 			IndexMessage message = new IndexMessage();
 			IndexMessage message = new IndexMessage();
 			message.setCategory(1);
 			message.setCategory(1);
-			//发送给审查人和项目经理
-			message.setToUser(createUser);
+			message.setToUser(firstCheckUser);
 			message.setContent(userR.getData().getName() + "上传了" + title + "任务的文件,请查阅");
 			message.setContent(userR.getData().getName() + "上传了" + title + "任务的文件,请查阅");
 			message.setOpenUrl("/task");
 			message.setOpenUrl("/task");
 			message.setCreateDept(task.getCreateDept());
 			message.setCreateDept(task.getCreateDept());
@@ -510,7 +387,21 @@ public class AsyncServiceImpl implements IAsyncService {
 			message.setUpdateUser(userId);
 			message.setUpdateUser(userId);
 			message.setCreateTime(DateUtil.now());
 			message.setCreateTime(DateUtil.now());
 			message.setUpdateTime(DateUtil.now());
 			message.setUpdateTime(DateUtil.now());
-			indexMessageService.save(message);
+			list.add(message);
+
+			IndexMessage msg = new IndexMessage();
+			msg.setCategory(1);
+			msg.setToUser(secondCheckUser);
+			msg.setContent(userR.getData().getName() + "上传了" + title + "任务的文件,请查阅");
+			msg.setOpenUrl("/task");
+			msg.setCreateDept(task.getCreateDept());
+			msg.setCreateUser(userId);
+			msg.setUpdateUser(userId);
+			msg.setCreateTime(DateUtil.now());
+			msg.setUpdateTime(DateUtil.now());
+			list.add(msg);
+
+			indexMessageService.saveBatch(list);
 		}
 		}
 	}
 	}
 
 

+ 14 - 6
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/CommonServiceImpl.java

@@ -116,6 +116,7 @@ public class CommonServiceImpl implements ICommonService {
 				if (rpc.isSuccess()) {
 				if (rpc.isSuccess()) {
 					//是否存在同名文件
 					//是否存在同名文件
 					LambdaQueryWrapper<FileAndFolder> lqw = Wrappers.lambdaQuery();
 					LambdaQueryWrapper<FileAndFolder> lqw = Wrappers.lambdaQuery();
+					lqw.eq(FileAndFolder::getStageId, stageId);
 					lqw.eq(FileAndFolder::getParentId, parentId);
 					lqw.eq(FileAndFolder::getParentId, parentId);
 					lqw.eq(FileAndFolder::getTitle, rpc.getData().getOriginalFileName());
 					lqw.eq(FileAndFolder::getTitle, rpc.getData().getOriginalFileName());
 					FileAndFolder old = fileAndFolderService.getOne(lqw);
 					FileAndFolder old = fileAndFolderService.getOne(lqw);
@@ -125,19 +126,20 @@ public class CommonServiceImpl implements ICommonService {
 						//先根据旧的fileId判断是否存在历史记录
 						//先根据旧的fileId判断是否存在历史记录
 						List<FileAndFolderHistory> hisList = historyService.getByLatestId(old.getBladeFileId());
 						List<FileAndFolderHistory> hisList = historyService.getByLatestId(old.getBladeFileId());
 						if (!CollectionUtils.isEmpty(hisList)) {
 						if (!CollectionUtils.isEmpty(hisList)) {
-							histories.forEach(h -> {
-								h.setLatestId(fileId);
+							hisList.forEach(h -> {
+								h.setLatestId(String.valueOf(fileId));
 								histories.add(h);
 								histories.add(h);
 							});
 							});
 						}
 						}
 						//历史文件和新上传文件不是同一个的时候才保存
 						//历史文件和新上传文件不是同一个的时候才保存
 						if (!fileId.equals(old.getBladeFileId())) {
 						if (!fileId.equals(old.getBladeFileId())) {
 							FileAndFolderHistory his = new FileAndFolderHistory();
 							FileAndFolderHistory his = new FileAndFolderHistory();
-							his.setLatestId(fileId);
-							his.setHistoryId(old.getBladeFileId());
-							hisList.add(his);
+							his.setLatestId(String.valueOf(fileId));
+							his.setHistoryId(String.valueOf(old.getBladeFileId()));
+							histories.add(his);
 						}
 						}
 						old.setBladeFileId(fileId);
 						old.setBladeFileId(fileId);
+						fileList.add(old);
 					} else {
 					} else {
 						FileAndFolder newFile = new FileAndFolder();
 						FileAndFolder newFile = new FileAndFolder();
 						newFile.setProjectId(projectId);
 						newFile.setProjectId(projectId);
@@ -386,9 +388,15 @@ public class CommonServiceImpl implements ICommonService {
 						List<Long> longList = Func.toLongList(ancestors);
 						List<Long> longList = Func.toLongList(ancestors);
 						if (!CollectionUtils.isEmpty(longList)) {
 						if (!CollectionUtils.isEmpty(longList)) {
 							if (longList.size() > 1) {
 							if (longList.size() > 1) {
-								userInfo.setTopDept(longList.get(1));
+								Long deptId = longList.get(1);
+								userInfo.setTopDept(deptId);
+								R<Dept> dept = sysClient.getDept(deptId);
+								if (dept.isSuccess()) {
+									userInfo.setTopDeptName(dept.getData().getDeptName());
+								}
 							} else {
 							} else {
 								userInfo.setTopDept(Long.valueOf(deptIdStr));
 								userInfo.setTopDept(Long.valueOf(deptIdStr));
+								userInfo.setTopDeptName(rpc.getData().getDeptName());
 							}
 							}
 						}
 						}
 					}
 					}

+ 3 - 1
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ContactOuterServiceImpl.java

@@ -8,6 +8,7 @@ import com.wtkj.service.IContactOuterService;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.tool.api.R;
 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.Func;
 import org.springblade.system.entity.Role;
 import org.springblade.system.entity.Role;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.feign.ISysClient;
@@ -18,6 +19,7 @@ import org.springframework.util.CollectionUtils;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
+import java.util.Objects;
 
 
 /**
 /**
  * @author Blizzard
  * @author Blizzard
@@ -48,7 +50,7 @@ public class ContactOuterServiceImpl extends BaseServiceImpl<ContactOuterMapper,
 		Long roleId = dto.getNewRoleId();
 		Long roleId = dto.getNewRoleId();
 		R<User> userR = userClient.userInfoById(userId);
 		R<User> userR = userClient.userInfoById(userId);
 		if (userR.isSuccess() && userR.getData() != null) {
 		if (userR.isSuccess() && userR.getData() != null) {
-			User user = userR.getData();
+			User user = Objects.requireNonNull(BeanUtil.copy(dto, User.class));
 			if (roleId != null) {
 			if (roleId != null) {
 				String roleStr = userR.getData().getRoleId();
 				String roleStr = userR.getData().getRoleId();
 				List<Long> roleList = Func.toLongList(roleStr);
 				List<Long> roleList = Func.toLongList(roleStr);

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

@@ -24,7 +24,7 @@ public class FileAndFolderHistoryServiceImpl extends BaseServiceImpl<FileAndFold
 	}
 	}
 
 
 	@Override
 	@Override
-	public IPage<FileAndFolderHistory> getPage(Long fileId, IPage<FileAndFolderHistory> page) {
+	public IPage<FileAndFolderHistory> getPage(String fileId, IPage<FileAndFolderHistory> page) {
 		return page.setRecords(baseMapper.getPage(fileId, page));
 		return page.setRecords(baseMapper.getPage(fileId, page));
 	}
 	}
 
 

+ 33 - 4
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/FileReadServiceImpl.java

@@ -1,15 +1,22 @@
 package com.wtkj.service.impl;
 package com.wtkj.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.wtkj.entity.FileRead;
 import com.wtkj.entity.FileRead;
 import com.wtkj.mapper.FileReadMapper;
 import com.wtkj.mapper.FileReadMapper;
 import com.wtkj.service.IFileReadService;
 import com.wtkj.service.IFileReadService;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Set;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * @author Blizzard
  * @author Blizzard
@@ -19,6 +26,9 @@ import java.util.Set;
 @Service
 @Service
 @AllArgsConstructor
 @AllArgsConstructor
 public class FileReadServiceImpl extends BaseServiceImpl<FileReadMapper, FileRead> implements IFileReadService {
 public class FileReadServiceImpl extends BaseServiceImpl<FileReadMapper, FileRead> implements IFileReadService {
+
+	private final IUserClient userClient;
+
 	@Override
 	@Override
 	public boolean readFile(FileRead read) {
 	public boolean readFile(FileRead read) {
 		read.setUserId(AuthUtil.getUserId());
 		read.setUserId(AuthUtil.getUserId());
@@ -26,12 +36,31 @@ public class FileReadServiceImpl extends BaseServiceImpl<FileReadMapper, FileRea
 	}
 	}
 
 
 	@Override
 	@Override
-	public List<Long> getReadUser(Long fileId) {
-		return baseMapper.getReadUser(fileId);
+	public List<FileRead> getByFileIds(Set<Long> fileIds) {
+		return baseMapper.selectByFileIds(fileIds);
 	}
 	}
 
 
 	@Override
 	@Override
-	public List<FileRead> getByFileIds(Set<Long> fileIds) {
-		return baseMapper.selectByFileIds(fileIds);
+	public List<User> fileRead(String bladeFileId) {
+		List<User> res = new ArrayList<>();
+		List<Long> userIds = baseMapper.getReadUser(bladeFileId);
+		if (!CollectionUtils.isEmpty(userIds)) {
+			Set<User> users = userIds.stream().map(userClient::userInfoById).filter(userR1 -> userR1.isSuccess()).map(R::getData).collect(Collectors.toSet());
+			res.addAll(users);
+		}
+		return res;
+	}
+
+	@Override
+	public boolean isRead(String bladeFileId, Long userId) {
+		boolean flag = false;
+		LambdaQueryWrapper<FileRead> lqw = new LambdaQueryWrapper<>();
+		lqw.eq(FileRead::getBladeFileId, bladeFileId);
+		lqw.eq(FileRead::getUserId, userId);
+		List<FileRead> list = this.list(lqw);
+		if (!CollectionUtils.isEmpty(list)) {
+			flag = true;
+		}
+		return flag;
 	}
 	}
 }
 }

+ 2 - 2
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ITaskContractServiceImpl.java

@@ -31,7 +31,7 @@ public class ITaskContractServiceImpl extends BaseServiceImpl<TaskContractMapper
 	}
 	}
 
 
 	@Override
 	@Override
-	public List<TaskContract> getByOrgDeptId(Long topDept) {
-		return baseMapper.getByOrgDeptId(topDept);
+	public List<TaskContract> getByDeptIdAndYear(Long topDept, Integer year, Set<Long> taskIds) {
+		return baseMapper.getByOrgDeptId(topDept, year, taskIds);
 	}
 	}
 }
 }

+ 35 - 44
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/IndexServiceImpl.java

@@ -3,17 +3,16 @@ package com.wtkj.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.wtkj.entity.IndexMessage;
 import com.wtkj.entity.IndexMessage;
+import com.wtkj.entity.ProjectAuth;
 import com.wtkj.entity.Task;
 import com.wtkj.entity.Task;
-import com.wtkj.service.IIndexMessageService;
-import com.wtkj.service.IIndexService;
-import com.wtkj.service.IProjectService;
-import com.wtkj.service.ITaskService;
+import com.wtkj.service.*;
 import com.wtkj.vo.IndexProjectAndTaskSummaryVO;
 import com.wtkj.vo.IndexProjectAndTaskSummaryVO;
 import com.wtkj.vo.MyIndexTaskStatistics;
 import com.wtkj.vo.MyIndexTaskStatistics;
 import com.wtkj.vo.ScheduleUserVO;
 import com.wtkj.vo.ScheduleUserVO;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.entity.User;
@@ -22,6 +21,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
 
 
 import java.util.*;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 import static com.wtkj.config.MagicValue.*;
 import static com.wtkj.config.MagicValue.*;
 
 
@@ -38,47 +38,40 @@ public class IndexServiceImpl implements IIndexService {
 	private final IProjectService projectService;
 	private final IProjectService projectService;
 	private final IIndexMessageService indexMessageService;
 	private final IIndexMessageService indexMessageService;
 	private final IUserClient userClient;
 	private final IUserClient userClient;
+	private final IProjectAuthService projectAuthService;
 
 
 	@Override
 	@Override
 	public IndexProjectAndTaskSummaryVO projectAndTaskSummary(Long topDept) {
 	public IndexProjectAndTaskSummaryVO projectAndTaskSummary(Long topDept) {
 		IndexProjectAndTaskSummaryVO vo = new IndexProjectAndTaskSummaryVO();
 		IndexProjectAndTaskSummaryVO vo = new IndexProjectAndTaskSummaryVO();
 		Long userId = AuthUtil.getUserId();
 		Long userId = AuthUtil.getUserId();
-		//1.全部项目 ---> 机构自己建的,任务执行机构是机构
-		Set<Long> allIds = new HashSet<>();
-		Set<Long> createIds = projectService.getByCreate(topDept, null);
-		if (!CollectionUtils.isEmpty(createIds)) {
-			allIds.addAll(createIds);
+		//1.全部项目数量 ---> 权限表下 topDept是 参数topDept
+		List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(topDept, null, null);
+		if (!CollectionUtils.isEmpty(auths)) {
+			Set<Long> collect = auths.stream().map(ProjectAuth::getProjectId).collect(Collectors.toSet());
+			vo.setProjectCount(collect.size());
 		}
 		}
-		//任务执行机构是机构 也是任务数
-		Set<Long> executeIds = taskService.getByExecute(topDept, null);
-		if (!CollectionUtils.isEmpty(executeIds)) {
-			allIds.addAll(executeIds);
-			//3.项目任务总数  --->执行机构是我的顶级id
-			vo.setTaskCount(executeIds.size());
-		}
-		if (!CollectionUtils.isEmpty(allIds)) {
-			vo.setProjectCount(allIds.size());
-		}
-		//2.我参与的项目 ---> 我建的,任务我执行的或者任务我建的
-		Set<Long> myIds = new HashSet<>();
-		Set<Long> myCreate = projectService.getByCreate(null, userId);
-		if (!CollectionUtils.isEmpty(myCreate)) {
-			myIds.addAll(myCreate);
-		}
-		Set<Long> myExecute = taskService.getByUser(String.valueOf(userId));
-		if (!CollectionUtils.isEmpty(myExecute)) {
-			myIds.addAll(myExecute);
+
+		//2.我参与的项目 ---> 权限表下user_id
+		List<ProjectAuth> userAuth = projectAuthService.getByDeptAndUser(null, null, userId);
+		if (!CollectionUtils.isEmpty(userAuth)) {
+			Set<Long> collect = userAuth.stream().map(ProjectAuth::getProjectId).collect(Collectors.toSet());
+			vo.setMyProjectCount(collect.size());
 		}
 		}
-		if (!CollectionUtils.isEmpty(myIds)) {
-			vo.setMyProjectCount(myIds.size());
+
+		// 3. 机构下的任务总数  -->执行单位是topdept
+		List<Task> tasks = taskService.getByExecute(topDept, null);
+		if (!CollectionUtils.isEmpty(tasks)) {
+			vo.setTaskCount(tasks.size());
 		}
 		}
-		//4.我的任务数  我执行的
-		Set<Long> myTask = taskService.getByExecute(null, String.valueOf(userId));
-		if (!CollectionUtils.isEmpty(myTask)) {
-			vo.setMyTaskCount(myTask.size());
+
+		//4.我的任务  ---> 执行人是userid
+		List<Task> byExecute = taskService.getByExecute(null, String.valueOf(userId));
+		if (!CollectionUtils.isEmpty(byExecute)) {
+			vo.setMyTaskCount(byExecute.size());
 		}
 		}
-		//5.今日任务数
-		Set<Long> todayTask = taskService.todayTask(userId);
+		//5.我的今日任务数 ---> 截至日期是今天且未完成的和未取消的任务
+		String now = DateUtil.format(new Date(), "yyyy-MM-dd");
+		List<Task> todayTask = taskService.todayTodo(userId, now);
 		if (!CollectionUtils.isEmpty(todayTask)) {
 		if (!CollectionUtils.isEmpty(todayTask)) {
 			vo.setTodayTask(todayTask.size());
 			vo.setTodayTask(todayTask.size());
 		}
 		}
@@ -123,12 +116,12 @@ public class IndexServiceImpl implements IIndexService {
 		List<ScheduleUserVO> result = new ArrayList<>();
 		List<ScheduleUserVO> result = new ArrayList<>();
 		Set<Long> res = new HashSet<>();
 		Set<Long> res = new HashSet<>();
 		String roleName = AuthUtil.getUserRole();
 		String roleName = AuthUtil.getUserRole();
-		String deptId = AuthUtil.getDeptId();
 		Long userId = AuthUtil.getUserId();
 		Long userId = AuthUtil.getUserId();
+		String deptId = AuthUtil.getDeptId();
 		if (roleName != null) {
 		if (roleName != null) {
 			if (roleName.contains(STAFF_ADMIN)) {
 			if (roleName.contains(STAFF_ADMIN)) {
 				//如果是机构管理员 ---> 可以查看机构下的待完成的和逾期的任务
 				//如果是机构管理员 ---> 可以查看机构下的待完成的和逾期的任务
-				List<Task> list = taskService.getByOrgDeptId(topDept, date);
+				List<Task> list = taskService.getByDeptAndDate(topDept, null, null, date);
 				if (!CollectionUtils.isEmpty(list)) {
 				if (!CollectionUtils.isEmpty(list)) {
 					for (Task task : list) {
 					for (Task task : list) {
 						String executeUser = task.getExecuteUser();
 						String executeUser = task.getExecuteUser();
@@ -139,18 +132,16 @@ public class IndexServiceImpl implements IIndexService {
 					}
 					}
 				}
 				}
 			} else if (roleName.contains(STAFF_SECOND_ADMIN)) {
 			} else if (roleName.contains(STAFF_SECOND_ADMIN)) {
-				//todo  二级管理员处理
-				//如果是二级管理员 ---> 可以查看二级部门下的人的所有任务
-				/*List<Task> list = taskService.getByExecuteDept(deptId,date);
+				List<Task> list = taskService.getByDeptAndDate(null, Long.valueOf(deptId), null, null);
 				if (!CollectionUtils.isEmpty(list)){
 				if (!CollectionUtils.isEmpty(list)){
-					for (Task task : list){
+					for (Task task : list) {
 						String executeUser = task.getExecuteUser();
 						String executeUser = task.getExecuteUser();
-						if (StringUtil.isNotBlank(executeUser)){
+						if (StringUtil.isNotBlank(executeUser)) {
 							List<Long> userIds = Func.toLongList(executeUser);
 							List<Long> userIds = Func.toLongList(executeUser);
 							res.addAll(userIds);
 							res.addAll(userIds);
 						}
 						}
 					}
 					}
-				}*/
+				}
 			} else if (roleName.contains(STAFF_USER)) {
 			} else if (roleName.contains(STAFF_USER)) {
 				res.add(userId);
 				res.add(userId);
 			}
 			}

+ 2 - 2
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ProjectGroupServiceImpl.java

@@ -23,9 +23,9 @@ import java.util.stream.Collectors;
 @Service
 @Service
 public class ProjectGroupServiceImpl extends BaseServiceImpl<ProjectGroupMapper, ProjectGroup> implements IProjectGroupService {
 public class ProjectGroupServiceImpl extends BaseServiceImpl<ProjectGroupMapper, ProjectGroup> implements IProjectGroupService {
 	@Override
 	@Override
-	public List<ProjectGroup> getGroupByProjectId(Long projectId, Long competentUnit) {
+	public List<ProjectGroup> getGroupByStageId(Long stageId) {
 		List<ProjectGroup> res = new ArrayList<>();
 		List<ProjectGroup> res = new ArrayList<>();
-		List<ProjectGroup> list = baseMapper.selectGroupByProjectId(projectId, competentUnit);
+		List<ProjectGroup> list = baseMapper.selectGroupByStageId(stageId);
 		//机构去重
 		//机构去重
 		if (!CollectionUtil.isEmpty(list)) {
 		if (!CollectionUtil.isEmpty(list)) {
 			res = list.stream().collect(
 			res = list.stream().collect(

+ 140 - 43
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ProjectServiceImpl.java

@@ -18,6 +18,7 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
@@ -178,9 +179,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 			// todo 截至时间降序
 			// todo 截至时间降序
 			projectIPage = this.page(page, lqw);
 			projectIPage = this.page(page, lqw);
 		}
 		}
-
 		return projectIPage;
 		return projectIPage;
-
 	}
 	}
 
 
 	@Override
 	@Override
@@ -192,61 +191,159 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 	public ProjectStatisticsVO projectStatistics(Long topDept, Integer deptCategory, String year) {
 	public ProjectStatisticsVO projectStatistics(Long topDept, Integer deptCategory, String year) {
 		ProjectStatisticsVO vo = new ProjectStatisticsVO();
 		ProjectStatisticsVO vo = new ProjectStatisticsVO();
 		if (deptCategory != null) {
 		if (deptCategory != null) {
-			LambdaQueryWrapper<Project> lqw = new LambdaQueryWrapper<>();
 			if (deptCategory.equals(3)) {
 			if (deptCategory.equals(3)) {
-				//是业主 --> 主管单位是topDept
-				lqw.eq(Project::getCompetentUnit, topDept);
-				lqw.eq(Project::getYear, year);
-				List<Project> list = this.list(lqw);
-				if (!CollectionUtils.isEmpty(list)) {
-					Set<Long> projectIds = list.stream().map(Project::getId).collect(Collectors.toSet());
-					//项目总数
-					vo.setProjectCount(list.size());
-					//项目总投
-					BigDecimal amount = list.stream().map(Project::getTotalAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-					vo.setTotalAmount(amount);
-					//服务合同金额 -->所有业主的项目的任务下的所有合同
-					List<TaskContract> contracts = taskContractService.getByProjectIds(projectIds);
-					if (!CollectionUtils.isEmpty(contracts)) {
-						BigDecimal reduce = contracts.stream().map(TaskContract::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-						vo.setContractAmount(reduce);
-					}
-					//待完成任务总数
-					List<Task> tasks = taskService.getTodoByYear(projectIds, year);
-					if (!CollectionUtils.isEmpty(tasks)) {
-						vo.setTodoTask(tasks.size());
-					}
-				}
-			} else {
-				//是服务机构 -->执行机构是topDept
-				List<Task> tasks = taskService.getByOrgDeptId(topDept, null);
-				if (!CollectionUtils.isEmpty(tasks)) {
-					Set<Long> projectIds = tasks.stream().map(Task::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
-					lqw.in(Project::getId, projectIds);
-					List<Project> projects = this.list(lqw);
-					if (!CollectionUtils.isEmpty(projects)) {
+				//是业主 --> 权限表里 topDept是参数topDept
+				List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(topDept, null, null);
+				if (!CollectionUtils.isEmpty(auths)) {
+					Set<Long> ids = auths.stream().map(ProjectAuth::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
+					LambdaQueryWrapper<Project> lqw = new LambdaQueryWrapper<>();
+					lqw.eq(Project::getYear, year);
+					lqw.in(Project::getId, ids);
+					List<Project> list = this.list(lqw);
+					if (!CollectionUtils.isEmpty(list)) {
+						Set<Long> projectIds = list.stream().map(Project::getId).collect(Collectors.toSet());
 						//项目总数
 						//项目总数
-						vo.setProjectCount(projects.size());
+						vo.setProjectCount(list.size());
 						//项目总投
 						//项目总投
-						BigDecimal amount = projects.stream().map(Project::getTotalAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+						BigDecimal amount = list.stream().map(Project::getTotalAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 						vo.setTotalAmount(amount);
 						vo.setTotalAmount(amount);
-						//服务合同金额  --> 任务合同乙方是当前机构的
-						List<TaskContract> contracts = taskContractService.getByOrgDeptId(topDept);
+						//服务合同金额 --> 所有业主的项目的任务下的所有合同
+						List<TaskContract> contracts = taskContractService.getByProjectIds(projectIds);
 						if (!CollectionUtils.isEmpty(contracts)) {
 						if (!CollectionUtils.isEmpty(contracts)) {
 							BigDecimal reduce = contracts.stream().map(TaskContract::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 							BigDecimal reduce = contracts.stream().map(TaskContract::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 							vo.setContractAmount(reduce);
 							vo.setContractAmount(reduce);
 						}
 						}
-						//待完成任务数量
-						Set<Task> collect = tasks.stream().filter(f -> f.getYear() != null && f.getYear().equals(Integer.valueOf(year)) && f.getIsConfirmed() == 0).collect(Collectors.toSet());
-						if (!CollectionUtils.isEmpty(collect)) {
-							vo.setTodoTask(collect.size());
+						//待完成任务总数
+						List<Task> tasks = taskService.getTodoByYear(projectIds, year);
+						if (!CollectionUtils.isEmpty(tasks)) {
+							vo.setTodoTask(tasks.size());
+						}
+					}
+				}
+			} else if (deptCategory.equals(4)) {
+				String role = AuthUtil.getUserRole();
+				Long deptId = Func.firstLong(AuthUtil.getDeptId());
+				Long userId = AuthUtil.getUserId();
+				if (role != null) {
+					if (role.contains(STAFF_ADMIN)) {
+						// 1.2.1 机构管理员 ---> 项目权限表里 topDept 字段是自己的集合
+						List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(topDept, null, null);
+						if (!CollectionUtils.isEmpty(auths)) {
+							Set<Long> projectIds = auths.stream().map(ProjectAuth::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
+							LambdaQueryWrapper<Project> lqw = new LambdaQueryWrapper<>();
+							lqw.eq(Project::getYear, year);
+							lqw.in(Project::getId, projectIds);
+							List<Project> projects = this.list(lqw);
+							if (!CollectionUtils.isEmpty(projects)) {
+								//项目总数
+								vo.setProjectCount(projects.size());
+								//项目总投资
+								BigDecimal amount = projects.stream().map(Project::getTotalAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+								vo.setTotalAmount(amount);
+								//服务合同金额 ---> 合同乙方是参数topDept
+								List<TaskContract> contracts = taskContractService.getByDeptIdAndYear(topDept, Integer.valueOf(year), null);
+								if (!CollectionUtils.isEmpty(contracts)) {
+									BigDecimal reduce = contracts.stream().map(TaskContract::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+									vo.setContractAmount(reduce);
+								}
+								//待完成任务数
+								List<Task> tasks = taskService.getByDeptAndDate(topDept, null, null, null);
+								if (!CollectionUtils.isEmpty(tasks)) {
+									Set<Task> collect = tasks.stream().filter(f -> f.getYear() != null && f.getYear().equals(Integer.valueOf(year)) && f.getTaskStatus() != 6 && f.getTaskStatus() != 5 && f.getTaskStatus() != 4).collect(Collectors.toSet());
+									if (!CollectionUtils.isEmpty(collect)) {
+										vo.setTodoTask(collect.size());
+									}
+								}
+							}
+						}
+					} else if (role.contains(STAFF_SECOND_ADMIN)) {
+						// 1.2.2 次级机构主管  ---> 项目权限表里 userDept 字段是自己的集合
+						List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(topDept, deptId, null);
+						if (!CollectionUtils.isEmpty(auths)) {
+							Set<Long> projectIds = auths.stream().map(ProjectAuth::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
+							LambdaQueryWrapper<Project> lqw = new LambdaQueryWrapper<>();
+							lqw.eq(Project::getYear, year);
+							lqw.in(Project::getId, projectIds);
+							List<Project> projects = this.list(lqw);
+							if (!CollectionUtils.isEmpty(projects)) {
+								//项目总数
+								vo.setProjectCount(projects.size());
+								//项目总投资
+								BigDecimal amount = projects.stream().map(Project::getTotalAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+								vo.setTotalAmount(amount);
+								//服务合同金额  --> 任务执行单位是dept 的合同
+								List<Task> tasks = taskService.getByDeptAndDate(topDept, deptId, null, null);
+								if (!CollectionUtils.isEmpty(tasks)) {
+									Set<Long> taskIds = tasks.stream().map(Task::getId).collect(Collectors.toSet());
+									List<TaskContract> contracts = taskContractService.getByDeptIdAndYear(topDept, Integer.valueOf(year), taskIds);
+									if (!CollectionUtils.isEmpty(contracts)) {
+										BigDecimal reduce = contracts.stream().map(TaskContract::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+										vo.setContractAmount(reduce);
+									}
+									//待完成任务总数
+									Set<Task> collect = tasks.stream().filter(f -> f.getYear() != null && f.getYear().equals(Integer.valueOf(year)) && f.getTaskStatus() != 6 && f.getTaskStatus() != 5 && f.getTaskStatus() != 4).collect(Collectors.toSet());
+									if (!CollectionUtils.isEmpty(collect)) {
+										vo.setTodoTask(collect.size());
+									}
+								}
+							}
+						}
+					} else if (role.contains(STAFF_USER) || role.contains(STAFF_PROJECT_MANAGER)) {
+						//1.2.3 普通员工和项目经理   --->项目权限表里 userId 是自己的
+						List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(topDept, deptId, userId);
+						if (!CollectionUtils.isEmpty(auths)) {
+							Set<Long> projectIds = auths.stream().map(ProjectAuth::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
+							LambdaQueryWrapper<Project> lqw = new LambdaQueryWrapper<>();
+							lqw.eq(Project::getYear, year);
+							lqw.in(Project::getId, projectIds);
+							List<Project> projects = this.list(lqw);
+							if (!CollectionUtils.isEmpty(projects)) {
+								//项目总数
+								vo.setProjectCount(projects.size());
+								//项目总投资
+								BigDecimal amount = projects.stream().map(Project::getTotalAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+								vo.setTotalAmount(amount);
+								//服务合同金额  --> 任务执行者是userid
+								List<Task> tasks = taskService.getByDeptAndDate(topDept, deptId, String.valueOf(userId), null);
+								if (!CollectionUtils.isEmpty(tasks)) {
+									Set<Long> taskIds = tasks.stream().map(Task::getId).collect(Collectors.toSet());
+									List<TaskContract> contracts = taskContractService.getByDeptIdAndYear(topDept, Integer.valueOf(year), taskIds);
+									if (!CollectionUtils.isEmpty(contracts)) {
+										BigDecimal reduce = contracts.stream().map(TaskContract::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+										vo.setContractAmount(reduce);
+									}
+									//待完成任务总数
+									Set<Task> collect = tasks.stream().filter(f -> f.getYear() != null && f.getYear().equals(Integer.valueOf(year)) && f.getTaskStatus() != 6 && f.getTaskStatus() != 5 && f.getTaskStatus() != 4).collect(Collectors.toSet());
+									if (!CollectionUtils.isEmpty(collect)) {
+										vo.setTodoTask(collect.size());
+									}
+								}
+							}
 						}
 						}
 					}
 					}
 				}
 				}
 			}
 			}
 		}
 		}
-
 		return vo;
 		return vo;
 	}
 	}
 
 
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean delete(List<Long> projectIds) {
+		LambdaQueryWrapper<Task> lqw = new LambdaQueryWrapper<>();
+		lqw.in(Task::getProjectId, projectIds);
+		List<Task> list = taskService.list(lqw);
+		if (!CollectionUtils.isEmpty(list)) {
+			taskService.removeBatchByIds(list);
+		}
+		LambdaQueryWrapper<ProjectAuth> wrapper = new LambdaQueryWrapper<>();
+		wrapper.in(ProjectAuth::getProjectId, projectIds);
+		List<ProjectAuth> auths = projectAuthService.list(wrapper);
+		if (!CollectionUtils.isEmpty(auths)) {
+			projectAuthService.removeByIds(auths);
+		}
+		return removeByIds(projectIds);
+	}
+
 }
 }

+ 28 - 1
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskLogServiceImpl.java

@@ -5,9 +5,14 @@ import com.wtkj.mapper.TaskLogMapper;
 import com.wtkj.service.ITaskLogService;
 import com.wtkj.service.ITaskLogService;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.tool.api.R;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * @author Blizzard
  * @author Blizzard
@@ -17,8 +22,30 @@ import java.util.List;
 @Service
 @Service
 @AllArgsConstructor
 @AllArgsConstructor
 public class TaskLogServiceImpl extends BaseServiceImpl<TaskLogMapper, TaskLog> implements ITaskLogService {
 public class TaskLogServiceImpl extends BaseServiceImpl<TaskLogMapper, TaskLog> implements ITaskLogService {
+
+	private final IUserClient userClient;
+
 	@Override
 	@Override
 	public List<TaskLog> listByTaskId(Long taskId) {
 	public List<TaskLog> listByTaskId(Long taskId) {
 		return baseMapper.listByTaskId(taskId);
 		return baseMapper.listByTaskId(taskId);
 	}
 	}
+
+	@Override
+	public List<User> getTaskGroupMen(Long id) {
+		List<User> res = new ArrayList<>();
+		List<TaskLog> logs = this.listByTaskId(id);
+		if (!CollectionUtils.isEmpty(logs)) {
+			Set<String> collect = logs.stream().filter(Objects::nonNull).map(TaskLog::getRelatedUser).collect(Collectors.toSet());
+			if (!CollectionUtils.isEmpty(collect)) {
+				Set<String> idStr = collect.stream().flatMap(s -> Arrays.stream(s.split(","))).collect(Collectors.toSet());
+				idStr.forEach(userId -> {
+					R<User> userR = userClient.userInfoById(Long.valueOf(userId));
+					if (userR.isSuccess()) {
+						res.add(userR.getData());
+					}
+				});
+			}
+		}
+		return res;
+	}
 }
 }

+ 25 - 31
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java

@@ -156,7 +156,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 		if (dto.getTaskStatus() != null) {
 		if (dto.getTaskStatus() != null) {
 			lqw.eq(Task::getTaskStatus, dto.getTaskStatus());
 			lqw.eq(Task::getTaskStatus, dto.getTaskStatus());
 		}
 		}
-		lqw.orderByAsc(Task::getTaskStatus);
+		lqw.orderByDesc(Task::getCreateTime);
 		return baseMapper.selectPage(page, lqw);
 		return baseMapper.selectPage(page, lqw);
 	}
 	}
 
 
@@ -246,7 +246,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 				Long deptId = Func.firstLong(AuthUtil.getDeptId());
 				Long deptId = Func.firstLong(AuthUtil.getDeptId());
 				if (role.contains(STAFF_ADMIN)) {
 				if (role.contains(STAFF_ADMIN)) {
 					// 2.1 机构管理员 ---> 任务是派遣给自己机构的
 					// 2.1 机构管理员 ---> 任务是派遣给自己机构的
-					List<Task> byOrgDeptId = this.getByOrgDeptId(dto.getTopDept(), null);
+					List<Task> byOrgDeptId = this.getByDeptAndDate(dto.getTopDept(), null, null, null);
 					if (!CollectionUtils.isEmpty(byOrgDeptId)) {
 					if (!CollectionUtils.isEmpty(byOrgDeptId)) {
 						Set<Long> taskIds = byOrgDeptId.stream().map(Task::getId).collect(Collectors.toSet());
 						Set<Long> taskIds = byOrgDeptId.stream().map(Task::getId).collect(Collectors.toSet());
 						ids.addAll(taskIds);
 						ids.addAll(taskIds);
@@ -263,7 +263,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 			lqw.and(wq -> {
 			lqw.and(wq -> {
 				wq.eq(Task::getCreateUser, userId);
 				wq.eq(Task::getCreateUser, userId);
 				wq.or().like(Task::getExecuteUser, String.valueOf(userId));
 				wq.or().like(Task::getExecuteUser, String.valueOf(userId));
-				wq.in(Task::getId, ids);
+				if (!CollectionUtils.isEmpty(ids)) {
+					wq.or().in(Task::getId, ids);
+				}
 			});
 			});
 		} else if (dto.getType() == 2) {
 		} else if (dto.getType() == 2) {
 			lqw.eq(Task::getCreateUser, userId);
 			lqw.eq(Task::getCreateUser, userId);
@@ -284,7 +286,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 				Long deptId = Func.firstLong(AuthUtil.getDeptId());
 				Long deptId = Func.firstLong(AuthUtil.getDeptId());
 				if (role.contains(STAFF_ADMIN)) {
 				if (role.contains(STAFF_ADMIN)) {
 					// 2.1 机构管理员 ---> 任务是派遣给自己机构的
 					// 2.1 机构管理员 ---> 任务是派遣给自己机构的
-					List<Task> byOrgDeptId = this.getByOrgDeptId(dto.getTopDept(), null);
+					List<Task> byOrgDeptId = this.getByDeptAndDate(dto.getTopDept(), null, null, null);
 					if (!CollectionUtils.isEmpty(byOrgDeptId)) {
 					if (!CollectionUtils.isEmpty(byOrgDeptId)) {
 						Set<Long> taskIds = byOrgDeptId.stream().map(Task::getId).collect(Collectors.toSet());
 						Set<Long> taskIds = byOrgDeptId.stream().map(Task::getId).collect(Collectors.toSet());
 						lqw.in(Task::getId, taskIds);
 						lqw.in(Task::getId, taskIds);
@@ -324,42 +326,43 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 			//全部任务数
 			//全部任务数
 			statistics.setAll(tasks.size());
 			statistics.setAll(tasks.size());
 			tasks.forEach(task -> {
 			tasks.forEach(task -> {
-				//任务确认状态
-				Integer isConfirmed = task.getIsConfirmed();
-				//任务状态 1.待确认 2.进行中 3.已提交 4.已完成 5.已取消
+				//任务状态 1.待确认 2.进行中 3.已提交 4.已完成 5.已取消 6.过期 7.审查 8.二次审查
 				Integer taskStatus = task.getTaskStatus();
 				Integer taskStatus = task.getTaskStatus();
-				if (isConfirmed.equals(1)) {
-					//已完成
+				if (taskStatus.equals(4)) {
+					//1.已完成
 					statistics.setCompleted(statistics.getCompleted() + 1);
 					statistics.setCompleted(statistics.getCompleted() + 1);
 				}
 				}
+				if (!taskStatus.equals(4) && !taskStatus.equals(5)) {
+					//未完成
+					//6.未完成
+					statistics.setNotCompleted(statistics.getNotCompleted() + 1);
+				}
 				Date now = DateUtil.now();
 				Date now = DateUtil.now();
 				Date endTime = task.getEndTime();
 				Date endTime = task.getEndTime();
 				if (endTime != null) {
 				if (endTime != null) {
-					//过了截至时间且未确认的任务为已逾期
-					if (endTime.before(now) && isConfirmed.equals(0)) {
+					//2.已逾期
+					if (taskStatus.equals(6)) {
 						statistics.setOverdue(statistics.getOverdue() + 1);
 						statistics.setOverdue(statistics.getOverdue() + 1);
 					}
 					}
 
 
-					//待确认 已经提交但未确认且未逾期的任务为待确认
-					if (endTime.after(now) && taskStatus.equals(3) && isConfirmed.equals(0)) {
+					//3.待确认 已经提交但未确认且未逾期的任务为待确认
+					if (endTime.after(now) && taskStatus.equals(3)) {
 						statistics.setToConfirmed(statistics.getToConfirmed() + 1);
 						statistics.setToConfirmed(statistics.getToConfirmed() + 1);
 					}
 					}
 
 
-					//今日到期
+					//4.今日到期
 					String endStr = DateUtil.format(endTime, "yyyy-MM-dd");
 					String endStr = DateUtil.format(endTime, "yyyy-MM-dd");
 					String nowStr = DateUtil.format(now, "yyyy-MM-dd");
 					String nowStr = DateUtil.format(now, "yyyy-MM-dd");
 					if (endStr.equals(nowStr)) {
 					if (endStr.equals(nowStr)) {
 						statistics.setTodayToExpire(statistics.getTodayToExpire() + 1);
 						statistics.setTodayToExpire(statistics.getTodayToExpire() + 1);
 					}
 					}
 
 
-					//逾期完成
-					if (endTime.before(now) && isConfirmed.equals(1)) {
+					//5.逾期完成
+					if (endTime.before(now) && taskStatus.equals(4)) {
 						statistics.setOverdueComplete(statistics.getOverdueComplete() + 1);
 						statistics.setOverdueComplete(statistics.getOverdueComplete() + 1);
 					}
 					}
 				}
 				}
 			});
 			});
-			//未完成
-			statistics.setNotCompleted(statistics.getAll() - statistics.getCompleted());
 		}
 		}
 		return statistics;
 		return statistics;
 	}
 	}
@@ -395,20 +398,10 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 	}
 	}
 
 
 	@Override
 	@Override
-	public Set<Long> getByExecute(Long deptId, String userId) {
+	public List<Task> getByExecute(Long deptId, String userId) {
 		return baseMapper.selectByExecute(deptId, userId);
 		return baseMapper.selectByExecute(deptId, userId);
 	}
 	}
 
 
-	@Override
-	public Set<Long> getByUser(String userId) {
-		return baseMapper.selectByUser(userId);
-	}
-
-	@Override
-	public Set<Long> todayTask(Long userId) {
-		String now = DateUtil.format(new Date(), "yyyy-MM-dd");
-		return baseMapper.selectTodayTask(userId, now);
-	}
 
 
 	@Override
 	@Override
 	public List<Task> todayTodo(Long userId, String date) {
 	public List<Task> todayTodo(Long userId, String date) {
@@ -421,8 +414,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 	}
 	}
 
 
 	@Override
 	@Override
-	public List<Task> getByOrgDeptId(Long topDept, String date) {
-		return baseMapper.getByOrgDeptId(topDept, date);
+	public List<Task> getByDeptAndDate(Long topDept, Long executeDept, String user, String date) {
+		return baseMapper.getByDeptAndDate(topDept, executeDept, user, date);
 	}
 	}
 
 
 	@Override
 	@Override
@@ -775,6 +768,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 		return baseMapper.selectByCompetentUnit(deptId);
 		return baseMapper.selectByCompetentUnit(deptId);
 	}
 	}
 
 
+
 	private List<Task> getListByDateAndStageAndStatus(Long stageId, String formatDate, Integer taskStatus) {
 	private List<Task> getListByDateAndStageAndStatus(Long stageId, String formatDate, Integer taskStatus) {
 		return baseMapper.selectByDateAndStageAndStatus(stageId, formatDate, taskStatus);
 		return baseMapper.selectByDateAndStageAndStatus(stageId, formatDate, taskStatus);
 	}
 	}

+ 1 - 1
blade-service/wt-okr/src/main/java/com/wtkj/wrapper/FileAndFolderHistoryWrapper.java

@@ -52,7 +52,7 @@ public class FileAndFolderHistoryWrapper extends BaseEntityWrapper<FileAndFolder
 			vo.setCoverDept(deptR.getData().getDeptName());
 			vo.setCoverDept(deptR.getData().getDeptName());
 		}
 		}
 		//文件
 		//文件
-		Long historyId = entity.getHistoryId();
+		String historyId = entity.getHistoryId();
 		R<FileVO> byId = fileClient.findById(historyId);
 		R<FileVO> byId = fileClient.findById(historyId);
 		if (byId.isSuccess()) {
 		if (byId.isSuccess()) {
 			FileVO data = byId.getData();
 			FileVO data = byId.getData();

+ 2 - 12
blade-service/wt-okr/src/main/java/com/wtkj/wrapper/FileAndFolderWrapper.java

@@ -17,12 +17,8 @@ import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springblade.system.user.feign.IUserClient;
-import org.springframework.util.CollectionUtils;
 
 
-import java.util.List;
 import java.util.Objects;
 import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
 
 
 import static com.wtkj.config.MagicValue.ONE;
 import static com.wtkj.config.MagicValue.ONE;
 import static com.wtkj.config.MagicValue.TWO;
 import static com.wtkj.config.MagicValue.TWO;
@@ -83,20 +79,14 @@ public class FileAndFolderWrapper extends BaseEntityWrapper<FileAndFolder, FileA
 				vo.setUrl(rpc.getData().getFilePath());
 				vo.setUrl(rpc.getData().getFilePath());
 				vo.setSuffix(rpc.getData().getSuffix());
 				vo.setSuffix(rpc.getData().getSuffix());
 			}
 			}
-			//文件阅读人
-			List<Long> userIds = fileReadService.getReadUser(vo.getBladeFileId());
-			if (!CollectionUtils.isEmpty(userIds)) {
-				Set<User> users = userIds.stream().map(m -> userClient.userInfoById(m)).filter(userR1 -> userR1.isSuccess()).map(R::getData).collect(Collectors.toSet());
-				vo.setReadUsers(users);
-			}
 		}
 		}
 		//权限
 		//权限
 		Integer isPrivate = vo.getIsPrivate();
 		Integer isPrivate = vo.getIsPrivate();
 		Long privateUser = vo.getPrivateUser();
 		Long privateUser = vo.getPrivateUser();
 		if (Objects.equals(isPrivate, ONE)) {
 		if (Objects.equals(isPrivate, ONE)) {
 			Long userId = AuthUtil.getUserId();
 			Long userId = AuthUtil.getUserId();
-			if (userId.equals(privateUser)) {
-				vo.setAuth(ONE);
+			if (!userId.equals(privateUser)) {
+				vo.setAuth(0);
 			}
 			}
 		}
 		}
 		return vo;
 		return vo;

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

@@ -4,17 +4,11 @@ import com.wtkj.entity.TaskLog;
 import com.wtkj.service.ITaskLogService;
 import com.wtkj.service.ITaskLogService;
 import com.wtkj.vo.TaskLogVO;
 import com.wtkj.vo.TaskLogVO;
 import org.springblade.core.mp.support.BaseEntityWrapper;
 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.BeanUtil;
 import org.springblade.core.tool.utils.SpringUtil;
 import org.springblade.core.tool.utils.SpringUtil;
-import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springblade.system.user.feign.IUserClient;
-import org.springframework.util.CollectionUtils;
 
 
-import java.util.List;
 import java.util.Objects;
 import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
 
 
 /**
 /**
  * @author Blizzard
  * @author Blizzard
@@ -36,17 +30,6 @@ public class TaskLogWrapper extends BaseEntityWrapper<TaskLog, TaskLogVO> {
 	@Override
 	@Override
 	public TaskLogVO entityVO(TaskLog entity) {
 	public TaskLogVO entityVO(TaskLog entity) {
 		TaskLogVO vo = Objects.requireNonNull(BeanUtil.copy(entity, TaskLogVO.class));
 		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;
 		return vo;
 	}
 	}
 }
 }