Browse Source

fix: task page fix

Blizzard 1 year ago
parent
commit
125b51deb5
27 changed files with 677 additions and 172 deletions
  1. 41 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/dto/MyTaskPageDTO.java
  2. 5 22
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/dto/UpdateUserDTO.java
  3. 2 2
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/FileRead.java
  4. 12 3
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/Task.java
  5. 2 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/FileAndFolderVO.java
  6. 7 3
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/vo/TaskVO.java
  7. 17 0
      blade-service/wt-okr/pom.xml
  8. 26 40
      blade-service/wt-okr/src/main/java/com/wtkj/controller/CommonController.java
  9. 1 1
      blade-service/wt-okr/src/main/java/com/wtkj/controller/QrCodeController.java
  10. 7 4
      blade-service/wt-okr/src/main/java/com/wtkj/controller/TaskController.java
  11. 3 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileReadMapper.java
  12. 8 1
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileReadMapper.xml
  13. 5 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.java
  14. 11 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.xml
  15. 6 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/ICommonService.java
  16. 0 3
      blade-service/wt-okr/src/main/java/com/wtkj/service/IDeptToDeptService.java
  17. 3 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/IFileReadService.java
  18. 13 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskService.java
  19. 22 3
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java
  20. 51 5
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/CommonServiceImpl.java
  21. 30 6
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ContactOuterServiceImpl.java
  22. 0 44
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/DeptToDeptServiceImpl.java
  23. 8 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/FileReadServiceImpl.java
  24. 266 12
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java
  25. 74 0
      blade-service/wt-okr/src/main/java/com/wtkj/util/Workload.java
  26. 11 2
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/FileAndFolderWrapper.java
  27. 46 19
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskWrapper.java

+ 41 - 0
blade-service-api/wt-okr-api/src/main/java/com/wtkj/dto/MyTaskPageDTO.java

@@ -0,0 +1,41 @@
+package com.wtkj.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-07 23:07
+ * @describe
+ */
+@Data
+public class MyTaskPageDTO implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	@ApiModelProperty(value = "type:1:全部 2:我创建的 3:我执行的 4:我管理的")
+	private Integer type = 1;
+
+	private Integer isGroup = 0;
+
+	private Integer year;
+
+	private Integer month;
+
+	@NotNull(message = "current不可为空")
+	private int current;
+
+	@NotNull(message = "size不可为空")
+	private int size;
+
+	@ApiModelProperty(value = "当前登录用户的顶级机构id")
+	@NotNull(message = "topDept不可为空")
+	private Long topDept;
+
+	@ApiModelProperty(value = "当前登录用户的机构类型")
+	@NotNull(message = "deptCategory不可为空")
+	private Integer deptCategory;
+}

+ 5 - 22
blade-service-api/wt-okr-api/src/main/java/com/wtkj/dto/UpdateUserDTO.java

@@ -1,36 +1,19 @@
 package com.wtkj.dto;
 
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
+import lombok.EqualsAndHashCode;
+import org.springblade.system.user.entity.User;
 
 /**
  * @author Blizzard
  * @create at 2023-09-26 11:51
  * @describe
  */
+@EqualsAndHashCode(callSuper = true)
 @Data
-public class UpdateUserDTO implements Serializable {
+public class UpdateUserDTO extends User {
 
 	private static final long serialVersionUID = 1L;
 
-	@JsonSerialize(using = ToStringSerializer.class)
-	@NotNull(message = "userId can't be null")
-	private Long userId;
-
-	private String name;
-
-	private String phone;
-
-	@NotNull(message = "roleId can't be null")
-	private String roleIds;
-
-	private String postIds;
-
-	@JsonSerialize(using = ToStringSerializer.class)
-	@NotNull(message = "deptId can't be null")
-	private Long deptId;
+	private Long newRoleId;
 }

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

@@ -19,9 +19,9 @@ public class FileRead extends BaseEntity {
 
 	private static final long serialVersionUID = 1L;
 
-	@TableField("file_id")
+	@TableField("blade_file_id")
 	@ApiModelProperty(value = "文件主键id")
-	private Long fileId;
+	private Long bladeFileId;
 
 	@TableField("user_id")
 	@ApiModelProperty(value = "用户id")

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

@@ -39,6 +39,11 @@ public class Task extends BaseEntity {
 	@TableField("title")
 	private String title;
 
+	@TableField("competent_unit")
+	@JsonSerialize(using = ToStringSerializer.class)
+	@ApiModelProperty(value = "主管单位")
+	private Long competentUnit;
+
 	@ApiModelProperty(value = "派遣给哪个机构:顶级机构")
 	@NotNull(message = "orgDeptId不可为空")
 	@TableField("org_dept_id")
@@ -103,9 +108,13 @@ public class Task extends BaseEntity {
 	@TableField("project_manager")
 	private Long projectManager;
 
-	@ApiModelProperty(value = "审查人")
-	@TableField("check_user")
-	private String checkUser;
+	@ApiModelProperty(value = "第一审查人")
+	@TableField("first_check_user")
+	private Long firstCheckUser;
+
+	@ApiModelProperty(value = "第二审查人")
+	@TableField("second_check_user")
+	private Long secondCheckUser;
 
 	@ApiModelProperty(value = "实际执行部门")
 	@TableField("execute_dept")

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

@@ -35,4 +35,6 @@ public class FileAndFolderVO extends FileAndFolder {
 	private String url;
 
 	private Set<User> readUsers;
+
+	private String projectName;
 }

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

@@ -20,7 +20,7 @@ public class TaskVO extends Task {
 
 	private String projectName;
 
-	private User projectManagerUser;
+	private String projectManagerUser;
 
 	private String dispatchUintName;
 
@@ -30,9 +30,13 @@ public class TaskVO extends Task {
 
 	private List<FileAndFolder> files;
 
-	private List<User> checkUsers;
+	private User firstUser;
 
-	private List<User> executeUsers;
+	private User secondUser;
+
+	private List<String> executeUsers;
 
 	private List<String> tagsArray;
+
+	private List<Long> checkUserIds;
 }

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

@@ -31,6 +31,23 @@
             <version>1.0.RELEASE</version>
         </dependency>
 
+        <!--数据导出-->
+        <!--        <dependency>-->
+        <!--            <groupId>org.springblade</groupId>-->
+        <!--            <artifactId>blade-starter-excel</artifactId>-->
+        <!--        </dependency>-->
+
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-base</artifactId>
+            <version>4.1.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+        </dependency>
+
         <!--        分布式事务-->
         <dependency>
             <groupId>org.springblade</groupId>

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

@@ -1,17 +1,25 @@
 package com.wtkj.controller;
 
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import com.wtkj.service.IDeptToDeptService;
+import com.wtkj.service.ICommonService;
+import com.wtkj.service.ITaskService;
+import com.wtkj.util.Workload;
 import com.wtkj.vo.AuthUserInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springblade.core.secure.annotation.PreAuth;
 import org.springblade.core.tool.api.R;
-import org.springblade.system.user.feign.IUserClient;
+import org.springblade.core.tool.constant.RoleConstant;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
 /**
  * @author Blizzard
  * @create at 2023-09-14 11:13
@@ -23,8 +31,8 @@ import org.springframework.web.bind.annotation.RestController;
 @Api(value = "公共模块", tags = "公共模块")
 public class CommonController {
 
-	private final IDeptToDeptService deptToDeptService;
-	private final IUserClient userClient;
+	private final ITaskService taskService;
+	private final ICommonService commonService;
 
 	/**
 	 * 当前登录用户信息
@@ -33,44 +41,22 @@ public class CommonController {
 	@ApiOperation(value = "当前登录用户信息", notes = "")
 	@ApiOperationSupport(order = 1)
 	public R<AuthUserInfo> userInfo() {
-		return R.data(deptToDeptService.userInfo());
+		return R.data(commonService.userInfo());
 	}
 
 
-//	/**
-//	 * 新建机构
-//	 */
-//	@PostMapping("/sava-dept")
-//	@ApiOperation(value = "新建政府机构", notes = "传入DeptToDept")
-//	@ApiOperationSupport(order = 2)
-//	public R<Boolean> createDept(@RequestBody @Valid DeptToDept dept) {
-//		return R.status(deptToDeptService.saveOrUpdate(dept));
-//	}
-//
-//	/**
-//	 * 机构搜索
-//	 */
-//	@GetMapping("/get-dept")
-//	@ApiOperation(value = "搜索机构", notes = "")
-//	@ApiOperationSupport(order = 3)
-//	public R<List<Dept>> list(Long topDept, String areaCode, String name, Integer category) {
-//		return R.data(deptToDeptService.getDept(topDept, areaCode, name, category));
-//	}
-//
-//
-//	/**
-//	 * 搜索用户
-//	 */
-//	@GetMapping("/get-user-list")
-//	@ApiOperationSupport(order = 4)
-//	@ApiOperation(value = "搜索用户", notes = "")
-//	public R getUserList(@RequestParam Long deptId, @RequestParam String name) {
-//		List<User> list = new ArrayList<>();
-//		R<List<User>> rpc = userClient.getDeptUserList(deptId, name);
-//		if (rpc.isSuccess()) {
-//			list = rpc.getData();
-//		}
-//		return R.data(UserListWrapper.build().listVO(list));
-//	}
+	/**
+	 * 导出工作量
+	 */
+	@GetMapping("/export-task")
+	@ApiOperation(value = "工作量导出", notes = "")
+	@ApiOperationSupport(order = 2)
+	@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
+	public void export(@RequestParam String startDate, @RequestParam String endDate, HttpServletResponse response) throws IOException {
+		List<Workload> list = taskService.exportList(startDate, endDate);
+		taskService.export(list, response);
+
+	}
+
 
 }

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

@@ -48,7 +48,7 @@ public class QrCodeController {
 	 * 邀请至机构下
 	 */
 	@PostMapping("/invite-to-dept")
-	@ApiOperation(value = "接受邀请至机构下", notes = "type:1 邀请内部联系人 2:外部联系人")
+	@ApiOperation(value = "接受邀请加入机构", notes = "type:1 邀请内部联系人 2:外部联系人")
 	@ApiOperationSupport(order = 2)
 	public R inviteToDept(@RequestBody @Valid InviteToDeptDTO dto) {
 		return R.status(qrcodeService.inviteToDept(dto.getCreateUser(), dto.getType(), dto.getQrcodeId(), AuthUtil.getUserId(), dto.getDeptId()));

+ 7 - 4
blade-service/wt-okr/src/main/java/com/wtkj/controller/TaskController.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.wtkj.dto.MyTaskPageDTO;
 import com.wtkj.dto.ProjectTaskPageDTO;
 import com.wtkj.entity.*;
 import com.wtkj.service.*;
@@ -49,10 +50,12 @@ public class TaskController {
 
 	@GetMapping("/my-task-page")
 	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "我的任务列表", notes = "type:1:全部 2:我创建的 3:我执行的")
-	public R<IPage<TaskVO>> myTaskPage(@RequestParam(defaultValue = "1") Integer type, @RequestParam(defaultValue = "0") Integer isGroup,
-									   Integer year, Integer month, Query query) {
-		IPage<Task> page = taskService.myTaskPage(type, isGroup, year, month, Condition.getPage(query));
+	@ApiOperation(value = "我的任务列表", notes = "")
+	public R<IPage<TaskVO>> myTaskPage(@RequestBody @Valid MyTaskPageDTO dto) {
+		Query query = new Query();
+		query.setCurrent(dto.getCurrent());
+		query.setSize(dto.getSize());
+		IPage<Task> page = taskService.myTaskPage(dto, Condition.getPage(query));
 		return R.data(TaskWrapper.build().pageVO(page));
 	}
 

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.wtkj.entity.FileRead;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Blizzard
@@ -12,4 +13,6 @@ import java.util.List;
  */
 public interface FileReadMapper extends BaseMapper<FileRead> {
 	List<Long> getReadUser(Long fileId);
+
+	List<FileRead> selectByFileIds(Set<Long> fileIds);
 }

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

@@ -3,6 +3,13 @@
 <mapper namespace="com.wtkj.mapper.FileReadMapper">
 
     <select id="getReadUser" resultType="java.lang.Long">
-        select user_id from blade_file_read where is_deleted = 0 and file_id = #{param}
+        select user_id from blade_file_read where is_deleted = 0 and blade_file_id = #{param}
+    </select>
+
+    <select id="selectByFileIds" resultType="com.wtkj.entity.FileRead">
+        select * from blade_file_read where is_deleted = 0 and blade_file_id in
+        <foreach collection="param" open="(" separator="," close=")" index="index" item="item">
+            #{item}
+        </foreach>
     </select>
 </mapper>

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

@@ -26,6 +26,10 @@ public interface TaskMapper extends BaseMapper<Task> {
 
 	List<Task> getByOrgDeptId(Long topDept, String date);
 
+	List<Task> getByExecuteDept(Long deptId);
+
+	List<Task> selectByCompetentUnit(Long deptId);
+
 	List<Task> getTodayTodoByOrgDeptId(Long topDept, String date);
 
 	List<Task> getTodoByYear(Set<Long> projectIds, Integer year);
@@ -37,4 +41,5 @@ public interface TaskMapper extends BaseMapper<Task> {
 	List<Task> selectCurrentDateCompleteByStageAndDate(Long stageId, String formatDate, Integer taskStatus);
 
 	List<Task> getTodayToExpire(String date);
+
 }

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

@@ -46,6 +46,16 @@
         order by create_time
     </select>
 
+    <select id="getByExecuteDept" resultType="com.wtkj.entity.Task">
+        select * from blade_task where is_deleted = 0 and execute_dept = #{param}
+        order by create_time
+    </select>
+
+    <select id="selectByCompetentUnit" resultType="com.wtkj.entity.Task">
+        select * from blade_task where is_deleted = 0 and competent_unit = #{param}
+        order by create_time
+    </select>
+
     <select id="getTodoAndExpireByUserId" resultType="com.wtkj.entity.Task">
         select * from blade_task where is_deleted = 0 and execute_user like concat(concat('%',#{param1}),'%')
         and
@@ -89,4 +99,5 @@
         select * from blade_task where is_deleted = 0 and
         DATE_FORMAT(#{param},'%Y-%m-%d') > DATE_FORMAT(end_time,'%Y-%m-%d') and task_status != 4 and task_status != 5
     </select>
+
 </mapper>

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

@@ -5,8 +5,10 @@ import com.wtkj.dto.SearchProjectFileDTO;
 import com.wtkj.dto.UploadFileDTO;
 import com.wtkj.dto.UploadInnerFileDTO;
 import com.wtkj.entity.FileAndFolder;
+import com.wtkj.vo.AuthUserInfo;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Blizzard
@@ -29,5 +31,8 @@ public interface ICommonService {
 
 	IPage<FileAndFolder> esSearch(SearchProjectFileDTO dto, IPage<FileAndFolder> page);
 
-	Object openSearchFile(Long projectId, Long fileId, String text);
+	Set<Integer> openSearchFile(Long projectId, Long fileId, String text);
+
+	AuthUserInfo userInfo();
+
 }

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

@@ -1,7 +1,6 @@
 package com.wtkj.service;
 
 import com.wtkj.entity.DeptToDept;
-import com.wtkj.vo.AuthUserInfo;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.system.entity.Dept;
 
@@ -14,8 +13,6 @@ import java.util.List;
  */
 public interface IDeptToDeptService extends BaseService<DeptToDept> {
 
-	AuthUserInfo userInfo();
-
 	List<Dept> getDept(Long topDept, String areaCode, String name, Integer category);
 
 	List<DeptToDept> getByTopDept(Long topDept);

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

@@ -4,6 +4,7 @@ import com.wtkj.entity.FileRead;
 import org.springblade.core.mp.base.BaseService;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Blizzard
@@ -14,4 +15,6 @@ public interface IFileReadService extends BaseService<FileRead> {
 	boolean readFile(FileRead read);
 
 	List<Long> getReadUser(Long fileId);
+
+	List<FileRead> getByFileIds(Set<Long> fileIds);
 }

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

@@ -1,12 +1,16 @@
 package com.wtkj.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.wtkj.dto.MyTaskPageDTO;
 import com.wtkj.dto.ProjectTaskPageDTO;
 import com.wtkj.entity.LineChartDataSet;
 import com.wtkj.entity.Task;
+import com.wtkj.util.Workload;
 import com.wtkj.vo.MyTaskStatistics;
 import org.springblade.core.mp.base.BaseService;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -27,7 +31,7 @@ public interface ITaskService extends BaseService<Task> {
 
 	boolean deleteFile(String ids);
 
-	IPage<Task> myTaskPage(Integer type, Integer isGroup, Integer year, Integer month, IPage<Task> page);
+	IPage<Task> myTaskPage(MyTaskPageDTO dto, IPage<Task> page);
 
 	/**
 	 * 复用  复用
@@ -89,4 +93,12 @@ public interface ITaskService extends BaseService<Task> {
 	LineChartDataSet projectTaskBurnout(Long stageId);
 
 	List<Task> getTodayToExpire(String date);
+
+	List<Workload> exportList(String startDate, String endDate);
+
+	void export(List<Workload> list, HttpServletResponse response) throws IOException;
+
+	List<Task> getByExecuteDept(Long deptId);
+
+	List<Task> getByCompetentUnit(Long deptId);
 }

+ 22 - 3
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import static com.wtkj.config.MagicValue.ZERO;
@@ -144,6 +145,11 @@ public class AsyncServiceImpl implements IAsyncService {
 							taskLog.setCreateDept(task.getCreateDept());
 							taskLog.setCreateUser(task.getCreateUser());
 							taskLog.setUpdateUser(task.getUpdateUser());
+							try {
+								Thread.sleep(1000);
+							} catch (InterruptedException e) {
+								System.out.println("休眠异常:" + e.getMessage());
+							}
 							taskLog.setCreateTime(DateUtil.now());
 							taskLog.setUpdateTime(DateUtil.now());
 							logs.add(taskLog);
@@ -245,7 +251,7 @@ public class AsyncServiceImpl implements IAsyncService {
 						}
 					}
 
-					if (StringUtil.isNotBlank(task.getCheckUser())) {
+					/*if (StringUtil.isNotBlank(task.getCheckUser())) {
 						List<Long> userIds = Func.toLongList(task.getCheckUser());
 						List<String> str = new ArrayList<>();
 						Long finalOrgDeptId1 = orgDeptId;
@@ -285,7 +291,7 @@ public class AsyncServiceImpl implements IAsyncService {
 							taskLog.setUpdateTime(DateUtil.now());
 							logs.add(taskLog);
 						}
-					}
+					}*/
 					taskLogService.saveBatch(logs);
 					if (!CollectionUtils.isEmpty(auths)) {
 						projectAuthService.saveBatch(auths);
@@ -322,6 +328,11 @@ public class AsyncServiceImpl implements IAsyncService {
 						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);
 					}
 					break;
 				case 2:
@@ -337,6 +348,12 @@ public class AsyncServiceImpl implements IAsyncService {
 						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);
 					}
 					break;
 				case 3:
@@ -416,7 +433,9 @@ public class AsyncServiceImpl implements IAsyncService {
 					}
 					break;
 				case 5:
-					List<Long> checkUsers = Func.toLongList(task.getCheckUser());
+					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);

+ 51 - 5
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/CommonServiceImpl.java

@@ -13,6 +13,7 @@ import com.wtkj.entity.InnerFileAndFolder;
 import com.wtkj.entity.ProjectAuth;
 import com.wtkj.handler.es.Document;
 import com.wtkj.service.*;
+import com.wtkj.vo.AuthUserInfo;
 import com.wutong.file.feign.IFileClient;
 import com.wutong.file.vo.FileVO;
 import lombok.AllArgsConstructor;
@@ -26,10 +27,16 @@ import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.SearchHits;
 import org.elasticsearch.search.builder.SearchSourceBuilder;
 import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 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.StringUtil;
+import org.springblade.system.entity.Dept;
+import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -37,8 +44,7 @@ import org.springframework.util.CollectionUtils;
 import java.util.*;
 import java.util.stream.Collectors;
 
-import static com.wtkj.config.MagicValue.PROJECT_RESOURCE_INDEX;
-import static com.wtkj.config.MagicValue.TWO;
+import static com.wtkj.config.MagicValue.*;
 
 /**
  * @author Blizzard
@@ -55,6 +61,8 @@ public class CommonServiceImpl implements ICommonService {
 	private final IInnerFileAndFolderService innerFileAndFolderService;
 	private final IProjectAuthService projectAuthService;
 	private final RestHighLevelClient client;
+	private final ISysClient sysClient;
+	private final IUserClient userClient;
 
 
 	@Override
@@ -307,12 +315,13 @@ public class CommonServiceImpl implements ICommonService {
 			Set<Long> fileIds = set.stream().map(Document::getFileId).collect(Collectors.toSet());
 			lqw.in(FileAndFolder::getBladeFileId, fileIds);
 		}
+		lqw.eq(FileAndFolder::getType, 1);
 		return fileAndFolderService.page(page, lqw);
 	}
 
 	@SneakyThrows
 	@Override
-	public Object openSearchFile(Long projectId, Long fileId, String text) {
+	public Set<Integer> openSearchFile(Long projectId, Long fileId, String text) {
 		Long userId = AuthUtil.getUserId();
 		List<ProjectAuth> list = projectAuthService.getByUserId(userId);
 		if (!CollectionUtils.isEmpty(list)) {
@@ -346,17 +355,54 @@ public class CommonServiceImpl implements ICommonService {
 
 		//执行查询
 		SearchResponse response = client.search(request, RequestOptions.DEFAULT);
-		Set<Document> set = new HashSet<>();
+		//返回页码
+		Set<Integer> set = new HashSet<>();
 		if (response != null) {
 			SearchHits hits = response.getHits();
 			int size = hits.getHits().length;
 			for (int i = 0; i < size; i++) {
 				String str = hits.getHits()[i].getSourceAsString();
 				Document document = JSON.parseObject(str, Document.class);
-				set.add(document);
+				set.add(document.getCurrentPage());
 			}
 		}
+		return set;
+	}
 
+	@Override
+	public AuthUserInfo userInfo() {
+		BladeUser user = AuthUtil.getUser();
+		if (user != null) {
+			AuthUserInfo userInfo = Objects.requireNonNull(BeanUtil.copy(user, AuthUserInfo.class));
+			String deptIdStr = userInfo.getDeptId();
+			if (StringUtil.isNotBlank(deptIdStr)) {
+				R<Dept> rpc = sysClient.getDept(Long.valueOf(deptIdStr));
+				if (rpc.isSuccess()) {
+					userInfo.setDeptCategory(rpc.getData().getDeptCategory());
+					userInfo.setDeptName(rpc.getData().getDeptName());
+					String ancestors = rpc.getData().getAncestors();
+					// ancestors 0,1689540492698267649
+					if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
+						List<Long> longList = Func.toLongList(ancestors);
+						if (!CollectionUtils.isEmpty(longList)) {
+							if (longList.size() > 1) {
+								userInfo.setTopDept(longList.get(1));
+							} else {
+								userInfo.setTopDept(Long.valueOf(deptIdStr));
+							}
+						}
+					}
+				}
+			}
+			Long userId = user.getUserId();
+			R<User> userR = userClient.userInfoById(userId);
+			if (userR.isSuccess()) {
+				userInfo.setUser(userR.getData());
+			}
+			return userInfo;
+		}
 		return null;
 	}
+
+
 }

+ 30 - 6
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ContactOuterServiceImpl.java

@@ -8,9 +8,16 @@ import com.wtkj.service.IContactOuterService;
 import lombok.AllArgsConstructor;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.system.entity.Role;
+import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Blizzard
@@ -22,6 +29,7 @@ import org.springframework.stereotype.Service;
 public class ContactOuterServiceImpl extends BaseServiceImpl<ContactOuterMapper, ContactOuter> implements IContactOuterService {
 
 	private final IUserClient userClient;
+	private final ISysClient sysClient;
 
 	@Override
 	public IPage<ContactOuter> selectPage(Long userId, IPage<ContactOuter> page) {
@@ -36,15 +44,31 @@ public class ContactOuterServiceImpl extends BaseServiceImpl<ContactOuterMapper,
 	@Override
 	public boolean updateUser(UpdateUserDTO dto) {
 		boolean flag = false;
-		Long userId = dto.getUserId();
+		Long userId = dto.getId();
+		Long roleId = dto.getNewRoleId();
 		R<User> userR = userClient.userInfoById(userId);
 		if (userR.isSuccess() && userR.getData() != null) {
 			User user = userR.getData();
-			user.setPhone(dto.getPhone());
-			user.setRoleId(dto.getRoleIds());
-			user.setPostId(dto.getPostIds());
-			user.setName(dto.getName());
-			user.setDeptId(String.valueOf(dto.getDeptId()));
+			if (roleId != null) {
+				String roleStr = userR.getData().getRoleId();
+				List<Long> roleList = Func.toLongList(roleStr);
+				List<Long> temp = new ArrayList<>(roleList);
+				if (!CollectionUtils.isEmpty(roleList)) {
+					//去掉服务商的相关角色  重新赋值
+					List<Role> staffs = sysClient.getRoleList("staff").getData();
+					if (!CollectionUtils.isEmpty(staffs)) {
+						for (Role staff : staffs) {
+							Long id = staff.getId();
+							temp.remove(id);
+						}
+					}
+					temp.add(roleId);
+					String join = Func.join(temp);
+					user.setRoleId(join);
+				} else {
+					user.setRoleId(String.valueOf(roleId));
+				}
+			}
 			R<Boolean> booleanR = userClient.updateUser(user);
 			flag = booleanR.isSuccess();
 		}

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

@@ -3,19 +3,12 @@ package com.wtkj.service.impl;
 import com.wtkj.entity.DeptToDept;
 import com.wtkj.mapper.DeptToDeptMapper;
 import com.wtkj.service.IDeptToDeptService;
-import com.wtkj.vo.AuthUserInfo;
 import lombok.AllArgsConstructor;
 import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.core.secure.BladeUser;
-import org.springblade.core.secure.utils.AuthUtil;
 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.StringUtil;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
-import org.springblade.system.user.entity.User;
-import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -23,8 +16,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 
-import static com.wtkj.config.MagicValue.ZERO;
-
 /**
  * @author Blizzard
  * @create at 2023-09-14 11:11
@@ -35,42 +26,7 @@ import static com.wtkj.config.MagicValue.ZERO;
 public class DeptToDeptServiceImpl extends BaseServiceImpl<DeptToDeptMapper, DeptToDept> implements IDeptToDeptService {
 
 	private final ISysClient sysClient;
-	private final IUserClient userClient;
 
-	@Override
-	public AuthUserInfo userInfo() {
-		BladeUser user = AuthUtil.getUser();
-		if (user != null) {
-			AuthUserInfo userInfo = Objects.requireNonNull(BeanUtil.copy(user, AuthUserInfo.class));
-			String deptIdStr = userInfo.getDeptId();
-			if (StringUtil.isNotBlank(deptIdStr)) {
-				R<Dept> rpc = sysClient.getDept(Long.valueOf(deptIdStr));
-				if (rpc.isSuccess()) {
-					userInfo.setDeptCategory(rpc.getData().getDeptCategory());
-					userInfo.setDeptName(rpc.getData().getDeptName());
-					String ancestors = rpc.getData().getAncestors();
-					// ancestors 0,1689540492698267649
-					if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
-						List<Long> longList = Func.toLongList(ancestors);
-						if (!CollectionUtils.isEmpty(longList)) {
-							if (longList.size() > 1) {
-								userInfo.setTopDept(longList.get(1));
-							} else {
-								userInfo.setTopDept(Long.valueOf(deptIdStr));
-							}
-						}
-					}
-				}
-			}
-			Long userId = user.getUserId();
-			R<User> userR = userClient.userInfoById(userId);
-			if (userR.isSuccess()) {
-				userInfo.setUser(userR.getData());
-			}
-			return userInfo;
-		}
-		return null;
-	}
 
 	@Override
 	public List<Dept> getDept(Long topDept, String areaCode, String name, Integer category) {

+ 8 - 0
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/FileReadServiceImpl.java

@@ -5,9 +5,11 @@ import com.wtkj.mapper.FileReadMapper;
 import com.wtkj.service.IFileReadService;
 import lombok.AllArgsConstructor;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Blizzard
@@ -19,6 +21,7 @@ import java.util.List;
 public class FileReadServiceImpl extends BaseServiceImpl<FileReadMapper, FileRead> implements IFileReadService {
 	@Override
 	public boolean readFile(FileRead read) {
+		read.setUserId(AuthUtil.getUserId());
 		return save(read);
 	}
 
@@ -26,4 +29,9 @@ public class FileReadServiceImpl extends BaseServiceImpl<FileReadMapper, FileRea
 	public List<Long> getReadUser(Long fileId) {
 		return baseMapper.getReadUser(fileId);
 	}
+
+	@Override
+	public List<FileRead> getByFileIds(Set<Long> fileIds) {
+		return baseMapper.selectByFileIds(fileIds);
+	}
 }

+ 266 - 12
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java

@@ -1,15 +1,25 @@
 package com.wtkj.service.impl;
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.write.metadata.style.WriteCellStyle;
+import com.alibaba.excel.write.metadata.style.WriteFont;
+import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.wtkj.dto.MyTaskPageDTO;
 import com.wtkj.dto.ProjectTaskPageDTO;
 import com.wtkj.entity.*;
+import com.wtkj.mapper.ProjectMapper;
 import com.wtkj.mapper.TaskMapper;
 import com.wtkj.service.*;
+import com.wtkj.util.Workload;
 import com.wtkj.vo.MyTaskStatistics;
 import com.wutong.file.feign.IFileClient;
 import com.wutong.file.vo.FileVO;
 import lombok.AllArgsConstructor;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.redis.cache.BladeRedis;
@@ -18,14 +28,25 @@ 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.StringUtil;
+import org.springblade.system.entity.DictBiz;
+import org.springblade.system.entity.Region;
+import org.springblade.system.feign.IDictBizClient;
+import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.wtkj.config.MagicValue.STAFF_ADMIN;
+import static com.wtkj.config.MagicValue.STAFF_SECOND_ADMIN;
 
 /**
  * @author Blizzard
@@ -43,19 +64,24 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 	private final IUserClient userClient;
 	private final IProjectStageService stageService;
 	private final BladeRedis redis;
+	private final ISysClient sysClient;
+	private final ProjectMapper projectMapper;
+	private final IDictBizClient dictBizClient;
 
 	@Override
 	public boolean submit(Task task) {
 		boolean flag = false;
 		Long taskId = task.getId();
-		if (taskId == null) {
+		Long projectId = task.getProjectId();
+		Project project = projectMapper.selectById(projectId);
+		if (taskId == null && project != null) {
 			Long stageId = task.getStageId();
 			ProjectStage stage = stageService.getById(stageId);
 			if (stage != null) {
 				Date startTime = stage.getStartTime();
 				Date endTime = stage.getEndTime();
 				if (task.getStartTime().before(startTime) || task.getEndTime().after(endTime)) {
-					throw new ServiceException(String.format("任务时间异常,不可超出当前阶段的起止时间%s-%s", startTime, endTime));
+					throw new ServiceException(String.format("任务时间异常,不可超出当前阶段的起止时间%s-%s", DateUtil.format(startTime, "yyyy-MM-dd"), DateUtil.format(endTime, "yyyy-MM-dd")));
 				}
 			}
 			LocalDate now = LocalDate.now();
@@ -63,6 +89,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 			Integer month = now.getMonthValue();
 			task.setYear(year);
 			task.setMonth(month);
+			task.setCompetentUnit(project.getCompetentUnit());
 			flag = this.save(task);
 			asyncService.createTask(task);
 		} else {
@@ -89,7 +116,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 					asyncService.updateTask(4, userId, task);
 				}
 				//5.指定任务审查者
-				if (StringUtil.isBlank(byId.getCheckUser()) && StringUtil.isNotBlank(task.getCheckUser())) {
+				if (byId.getFirstCheckUser() == null && byId.getSecondCheckUser() == null && task.getFirstCheckUser() != null && task.getSecondCheckUser() != null) {
 					asyncService.updateTask(5, userId, task);
 				}
 				//6.提交了任务
@@ -191,7 +218,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 	}
 
 	@Override
-	public IPage<Task> myTaskPage(Integer type, Integer isGroup, Integer year, Integer month, IPage<Task> page) {
+	public IPage<Task> myTaskPage(MyTaskPageDTO dto, IPage<Task> page) {
 
 		Long userId = AuthUtil.getUserId();
 		LambdaQueryWrapper<Task> lqw = new LambdaQueryWrapper<>();
@@ -199,21 +226,80 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 		LocalDate currentDate = LocalDate.now();
 		int currentYear = currentDate.getYear();
 		int currentMonth = currentDate.getMonthValue();
-		lqw.eq(Task::getYear, year == null ? currentYear : year);
-		lqw.eq(Task::getMonth, month == null ? currentMonth : month);
-
-		//1.全部 2.我创建的 3.我执行的
-		if (type == 1) {
+		lqw.eq(Task::getYear, dto.getYear() == null ? currentYear : dto.getYear());
+		lqw.eq(Task::getMonth, dto.getMonth() == null ? currentMonth : dto.getMonth());
+
+		//1.全部 2.我创建的 3.我执行的 4.我管理的
+		if (dto.getType() == 1) {
+			Set<Long> ids = new HashSet<>();
+			//我管理的
+			if (dto.getDeptCategory().equals(3)) {
+				//1.业主  ---> 项目权限表里 topDept 字段是自己的集合
+				List<Task> tasks = this.getByCompetentUnit(dto.getTopDept());
+				if (!CollectionUtils.isEmpty(tasks)) {
+					Set<Long> taskIds = tasks.stream().map(Task::getId).collect(Collectors.toSet());
+					ids.addAll(taskIds);
+				}
+			} else if (dto.getDeptCategory().equals(4)) {
+				//2.服务商
+				String role = AuthUtil.getUserRole();
+				Long deptId = Func.firstLong(AuthUtil.getDeptId());
+				if (role.contains(STAFF_ADMIN)) {
+					// 2.1 机构管理员 ---> 任务是派遣给自己机构的
+					List<Task> byOrgDeptId = this.getByOrgDeptId(dto.getTopDept(), null);
+					if (!CollectionUtils.isEmpty(byOrgDeptId)) {
+						Set<Long> taskIds = byOrgDeptId.stream().map(Task::getId).collect(Collectors.toSet());
+						ids.addAll(taskIds);
+					}
+				} else if (role.contains(STAFF_SECOND_ADMIN)) {
+					// 2.2 次级机构主管  ---> 任务是派遣给自己部门的
+					List<Task> list = this.getByExecuteDept(deptId);
+					if (!CollectionUtils.isEmpty(list)) {
+						Set<Long> taskIds = list.stream().map(Task::getId).collect(Collectors.toSet());
+						ids.addAll(taskIds);
+					}
+				}
+			}
 			lqw.and(wq -> {
 				wq.eq(Task::getCreateUser, userId);
 				wq.or().like(Task::getExecuteUser, String.valueOf(userId));
+				wq.in(Task::getId, ids);
 			});
-		} else if (type == 2) {
+		} else if (dto.getType() == 2) {
 			lqw.eq(Task::getCreateUser, userId);
-		} else {
+		} else if (dto.getType() == 3) {
 			lqw.like(Task::getExecuteUser, String.valueOf(userId));
+		} else if (dto.getType() == 4) {
+			//我管理的
+			if (dto.getDeptCategory().equals(3)) {
+				//1.业主  ---> 任务主管单位是自己topDept
+				List<Task> tasks = this.getByCompetentUnit(dto.getTopDept());
+				if (!CollectionUtils.isEmpty(tasks)) {
+					Set<Long> taskIds = tasks.stream().map(Task::getId).collect(Collectors.toSet());
+					lqw.in(Task::getId, taskIds);
+				}
+			} else if (dto.getDeptCategory().equals(4)) {
+				//2.服务商
+				String role = AuthUtil.getUserRole();
+				Long deptId = Func.firstLong(AuthUtil.getDeptId());
+				if (role.contains(STAFF_ADMIN)) {
+					// 2.1 机构管理员 ---> 任务是派遣给自己机构的
+					List<Task> byOrgDeptId = this.getByOrgDeptId(dto.getTopDept(), null);
+					if (!CollectionUtils.isEmpty(byOrgDeptId)) {
+						Set<Long> taskIds = byOrgDeptId.stream().map(Task::getId).collect(Collectors.toSet());
+						lqw.in(Task::getId, taskIds);
+					}
+				} else if (role.contains(STAFF_SECOND_ADMIN)) {
+					// 2.2 次级机构主管  ---> 任务是派遣给自己部门的
+					List<Task> list = this.getByExecuteDept(deptId);
+					if (!CollectionUtils.isEmpty(list)) {
+						Set<Long> taskIds = list.stream().map(Task::getId).collect(Collectors.toSet());
+						lqw.in(Task::getId, taskIds);
+					}
+				}
+			}
 		}
-		if (isGroup == 1) {
+		if (dto.getType() == 1) {
 			lqw.groupBy(Task::getProjectId, Task::getCreateTime);
 			lqw.orderByDesc(Task::getProjectId, Task::getCreateTime);
 		} else {
@@ -521,6 +607,174 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 		return baseMapper.getTodayToExpire(date);
 	}
 
+	@Override
+	public List<Workload> exportList(String startDate, String endDate) {
+		List<Workload> result = new ArrayList<>();
+		//1.时间段内已经完成的任务
+		LambdaQueryWrapper<Task> lqw = new LambdaQueryWrapper<>();
+		lqw.between(Task::getConfirmTime, DateUtil.parse(startDate, "yyyy-MM-dd"), DateUtil.parse(endDate, "yyyy-MM-dd"));
+		List<Task> list = this.list(lqw);
+		if (!CollectionUtils.isEmpty(list)) {
+			List<Workload> tempList = new ArrayList<>();
+			//2.Information for all tasks
+			for (Task task : list) {
+				Workload workload = new Workload();
+				//人员
+				String executeUser = task.getExecuteUser();
+				//项目信息
+				Long projectId = task.getProjectId();
+				//发布人
+				Long createUser = task.getCreateUser();
+				//科研 方案 其他
+				String category = task.getCategory();
+				//新写 修改
+				String tags = task.getTags();
+				if (executeUser != null && projectId != null && createUser != null && createUser > -1L && category != null && tags != null) {
+					//发布人
+					R<User> userR = userClient.userInfoById(createUser);
+					if (userR.isSuccess()) {
+						workload.setPubUser(userR.getData().getName());
+					}
+					//项目信息
+					Project project = projectMapper.selectById(projectId);
+					if (project != null) {
+						workload.setProjectName(project.getName());
+						String areaCode = project.getAreaCode();
+						if (areaCode != null) {
+							if (areaCode.length() == 4) {
+								//市
+								R<Region> region = sysClient.getRegion(areaCode);
+								if (region.isSuccess()) {
+									workload.setCity(region.getData().getName());
+								}
+							} else if (areaCode.length() == 6) {
+								//县
+								R<Region> region = sysClient.getRegion(areaCode);
+								if (region.isSuccess()) {
+									workload.setCounty(region.getData().getName());
+								}
+								//得到上级
+								String parentCode = areaCode.substring(0, areaCode.length() - 2);
+								R<Region> region1 = sysClient.getRegion(parentCode);
+								if (region1.isSuccess()) {
+									workload.setCity(region1.getData().getName());
+								}
+							}
+						}
+
+					}
+
+					//分类 可研 方案 其他
+					R<DictBiz> rpc = dictBizClient.getById(Long.valueOf(category));
+					R<DictBiz> rpc1 = dictBizClient.getById(Long.valueOf(tags));
+					if (rpc.isSuccess() && rpc1.isSuccess()) {
+						DictBiz data = rpc.getData();
+						DictBiz data1 = rpc1.getData();
+						if (data1.getDictKey().equals("1")) {
+							//新编
+							if (data != null) {
+								if (data.getDictKey().equals("2")) {
+									//可研
+									workload.setAdd1(1);
+								} else if (data.getDictKey().equals("4")) {
+									//方案
+									workload.setAdd2(1);
+								} else {
+									//其他
+									workload.setAdd(1);
+								}
+							}
+						} else if (data1.getDictKey().equals("2")) {
+							//修改
+							if (data != null) {
+								if (data.getDictKey().equals("2")) {
+									//可研
+									workload.setAlter1(1);
+								} else if (data.getDictKey().equals("4")) {
+									//方案
+									workload.setAlter2(1);
+								} else {
+									//其他
+									workload.setAlter(1);
+								}
+							}
+						}
+					}
+
+					//人员
+					R<User> userR1 = userClient.userInfoById(Long.valueOf(executeUser));
+					if (userR1.isSuccess()) {
+						workload.setUserName(userR1.getData().getName());
+					}
+					tempList.add(workload);
+				}
+			}
+
+			//Grouping to achieve the purpose of arranging the same user groups
+			if (!CollectionUtils.isEmpty(tempList)) {
+				Map<String, List<Workload>> collect = tempList.stream().collect(Collectors.groupingBy(Workload::getUserName));
+				for (Map.Entry<String, List<Workload>> entry : collect.entrySet()) {
+					result.addAll(entry.getValue());
+				}
+			}
+
+		}
+		return result;
+	}
+
+	@Override
+	public void export(List<Workload> list, HttpServletResponse response) throws IOException {
+		try {
+			WriteCellStyle headWriteCellStyle = new WriteCellStyle();
+			//设置背景颜色
+			headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
+			//设置头字体
+			WriteFont headWriteFont = new WriteFont();
+			headWriteFont.setFontHeightInPoints((short) 13);
+			headWriteFont.setBold(true);
+			headWriteCellStyle.setWriteFont(headWriteFont);
+			//设置头居中
+			headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
+
+			//内容策略
+			WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
+			//设置 水平居中
+			contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
+
+			HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
+
+			response.setContentType("application/vnd.ms-excel");
+			response.setCharacterEncoding("utf-8");
+			// 这里URLEncoder.encode可以防止中文乱码 当然和easy excel没有关系
+			String fileName = URLEncoder.encode("工作量统计", "UTF-8");
+			response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+			// 这里需要设置不关闭流
+			EasyExcel.write(response.getOutputStream(), Workload.class)
+				.registerWriteHandler(horizontalCellStyleStrategy).sheet("工作量统计")
+				.doWrite(list);
+		} catch (IOException e) {
+			//throw new RuntimeException(e);
+			// 重置response
+			response.reset();
+			response.setContentType("application/json");
+			response.setCharacterEncoding("utf-8");
+			Map<String, String> map = new HashMap<String, String>();
+			map.put("status", "failure");
+			map.put("message", "下载文件失败" + e.getMessage());
+			response.getWriter().println(JSON.toJSONString(map));
+		}
+	}
+
+	@Override
+	public List<Task> getByExecuteDept(Long deptId) {
+		return baseMapper.getByExecuteDept(deptId);
+	}
+
+	@Override
+	public List<Task> getByCompetentUnit(Long deptId) {
+		return baseMapper.selectByCompetentUnit(deptId);
+	}
+
 	private List<Task> getListByDateAndStageAndStatus(Long stageId, String formatDate, Integer taskStatus) {
 		return baseMapper.selectByDateAndStageAndStatus(stageId, formatDate, taskStatus);
 	}

+ 74 - 0
blade-service/wt-okr/src/main/java/com/wtkj/util/Workload.java

@@ -0,0 +1,74 @@
+package com.wtkj.util;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-07 09:33
+ * @describe
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class Workload {
+
+	@ExcelProperty(value = {"序号", "序号"})
+	private String sn;
+
+	@ExcelProperty(value = {"人员", "人员"})
+	private String userName;
+
+	@ExcelProperty(value = {"州(市)", "州(市)"})
+	private String city;
+
+	@Excel(name = "县(区)")
+	@ExcelProperty(value = {"县(区)", "县(区)"})
+	private String county;
+
+	@ExcelProperty(value = {"项目名称(项目全称)", "项目名称(项目全称)"})
+	@ColumnWidth(80)
+	private String projectName;
+
+	@Excel(name = "新写", groupName = "其他")
+	@ExcelProperty(value = {"其他", "新写"})
+	private Integer add;
+
+	@ExcelProperty(value = {"其他", "修改"})
+	private Integer alter;
+
+	@ExcelProperty(value = {"可研", "新写"})
+	private Integer add1;
+
+	@ExcelProperty(value = {"可研", "修改"})
+	private Integer alter1;
+
+	@ExcelProperty(value = {"方案", "新写"})
+	private Integer add2;
+
+	@ExcelProperty(value = {"方案", "修改"})
+	private Integer alter2;
+
+	@ExcelProperty(value = {"方案", "发债成功"})
+	private Integer success;
+
+	@ExcelProperty(value = {"公众号", "公众号"})
+	private Integer officialAccount;
+
+	@ExcelProperty(value = {"回款", "回款"})
+	private Integer returnPayment;
+
+	@ExcelProperty(value = {"个人合计情况", "个人合计情况"})
+	private Integer personal;
+
+	@ExcelProperty(value = {"发布人", "发布人"})
+	private String pubUser;
+
+	@ExcelProperty(value = {"核对备注", "核对备注"})
+	private String remark;
+}

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

@@ -1,8 +1,10 @@
 package com.wtkj.wrapper;
 
 import com.wtkj.entity.FileAndFolder;
+import com.wtkj.entity.Project;
 import com.wtkj.service.IFileAndFolderService;
 import com.wtkj.service.IFileReadService;
+import com.wtkj.service.IProjectService;
 import com.wtkj.vo.FileAndFolderVO;
 import com.wutong.file.feign.IFileClient;
 import com.wutong.file.vo.FileVO;
@@ -36,8 +38,8 @@ public class FileAndFolderWrapper extends BaseEntityWrapper<FileAndFolder, FileA
 	private static ISysClient sysClient;
 	private static IFileAndFolderService fileAndFolderService;
 	private static IFileClient fileClient;
-
 	private static IFileReadService fileReadService;
+	private static IProjectService projectService;
 
 	public static FileAndFolderWrapper build() {
 		userClient = SpringUtil.getBean(IUserClient.class);
@@ -45,12 +47,19 @@ public class FileAndFolderWrapper extends BaseEntityWrapper<FileAndFolder, FileA
 		fileAndFolderService = SpringUtil.getBean(IFileAndFolderService.class);
 		fileClient = SpringUtil.getBean(IFileClient.class);
 		fileReadService = SpringUtil.getBean(IFileReadService.class);
+		projectService = SpringUtil.getBean(IProjectService.class);
 		return new FileAndFolderWrapper();
 	}
 
 	@Override
 	public FileAndFolderVO entityVO(FileAndFolder entity) {
 		FileAndFolderVO vo = Objects.requireNonNull(BeanUtil.copy(entity, FileAndFolderVO.class));
+		//所属项目
+		Long projectId = vo.getProjectId();
+		Project project = projectService.getById(projectId);
+		if (project != null) {
+			vo.setProjectName(project.getName());
+		}
 		//创建人
 		Long createUser = vo.getCreateUser();
 		R<User> userR = userClient.userInfoById(createUser);
@@ -75,7 +84,7 @@ public class FileAndFolderWrapper extends BaseEntityWrapper<FileAndFolder, FileA
 				vo.setSuffix(rpc.getData().getSuffix());
 			}
 			//文件阅读人
-			List<Long> userIds = fileReadService.getReadUser(vo.getId());
+			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);

+ 46 - 19
blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskWrapper.java

@@ -1,10 +1,10 @@
 package com.wtkj.wrapper;
 
-import com.wtkj.entity.FileAndFolder;
-import com.wtkj.entity.Project;
-import com.wtkj.entity.Task;
+import com.wtkj.entity.*;
 import com.wtkj.service.IFileAndFolderService;
+import com.wtkj.service.IFileReadService;
 import com.wtkj.service.IProjectService;
+import com.wtkj.service.ITaskFileService;
 import com.wtkj.vo.TaskVO;
 import org.springblade.core.mp.support.BaseEntityWrapper;
 import org.springblade.core.tool.api.R;
@@ -18,10 +18,13 @@ import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
+import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @author Blizzard
@@ -34,8 +37,9 @@ public class TaskWrapper extends BaseEntityWrapper<Task, TaskVO> {
 	private static ISysClient sysClient;
 	private static IFileAndFolderService fileAndFolderService;
 	private static IDictBizClient dictBizClient;
-
 	private static IProjectService projectService;
+	private static IFileReadService fileReadService;
+	private static ITaskFileService taskFileService;
 
 
 	public static TaskWrapper build() {
@@ -44,6 +48,8 @@ public class TaskWrapper extends BaseEntityWrapper<Task, TaskVO> {
 		fileAndFolderService = SpringUtil.getBean(IFileAndFolderService.class);
 		dictBizClient = SpringUtil.getBean(IDictBizClient.class);
 		projectService = SpringUtil.getBean(IProjectService.class);
+		fileReadService = SpringUtil.getBean(IFileReadService.class);
+		taskFileService = SpringUtil.getBean(ITaskFileService.class);
 		return new TaskWrapper();
 	}
 
@@ -57,12 +63,12 @@ public class TaskWrapper extends BaseEntityWrapper<Task, TaskVO> {
 				vo.setProjectName(byId.getName());
 			}
 		}
-		//联系人
+		//项目经理
 		Long projectManager = vo.getProjectManager();
 		if (projectManager != null) {
 			R<User> userR = userClient.userInfoById(projectManager);
 			if (userR.isSuccess()) {
-				vo.setProjectManagerUser(userR.getData());
+				vo.setProjectManagerUser(userR.getData().getName());
 			}
 		}
 		//协作单位
@@ -90,31 +96,52 @@ public class TaskWrapper extends BaseEntityWrapper<Task, TaskVO> {
 		}
 
 		//审核人
-		String checkUser = entity.getCheckUser();
-		if (checkUser != null) {
-			List<User> users = new ArrayList<>();
-			List<Long> userIds = Func.toLongList(checkUser);
-			userIds.forEach(userId -> {
-				R<User> userR = userClient.userInfoById(userId);
-				if (userR.isSuccess()) {
-					users.add(userR.getData());
+		Long first = entity.getFirstCheckUser();
+		Long second = entity.getSecondCheckUser();
+		if (first != null) {
+			R<User> userR = userClient.userInfoById(first);
+			if (userR.isSuccess()) {
+				vo.setFirstUser(userR.getData());
+			}
+		}
+		if (second != null) {
+			R<User> userR = userClient.userInfoById(second);
+			if (userR.isSuccess()) {
+				vo.setSecondUser(userR.getData());
+			}
+		}
+		//审核过的用户
+		//1.成果文件
+		List<Long> users = new ArrayList<>();
+		List<TaskFile> resultFiles = taskFileService.fileList(entity.getId());
+		if (!CollectionUtils.isEmpty(resultFiles)) {
+			//文件ids
+			Set<Long> fileIds = resultFiles.stream().map(TaskFile::getBladeFileId).collect(Collectors.toSet());
+			List<FileRead> reads = fileReadService.getByFileIds(fileIds);
+			if (!CollectionUtils.isEmpty(reads)) {
+				Set<Long> userIds = reads.stream().map(FileRead::getUserId).collect(Collectors.toSet());
+				if (userIds.contains(first)) {
+					users.add(first);
 				}
-			});
-			vo.setCheckUsers(users);
+				if (userIds.contains(second)) {
+					users.add(second);
+				}
+			}
 		}
+		vo.setCheckUserIds(users);
 
 		//任务执行人
 		String executeUser = entity.getExecuteUser();
 		if (executeUser != null) {
-			List<User> users = new ArrayList<>();
+			List<String> execUsers = new ArrayList<>();
 			List<Long> userIds = Func.toLongList(executeUser);
 			userIds.forEach(userId -> {
 				R<User> userR = userClient.userInfoById(userId);
 				if (userR.isSuccess()) {
-					users.add(userR.getData());
+					execUsers.add(userR.getData().getName());
 				}
 			});
-			vo.setExecuteUsers(users);
+			vo.setExecuteUsers(execUsers);
 		}
 
 		//任务相关联文件