Browse Source

fix: directory refactor

Blizzard 1 year ago
parent
commit
28d2b12e7a
45 changed files with 409 additions and 395 deletions
  1. 6 6
      blade-biz-common/pom.xml
  2. 0 0
      blade-biz-common/src/main/java/org/springblade/common/cache/CacheNames.java
  3. 0 0
      blade-biz-common/src/main/java/org/springblade/common/config/BladeCommonConfiguration.java
  4. 0 0
      blade-biz-common/src/main/java/org/springblade/common/constant/CommonConstant.java
  5. 0 0
      blade-biz-common/src/main/java/org/springblade/common/constant/LauncherConstant.java
  6. 0 0
      blade-biz-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java
  7. 0 0
      blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java
  8. 0 0
      blade-biz-common/src/main/resources/banner.txt
  9. 3 2
      blade-service-api/pom.xml
  10. 10 3
      blade-service-api/wt-okr-api/pom.xml
  11. 0 67
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/DeptToDept.java
  12. 1 1
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/Project.java
  13. 4 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/ProjectStage.java
  14. 21 0
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/entity/Qrcode.java
  15. 0 25
      blade-service-api/wt-okr-api/src/main/java/com/wtkj/feign/IOkrClient.java
  16. 8 8
      blade-service/pom.xml
  17. 13 17
      blade-service/wt-okr/pom.xml
  18. 1 2
      blade-service/wt-okr/src/main/java/com/wtkj/OKRServiceApplication.java
  19. 38 20
      blade-service/wt-okr/src/main/java/com/wtkj/controller/QrCodeController.java
  20. 0 28
      blade-service/wt-okr/src/main/java/com/wtkj/feign/OkrClient.java
  21. 45 0
      blade-service/wt-okr/src/main/java/com/wtkj/handler/Schedule.java
  22. 0 15
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/DeptToDeptMapper.java
  23. 0 9
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/DeptToDeptMapper.xml
  24. 1 2
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileReadMapper.java
  25. 1 4
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/FileReadMapper.xml
  26. 1 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/ProjectAuthMapper.java
  27. 0 3
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/ProjectMapper.java
  28. 0 9
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/ProjectMapper.xml
  29. 1 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.java
  30. 4 0
      blade-service/wt-okr/src/main/java/com/wtkj/mapper/TaskMapper.xml
  31. 0 19
      blade-service/wt-okr/src/main/java/com/wtkj/service/IDeptToDeptService.java
  32. 1 2
      blade-service/wt-okr/src/main/java/com/wtkj/service/IFileReadService.java
  33. 0 2
      blade-service/wt-okr/src/main/java/com/wtkj/service/IProjectService.java
  34. 8 3
      blade-service/wt-okr/src/main/java/com/wtkj/service/IQrcodeService.java
  35. 1 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/ITaskService.java
  36. 94 40
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java
  37. 0 1
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/CommonServiceImpl.java
  38. 0 58
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/DeptToDeptServiceImpl.java
  39. 2 2
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/FileReadServiceImpl.java
  40. 33 6
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ProjectServiceImpl.java
  41. 79 21
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/QrcodeServiceImpl.java
  42. 5 0
      blade-service/wt-okr/src/main/java/com/wtkj/service/impl/TaskServiceImpl.java
  43. 16 7
      blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskWrapper.java
  44. 3 1
      blade-service/wt-okr/src/main/resources/application-prod.yml
  45. 9 12
      pom.xml

+ 6 - 6
blade-common/pom.xml → blade-biz-common/pom.xml

@@ -2,19 +2,19 @@
 <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="http://maven.apache.org/POM/4.0.0"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
+
     <parent>
-        <groupId>com.wtkj</groupId>
         <artifactId>wt-service-okr</artifactId>
-        <version>1.0.RELEASE</version>
+        <groupId>org.springblade</groupId>
+        <version>2.9.1.RELEASE</version>
     </parent>
+    <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>blade-common</artifactId>
+    <artifactId>blade-biz-common</artifactId>
     <name>${project.artifactId}</name>
-    <version>1.0.RELEASE</version>
+    <version>2.9.1.RELEASE</version>
     <packaging>jar</packaging>
 
-
     <dependencies>
         <dependency>
             <groupId>org.springblade</groupId>

+ 0 - 0
blade-common/src/main/java/org/springblade/common/cache/CacheNames.java → blade-biz-common/src/main/java/org/springblade/common/cache/CacheNames.java


+ 0 - 0
blade-common/src/main/java/org/springblade/common/config/BladeCommonConfiguration.java → blade-biz-common/src/main/java/org/springblade/common/config/BladeCommonConfiguration.java


+ 0 - 0
blade-common/src/main/java/org/springblade/common/constant/CommonConstant.java → blade-biz-common/src/main/java/org/springblade/common/constant/CommonConstant.java


+ 0 - 0
blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java → blade-biz-common/src/main/java/org/springblade/common/constant/LauncherConstant.java


+ 0 - 0
blade-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java → blade-biz-common/src/main/java/org/springblade/common/launch/LauncherServiceImpl.java


+ 0 - 0
blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java → blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java


+ 0 - 0
blade-common/src/main/resources/banner.txt → blade-biz-common/src/main/resources/banner.txt


+ 3 - 2
blade-service-api/pom.xml

@@ -2,14 +2,15 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <groupId>com.wtkj</groupId>
         <artifactId>wt-service-okr</artifactId>
-        <version>1.0.RELEASE</version>
+        <groupId>org.springblade</groupId>
+        <version>2.9.1.RELEASE</version>
     </parent>
 
     <artifactId>blade-service-api</artifactId>
     <packaging>pom</packaging>
     <name>blade-service-api</name>
+    <version>2.9.1.RELEASE</version>
 
     <modules>
         <module>wt-okr-api</module>

+ 10 - 3
blade-service-api/wt-okr-api/pom.xml

@@ -2,13 +2,14 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <groupId>com.wtkj</groupId>
+        <groupId>org.springblade</groupId>
         <artifactId>blade-service-api</artifactId>
-        <version>1.0.RELEASE</version>
+        <version>2.9.1.RELEASE</version>
     </parent>
 
+    <groupId>com.wtkj</groupId>
     <artifactId>wt-okr-api</artifactId>
-    <version>1.0.RELEASE</version>
+    <version>2.9.1.RELEASE</version>
     <packaging>jar</packaging>
 
     <name>wt-okr-api</name>
@@ -37,5 +38,11 @@
             <version>2.9.1.RELEASE</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.wtkj</groupId>
+            <artifactId>wutong-base-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+
     </dependencies>
 </project>

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

@@ -1,67 +0,0 @@
-package com.wtkj.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.springblade.core.mp.base.BaseEntity;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @author Blizzard
- * @create at 2023-09-14 10:54
- * @describe
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName("blade_dept_to_dept")
-public class DeptToDept extends BaseEntity {
-	private static final long serialVersionUID = 1L;
-
-
-	@JsonSerialize(using = ToStringSerializer.class)
-	@TableField("org_dept_id")
-	@ApiModelProperty(value = "服务机构顶级id")
-	@NotNull(message = "orgDeptId can't be null")
-	private Long orgDeptId;
-
-	@ApiModelProperty("租户ID")
-	private String tenantId;
-
-	@JsonSerialize(using = ToStringSerializer.class)
-	@ApiModelProperty("父主键")
-	private Long parentId;
-
-	@ApiModelProperty("机构名")
-	private String deptName;
-
-	@ApiModelProperty("机构全称")
-	private String fullName;
-
-	@ApiModelProperty("地区编码")
-	private String areaCode;
-
-	@ApiModelProperty("祖级机构主键")
-	private String ancestors;
-
-	@ApiModelProperty("机构类型")
-	private Integer deptCategory;
-
-	@ApiModelProperty("排序")
-	private Integer sort;
-
-	@ApiModelProperty("备注")
-	private String remark;
-
-	@TableField("social_credit_code")
-	private String socialCreditCode;
-
-	@TableField("license_file_id")
-	@JsonSerialize(using = ToStringSerializer.class)
-	private Long licenseFileId;
-
-}

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

@@ -88,7 +88,7 @@ public class Project extends BaseEntity {
 
 	@TableField("img_id")
 	@ApiModelProperty(value = "项目图片文件ID")
-	private Long imgId;
+	private Long imgId = 1711941608824688642L;
 
 
 

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

@@ -34,6 +34,10 @@ public class ProjectStage extends BaseEntity {
 	@ApiModelProperty("名称")
 	private String name;
 
+	@TableField("stage_status")
+	@ApiModelProperty("阶段状态:1:正常 2:异常 3:失控")
+	private Integer stageStatus = 1;
+
 	@TableField("sort")
 	@ApiModelProperty("排序")
 	@NotNull(message = "sort不可为空")

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

@@ -0,0 +1,21 @@
+package com.wtkj.entity;
+
+import java.io.Serializable;
+
+/**
+ * @author Blizzard
+ * @create at 2023-10-11 16:28
+ * @describe
+ */
+public class Qrcode implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private String id;
+
+	private Long createUser;
+
+	private Long topDeptId;
+
+
+}

+ 0 - 25
blade-service-api/wt-okr-api/src/main/java/com/wtkj/feign/IOkrClient.java

@@ -1,25 +0,0 @@
-package com.wtkj.feign;
-
-
-import com.wtkj.entity.WorkStatus;
-import org.springblade.core.tool.api.R;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-/**
- * @author Blizzard
- * @create at 2023-09-25 16:11
- * @describe
- */
-@FeignClient(value = "wutong-okr")
-public interface IOkrClient {
-
-	String API_PReFIX = "/client";
-
-	String WORK_STATUS = API_PReFIX + "/work-status";
-
-
-	@GetMapping(WORK_STATUS)
-	R<WorkStatus> workStatus(@RequestParam Long userId);
-}

+ 8 - 8
blade-service/pom.xml

@@ -2,15 +2,16 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <groupId>com.wtkj</groupId>
         <artifactId>wt-service-okr</artifactId>
-        <version>1.0.RELEASE</version>
+        <groupId>org.springblade</groupId>
+        <version>2.9.1.RELEASE</version>
     </parent>
 
     <artifactId>blade-service</artifactId>
     <packaging>pom</packaging>
+    <version>2.9.1.RELEASE</version>
+    <name>${project.artifactId}</name>
 
-    <name>blade-service</name>
 
     <modules>
         <module>wt-okr</module>
@@ -20,16 +21,15 @@
     <dependencies>
         <dependency>
             <groupId>org.springblade</groupId>
-            <artifactId>blade-starter-tenant</artifactId>
+            <artifactId>blade-biz-common</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springblade</groupId>
-            <artifactId>blade-starter-api-crypto</artifactId>
+            <artifactId>blade-starter-tenant</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.wtkj</groupId>
-            <artifactId>blade-common</artifactId>
-            <version>1.0.RELEASE</version>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-starter-api-crypto</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springblade</groupId>

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

@@ -2,21 +2,19 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <groupId>com.wtkj</groupId>
         <artifactId>blade-service</artifactId>
-        <version>1.0.RELEASE</version>
+        <groupId>org.springblade</groupId>
+        <version>2.9.1.RELEASE</version>
     </parent>
 
+    <groupId>com.wtkj</groupId>
     <artifactId>wt-okr</artifactId>
+    <name>${project.artifactId}</name>
+    <version>${bladex.project.version}</version>
     <packaging>jar</packaging>
-    <name>wt-okr</name>
 
 
     <dependencies>
-        <dependency>
-            <groupId>com.wtkj</groupId>
-            <artifactId>blade-common</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.springblade</groupId>
             <artifactId>blade-core-boot</artifactId>
@@ -25,16 +23,7 @@
             <groupId>org.springblade</groupId>
             <artifactId>blade-starter-swagger</artifactId>
         </dependency>
-        <dependency>
-            <groupId>com.wtkj</groupId>
-            <artifactId>wt-okr-api</artifactId>
-            <version>1.0.RELEASE</version>
-        </dependency>
-        <dependency>
-            <groupId>com.wtkj</groupId>
-            <artifactId>wutong-base-api</artifactId>
-            <version>2.9.1.RELEASE</version>
-        </dependency>
+
 
 
         <!--数据导出-->
@@ -114,6 +103,13 @@
             <version>3.1.875</version>
         </dependency>
 
+
+        <dependency>
+            <groupId>com.wtkj</groupId>
+            <artifactId>wt-okr-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+
     </dependencies>
 
 

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

@@ -4,14 +4,13 @@ import org.springblade.common.constant.LauncherConstant;
 import org.springblade.core.cloud.feign.EnableBladeFeign;
 import org.springblade.core.launch.BladeApplication;
 import org.springblade.core.transaction.annotation.SeataCloudApplication;
-import org.springframework.cloud.client.SpringCloudApplication;
 
 /**
  * @author Blizzard
  * @create at 2023-09-13 11:12
  * @describe
  */
-@SpringCloudApplication
+
 @EnableBladeFeign
 @SeataCloudApplication
 public class OKRServiceApplication {

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

@@ -3,7 +3,6 @@ package com.wtkj.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import com.wtkj.dto.InviteToDeptDTO;
 import com.wtkj.entity.ApplyJoin;
 import com.wtkj.entity.FileShare;
 import com.wtkj.service.IApplyJoinService;
@@ -14,7 +13,6 @@ import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
-import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springframework.web.bind.annotation.*;
 
@@ -37,27 +35,37 @@ public class QrCodeController {
 	/**
 	 * 生成二维码
 	 */
-	@GetMapping("/create-qrcode")
-	@ApiOperation(value = "生成邀请用户为联系人二维码", notes = "")
+	@GetMapping("/create-dept-qrcode")
+	@ApiOperation(value = "生成邀请用户至机构二维码", notes = "传入部门id")
 	@ApiOperationSupport(order = 1)
-	public R createQrcode() {
-		return R.data(qrcodeService.createQrcode());
+	public R createQrcode(@RequestParam Long deptId) {
+		return R.data(qrcodeService.createDeptQrcode(deptId));
 	}
 
 	/**
-	 * 邀请至机构下
+	 * 扫描二维码展现文字内容
 	 */
-	@PostMapping("/invite-to-dept")
-	@ApiOperation(value = "接受邀请加入机构", notes = "type:1 邀请内部联系人 2:外部联系人")
+	@GetMapping("/scan-invite-to-dept")
+	@ApiOperation(value = "扫描邀请至部门二维码", notes = "")
 	@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()));
+	public R scanInviteToDept(@RequestParam String qrcodeId, @RequestParam Long createUser, @RequestParam Long deptId) {
+		return R.data(qrcodeService.scanInviteToDept(qrcodeId, createUser, deptId));
+	}
+
+	/**
+	 * 邀请至机构下
+	 */
+	@GetMapping("/invite-to-dept")
+	@ApiOperation(value = "接受邀请加入机构", notes = "")
+	@ApiOperationSupport(order = 3)
+	public R inviteToDept(@RequestParam String qrcodeId, @RequestParam Long createUser, @RequestParam Long deptId) {
+		return R.status(qrcodeService.inviteToDept(qrcodeId, createUser, deptId));
 	}
 
 
 	@PostMapping("/apply-to-dept")
 	@ApiOperation(value = "申请加入机构", notes = "")
-	@ApiOperationSupport(order = 3)
+	@ApiOperationSupport(order = 4)
 	public R applyToDept(@RequestBody @Valid ApplyJoin join) {
 		return R.status(applyJoinService.saveOrUpdate(join));
 	}
@@ -67,7 +75,7 @@ public class QrCodeController {
 	 */
 	@GetMapping("/apply-page")
 	@ApiOperation(value = "申请列表", notes = "传入当前登录用户顶级机构id")
-	@ApiOperationSupport(order = 4)
+	@ApiOperationSupport(order = 5)
 	public R applyPage(@RequestParam Long topDept, Query query) {
 		IPage<ApplyJoin> page = applyJoinService.page(Condition.getPage(query), new LambdaQueryWrapper<ApplyJoin>().eq(ApplyJoin::getDeptId, topDept));
 		return R.data(ApplyJoinWrapper.build().pageVO(page));
@@ -78,7 +86,7 @@ public class QrCodeController {
 	 */
 	@GetMapping("/agree-apply")
 	@ApiOperation(value = "同意加入机构", notes = "传入记录主键id")
-	@ApiOperationSupport(order = 5)
+	@ApiOperationSupport(order = 6)
 	public R agreeJoinDept(@RequestParam Long id) {
 		return R.status(applyJoinService.agreeApply(id));
 	}
@@ -88,20 +96,30 @@ public class QrCodeController {
 	 */
 	@GetMapping("/create-group-qrcode")
 	@ApiOperation(value = "生成邀请至项目组二维码", notes = "")
-	@ApiOperationSupport(order = 6)
+	@ApiOperationSupport(order = 7)
 	public R createGroupQrcode(@RequestParam Long projectId) {
 		return R.data(qrcodeService.createGroupQrcode(projectId));
 	}
 
+	/**
+	 * 扫描邀请至项目组二维码
+	 */
+	@GetMapping("/scan-invite-to-project")
+	@ApiOperation(value = "扫描邀请至项目组二维码", notes = "")
+	@ApiOperationSupport(order = 8)
+	public R scanInviteToProject(@RequestParam String qrcodeId, @RequestParam Long createUser, @RequestParam Long projectId, @RequestParam Long topDept) {
+		return R.data(R.data(qrcodeService.scanInviteToProject(qrcodeId, createUser, projectId, topDept)));
+	}
+
 
 	/**
 	 * 邀请至项目组
 	 */
 	@GetMapping("/invite-to-project")
 	@ApiOperation(value = "接受邀请至项目组", notes = "deptId:服务商的顶级机构id")
-	@ApiOperationSupport(order = 7)
-	public R inviteToProject(@RequestParam String qrcodeId, @RequestParam Long topDept, @RequestParam Long projectId) {
-		return R.status(qrcodeService.inviteToProject(qrcodeId, topDept, projectId));
+	@ApiOperationSupport(order = 9)
+	public R inviteToProject(@RequestParam String qrcodeId, @RequestParam Long createUser, @RequestParam Long projectId, @RequestParam Long topDept) {
+		return R.status(qrcodeService.inviteToProject(qrcodeId, createUser, projectId,topDept));
 	}
 
 
@@ -109,7 +127,7 @@ public class QrCodeController {
 	 * 生成一条分享记录
 	 */
 	@PostMapping("/save-share")
-	@ApiOperationSupport(order = 8)
+	@ApiOperationSupport(order = 10)
 	@ApiOperation(value = "生成文件分享", notes = "ids:文件的")
 	public R saveShare(@RequestBody FileShare share) {
 		return R.data(qrcodeService.savaShare(share));
@@ -119,7 +137,7 @@ public class QrCodeController {
 	 * 查看分享
 	 */
 	@PostMapping("/get-share")
-	@ApiOperationSupport(order = 9)
+	@ApiOperationSupport(order = 11)
 	@ApiOperation(value = "查看文件分享", notes = "传入二维码返回ID")
 	public R getShare(@RequestParam Long id) {
 		return R.data(qrcodeService.getShare(id));

+ 0 - 28
blade-service/wt-okr/src/main/java/com/wtkj/feign/OkrClient.java

@@ -1,28 +0,0 @@
-package com.wtkj.feign;
-
-import com.wtkj.entity.WorkStatus;
-import com.wtkj.service.IWorkStatusService;
-import lombok.AllArgsConstructor;
-import org.springblade.core.tenant.annotation.NonDS;
-import org.springblade.core.tool.api.R;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author Blizzard
- * @create at 2023-09-25 16:21
- * @describe
- */
-@NonDS
-@RestController
-@AllArgsConstructor
-public class OkrClient implements IOkrClient {
-
-	private final IWorkStatusService workStatusService;
-
-	@Override
-	@GetMapping(WORK_STATUS)
-	public R<WorkStatus> workStatus(Long userId) {
-		return R.data(workStatusService.workStatus(userId));
-	}
-}

+ 45 - 0
blade-service/wt-okr/src/main/java/com/wtkj/handler/Schedule.java

@@ -1,10 +1,13 @@
 package com.wtkj.handler;
 
 import com.wtkj.entity.Project;
+import com.wtkj.entity.ProjectStage;
 import com.wtkj.entity.Task;
 import com.wtkj.service.IProjectService;
+import com.wtkj.service.IProjectStageService;
 import com.wtkj.service.ITaskService;
 import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.redis.cache.BladeRedis;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -27,6 +30,11 @@ public class Schedule {
 	private ITaskService taskService;
 	@Autowired
 	private IProjectService projectService;
+	@Autowired
+	private IProjectStageService stageService;
+	@Autowired
+	private BladeRedis redis;
+
 
 	@Scheduled(cron = "0 0 3 * * ?")
 	private void task() {
@@ -47,4 +55,41 @@ public class Schedule {
 			taskService.updateBatchById(tasks);
 		}
 	}
+
+	@Scheduled(cron = "0 0 4 * * ?")
+	private void stageStatusTask() {
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 设置日期格式
+		String now = LocalDate.now().format(formatter);
+
+		//1.是否有逾期任务
+		List<Task> tasks = taskService.getByStatus(6);
+		if (!CollectionUtils.isEmpty(tasks)) {
+			int expireSize = tasks.size();
+			tasks.forEach(task -> {
+				Long stageId = task.getStageId();
+				ProjectStage stage = stageService.getById(stageId);
+				if (stage != null) {
+					//有逾期 就为异常
+					stage.setStageStatus(2);
+
+					//失控  --->阶段下任务逾期数量 > 平均每天完成任务量
+					//1.阶段周期
+					List<LocalDate> dateList = redis.get("dateList::" + stageId);
+					if (!CollectionUtils.isEmpty(dateList)) {
+						int size = dateList.size();
+						List<Task> allTask = taskService.listByStageId(stageId);
+						if (!CollectionUtils.isEmpty(allTask)) {
+							int taskAmount = allTask.size();
+							// 理想每天任务完成量
+							float avg = (float) taskAmount / size;
+							if (expireSize > avg) {
+								stage.setStageStatus(3);
+							}
+						}
+					}
+					stageService.updateById(stage);
+				}
+			});
+		}
+	}
 }

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

@@ -1,15 +0,0 @@
-package com.wtkj.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.wtkj.entity.DeptToDept;
-
-import java.util.List;
-
-/**
- * @author Blizzard
- * @create at 2023-09-14 11:00
- * @describe
- */
-public interface DeptToDeptMapper extends BaseMapper<DeptToDept> {
-	List<DeptToDept> selectByTopDept(Long topDept);
-}

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

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

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

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

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

@@ -7,9 +7,6 @@
     </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="collection" open="(" separator="," close=")" index="index" item="item">
-            #{item}
-        </foreach>
+        select * from blade_file_read where is_deleted = 0 and user_id = #{param}
     </select>
 </mapper>

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

@@ -1,5 +1,6 @@
 package com.wtkj.mapper;
 
+
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.wtkj.entity.ProjectAuth;
 

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

@@ -3,13 +3,10 @@ package com.wtkj.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.wtkj.entity.Project;
 
-import java.util.Set;
-
 /**
  * @author Blizzard
  * @create at 2023-09-13 16:01
  * @describe
  */
 public interface ProjectMapper extends BaseMapper<Project> {
-	Set<Long> selectByCreate(Long createDept, Long createUser);
 }

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

@@ -3,13 +3,4 @@
 <mapper namespace="com.wtkj.mapper.ProjectMapper">
 
 
-    <select id="selectByCreate" resultType="java.lang.Long">
-        select distinct id from blade_project where is_deleted = 0
-        <if test="param1 != null">
-            and create_dept = #{param1}
-        </if>
-        <if test="param2 != null">
-            and create_user = #{param2}
-        </if>
-    </select>
 </mapper>

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

@@ -38,4 +38,5 @@ public interface TaskMapper extends BaseMapper<Task> {
 
 	List<Task> getTodayToExpire(String date);
 
+	List<Task> selectByTaskStatus(Integer status);
 }

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

@@ -101,4 +101,8 @@
         and task_status != 6
     </select>
 
+    <select id="selectByTaskStatus" resultType="com.wtkj.entity.Task">
+        select * from blade_task where is_deleted = 0 and task_status = #{param}
+    </select>
+
 </mapper>

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

@@ -1,19 +0,0 @@
-package com.wtkj.service;
-
-import com.wtkj.entity.DeptToDept;
-import org.springblade.core.mp.base.BaseService;
-import org.springblade.system.entity.Dept;
-
-import java.util.List;
-
-/**
- * @author Blizzard
- * @create at 2023-09-14 11:10
- * @describe
- */
-public interface IDeptToDeptService extends BaseService<DeptToDept> {
-
-	List<Dept> getDept(Long topDept, String areaCode, String name, Integer category);
-
-	List<DeptToDept> getByTopDept(Long topDept);
-}

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

@@ -5,7 +5,6 @@ import org.springblade.core.mp.base.BaseService;
 import org.springblade.system.user.entity.User;
 
 import java.util.List;
-import java.util.Set;
 
 /**
  * @author Blizzard
@@ -15,7 +14,7 @@ import java.util.Set;
 public interface IFileReadService extends BaseService<FileRead> {
 	boolean readFile(FileRead read);
 
-	List<FileRead> getByFileIds(Set<Long> fileIds);
+	List<FileRead> getByUser(Long userId);
 
 	List<User> fileRead(String bladeFileId);
 

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

@@ -7,7 +7,6 @@ import com.wtkj.vo.ProjectStatisticsVO;
 import org.springblade.core.mp.base.BaseService;
 
 import java.util.List;
-import java.util.Set;
 
 /**
  * @author Blizzard
@@ -19,7 +18,6 @@ public interface IProjectService extends BaseService<Project> {
 
 	IPage<Project> getPage(ProjectPageDTO dto, IPage<Project> page);
 
-	Set<Long> getByCreate(Long createDept, Long createUser);
 
 	ProjectStatisticsVO projectStatistics(Long topDept, Integer deptCategory, String year);
 

+ 8 - 3
blade-service/wt-okr/src/main/java/com/wtkj/service/IQrcodeService.java

@@ -14,15 +14,20 @@ import java.util.List;
 public interface IQrcodeService {
 
 
-	JSONObject createQrcode();
+	JSONObject createDeptQrcode(Long deptId);
 
-	boolean inviteToDept(Long createUser, Integer type, String qrcodeId, Long userId, Long deptId);
+	boolean inviteToDept(String qrcodeId, Long createUser, Long deptId);
 
-	boolean inviteToProject(String qrcodeId, Long deptId, Long projectId);
+	JSONObject scanInviteToDept(String qrcodeId, Long createUser, Long deptId);
+
+	boolean inviteToProject(String qrcodeId, Long createUser, Long projectId, Long topDept);
+
+	JSONObject scanInviteToProject(String qrcodeId, Long createUser, Long projectId, Long topDept);
 
 	JSONObject createGroupQrcode(Long projectId);
 
 	Long savaShare(FileShare share);
 
 	List<FileAttach> getShare(Long id);
+
 }

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

@@ -97,4 +97,5 @@ public interface ITaskService extends BaseService<Task> {
 
 	List<Task> getByCompetentUnit(Long deptId);
 
+	List<Task> getByStatus(Integer status);
 }

+ 94 - 40
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/AsyncServiceImpl.java

@@ -90,31 +90,6 @@ public class AsyncServiceImpl implements IAsyncService {
 			}
 		}
 
-		//权限
-		String deptIdStr = user.getDeptId();
-		if (deptIdStr != null) {
-			Long deptId = Func.firstLong(deptIdStr);
-			ProjectAuth auth = new ProjectAuth();
-			auth.setUserId(user.getUserId());
-			R<Dept> rpc = sysClient.getDept(deptId);
-			if (rpc.isSuccess()) {
-				String ancestors = rpc.getData().getAncestors();
-				if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
-					List<Long> parentIds = Func.toLongList(ancestors);
-					if (!CollectionUtils.isEmpty(parentIds)) {
-						if (parentIds.size() > 1) {
-							auth.setTopDept(parentIds.get(1));
-						} else {
-							auth.setTopDept(Long.valueOf(deptIdStr));
-						}
-					}
-				}
-			}
-			auth.setUserDept(deptId);
-			auth.setProjectId(project.getId());
-			projectAuthService.save(auth);
-		}
-
 	}
 
 
@@ -156,7 +131,6 @@ public class AsyncServiceImpl implements IAsyncService {
 			if (createUser != null) {
 				R<User> userR = userClient.userInfoById(createUser);
 				if (userR.isSuccess()) {
-					List<TaskLog> logs = new ArrayList<>();
 
 					TaskLog log = new TaskLog();
 					log.setId(IdWorker.getId());
@@ -169,7 +143,8 @@ public class AsyncServiceImpl implements IAsyncService {
 					Date time = DateUtil.now();
 					log.setCreateTime(time);
 					log.setUpdateTime(time);
-					logs.add(log);
+					taskLogService.save(log);
+
 					Long orgDeptId = null;
 					if (task.getOrgDeptId() != null && task.getOrgDeptId() > 0L) {
 						orgDeptId = task.getOrgDeptId();
@@ -184,10 +159,9 @@ public class AsyncServiceImpl implements IAsyncService {
 							taskLog.setCreateDept(task.getCreateDept());
 							taskLog.setCreateUser(task.getCreateUser());
 							taskLog.setUpdateUser(task.getUpdateUser());
-							time.setTime(time.getTime() + 1000);
-							taskLog.setCreateTime(time);
-							taskLog.setUpdateTime(time);
-							logs.add(taskLog);
+							taskLog.setCreateTime(DateUtil.now());
+							taskLog.setUpdateTime(DateUtil.now());
+							taskLogService.save(taskLog);
 
 							//项目权限
 							ProjectAuth auth = new ProjectAuth();
@@ -257,7 +231,6 @@ public class AsyncServiceImpl implements IAsyncService {
 							});
 						}
 					}
-					taskLogService.saveBatch(logs);
 					if (!CollectionUtils.isEmpty(auths)) {
 						projectAuthService.saveBatch(auths);
 					}
@@ -274,7 +247,6 @@ public class AsyncServiceImpl implements IAsyncService {
 	public void alterTask(Task afterUpdate, Task beforeUpdate, Long userId) {
 		R<User> userR = userClient.userInfoById(userId);
 		if (userR.isSuccess()) {
-			List<TaskLog> logs = new ArrayList<>();
 			List<ProjectAuth> auths = new ArrayList<>();
 			List<ProjectGroup> groups = new ArrayList<>();
 
@@ -298,7 +270,7 @@ public class AsyncServiceImpl implements IAsyncService {
 					log.setUpdateUser(afterUpdate.getUpdateUser());
 					log.setCreateTime(DateUtil.now());
 					log.setUpdateTime(DateUtil.now());
-					logs.add(log);
+					taskLogService.save(log);
 
 					ProjectAuth auth = new ProjectAuth();
 					auth.setTopDept(orgDeptId);
@@ -320,7 +292,7 @@ public class AsyncServiceImpl implements IAsyncService {
 					log1.setUpdateUser(userId);
 					log1.setCreateTime(DateUtil.now());
 					log1.setUpdateTime(DateUtil.now());
-					logs.add(log1);
+					taskLogService.save(log1);
 
 					ProjectAuth auth = new ProjectAuth();
 					auth.setTopDept(orgDeptId);
@@ -346,7 +318,7 @@ public class AsyncServiceImpl implements IAsyncService {
 					log2.setUpdateUser(userId);
 					log2.setCreateTime(DateUtil.now());
 					log2.setUpdateTime(DateUtil.now());
-					logs.add(log2);
+					taskLogService.save(log2);
 
 					String deptStr = userR1.getData().getDeptId();
 					if (StringUtil.isNotBlank(deptStr) && orgDeptId != null) {
@@ -412,7 +384,7 @@ public class AsyncServiceImpl implements IAsyncService {
 					log3.setUpdateUser(userId);
 					log3.setCreateTime(DateUtil.now());
 					log3.setUpdateTime(DateUtil.now());
-					logs.add(log3);
+					taskLogService.save(log3);
 				}
 			}
 
@@ -466,7 +438,7 @@ public class AsyncServiceImpl implements IAsyncService {
 					log4.setUpdateUser(userId);
 					log4.setCreateTime(DateUtil.now());
 					log4.setUpdateTime(DateUtil.now());
-					logs.add(log4);
+					taskLogService.save(log4);
 				}
 			}
 
@@ -480,6 +452,7 @@ public class AsyncServiceImpl implements IAsyncService {
 				log.setUpdateUser(userId);
 				log.setCreateTime(DateUtil.now());
 				log.setUpdateTime(DateUtil.now());
+				taskLogService.save(log);
 			}
 
 			//7.审查任务
@@ -492,6 +465,7 @@ public class AsyncServiceImpl implements IAsyncService {
 				log.setUpdateUser(userId);
 				log.setCreateTime(DateUtil.now());
 				log.setUpdateTime(DateUtil.now());
+				taskLogService.save(log);
 			}
 
 			//8.二次审查任务
@@ -504,6 +478,7 @@ public class AsyncServiceImpl implements IAsyncService {
 				log.setUpdateUser(userId);
 				log.setCreateTime(DateUtil.now());
 				log.setUpdateTime(DateUtil.now());
+				taskLogService.save(log);
 			}
 
 			//9.确认任务
@@ -516,6 +491,7 @@ public class AsyncServiceImpl implements IAsyncService {
 				log.setUpdateUser(userId);
 				log.setCreateTime(DateUtil.now());
 				log.setUpdateTime(DateUtil.now());
+				taskLogService.save(log);
 
 				//项目下待完成的任务减少
 				Project project = projectMapper.selectById(projectId);
@@ -534,6 +510,7 @@ public class AsyncServiceImpl implements IAsyncService {
 				log.setUpdateUser(userId);
 				log.setCreateTime(DateUtil.now());
 				log.setUpdateTime(DateUtil.now());
+				taskLogService.save(log);
 
 				//项目下待完成的任务减少
 				Project project = projectMapper.selectById(projectId);
@@ -542,8 +519,6 @@ public class AsyncServiceImpl implements IAsyncService {
 					projectMapper.updateById(project);
 				}
 			}
-
-			taskLogService.saveBatch(logs);
 			if (!CollectionUtils.isEmpty(auths)) {
 				projectAuthService.saveBatch(auths);
 			}
@@ -919,6 +894,85 @@ public class AsyncServiceImpl implements IAsyncService {
 				}
 			}
 		}
+
+		String executeUser = task.getExecuteUser();
+		if (!StringUtil.isNotBlank(executeUser)) {
+			Date endTime = task.getEndTime();
+			String format = DateUtil.format(endTime, "yyyy-MM-dd");
+			List<Long> users = Func.toLongList(executeUser);
+			if (userR.isSuccess() && project != null) {
+				String name = userR.getData().getName();
+				users.forEach(user -> {
+					R<User> userR1 = userClient.userInfoById(userId);
+					if (userR1.isSuccess()) {
+						String phone = userR1.getData().getPhone();
+						if (StringUtil.isNotBlank(name) && StringUtil.isNotBlank(phone)) {
+							try {
+								//发送短信
+								// 1.创建一个认证对象
+								Credential cred = new Credential(NacosConfigValue.txSecretId, NacosConfigValue.txSecretKey);
+								//2.实例化一个http选项
+								HttpProfile httpProfile = new HttpProfile();
+								httpProfile.setReqMethod("POST");
+								httpProfile.setConnTimeout(60);
+								httpProfile.setEndpoint("sms.tencentcloudapi.com");
+								//3实例化一个客户端配置对象
+								ClientProfile clientProfile = new ClientProfile();
+								clientProfile.setSignMethod("HmacSHA256");
+								clientProfile.setHttpProfile(httpProfile);
+								SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
+
+								//4.实例化请求对象
+								SendSmsRequest req = new SendSmsRequest();
+								String sdkAppId = "1400785942";
+								req.setSmsSdkAppid(sdkAppId);
+
+								String signName = "梧桐树网";
+								req.setSign(signName);
+
+								//任务下发通知模版id
+								String templateId = "1948622";
+								req.setTemplateID(templateId);
+
+								/* 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 */
+								String[] templateParamSet = {name, format};
+								req.setTemplateParamSet(templateParamSet);
+
+								String[] phoneNumberSet = {"+86" + phone};
+								req.setPhoneNumberSet(phoneNumberSet);
+
+								SendSmsResponse res = client.SendSms(req);
+								log.info(SendSmsResponse.toJsonString(res));
+							} catch (Exception e) {
+								log.error("发送短信失败" + e.getMessage());
+							}
+
+							//发送消息到首页
+							List<IndexMessage> messages = new ArrayList<>();
+							IndexMessage msg = new IndexMessage();
+							msg.setToUser(user);
+							msg.setContent(name + "指派" + project.getName() + task.getTitle() + "的任务,请及时完成");
+							msg.setCategory(1);
+							msg.setOpenUrl("/task");
+							msg.setCreateUser(userId);
+							msg.setUpdateUser(userId);
+							messages.add(msg);
+
+							IndexMessage message = new IndexMessage();
+							message.setToUser(user);
+							message.setContent(project.getName() + task.getTitle() + "的任务截至时间为" + format + ",请及时完成");
+							message.setCategory(1);
+							message.setOpenUrl("/task");
+							message.setCreateUser(userId);
+							message.setUpdateUser(userId);
+							messages.add(message);
+							indexMessageService.saveBatch(messages);
+						}
+					}
+				});
+			}
+
+		}
 	}
 
 }

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

@@ -64,7 +64,6 @@ public class CommonServiceImpl implements ICommonService {
 	private final RestHighLevelClient client;
 	private final ISysClient sysClient;
 	private final IUserClient userClient;
-	private final IAsyncService asyncService;
 
 
 	@Override

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

@@ -1,58 +0,0 @@
-package com.wtkj.service.impl;
-
-import com.wtkj.entity.DeptToDept;
-import com.wtkj.mapper.DeptToDeptMapper;
-import com.wtkj.service.IDeptToDeptService;
-import lombok.AllArgsConstructor;
-import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.system.entity.Dept;
-import org.springblade.system.feign.ISysClient;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * @author Blizzard
- * @create at 2023-09-14 11:11
- * @describe
- */
-@Service
-@AllArgsConstructor
-public class DeptToDeptServiceImpl extends BaseServiceImpl<DeptToDeptMapper, DeptToDept> implements IDeptToDeptService {
-
-	private final ISysClient sysClient;
-
-
-	@Override
-	public List<Dept> getDept(Long topDept, String areaCode, String name, Integer category) {
-		List<Dept> result = new ArrayList<>();
-		R<List<Dept>> rpc = sysClient.getDeptByAreaCodeAndCategory(areaCode, name, category);
-		if (rpc.isSuccess()) {
-			List<Dept> data = rpc.getData();
-			if (!CollectionUtils.isEmpty(data)) {
-				result.addAll(data);
-			}
-		}
-		//机构关联的机构
-		if (topDept != null) {
-			List<DeptToDept> list = this.getByTopDept(topDept);
-			if (!CollectionUtils.isEmpty(list)) {
-				List<Dept> deptList = Objects.requireNonNull(BeanUtil.copy(list, Dept.class));
-				result.addAll(deptList);
-			}
-		}
-		return result;
-	}
-
-	@Override
-	public List<DeptToDept> getByTopDept(Long topDept) {
-		return baseMapper.selectByTopDept(topDept);
-	}
-
-
-}

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

@@ -36,8 +36,8 @@ public class FileReadServiceImpl extends BaseServiceImpl<FileReadMapper, FileRea
 	}
 
 	@Override
-	public List<FileRead> getByFileIds(Set<Long> fileIds) {
-		return baseMapper.selectByFileIds(fileIds);
+	public List<FileRead> getByUser(Long userId) {
+		return baseMapper.selectByFileIds(userId);
 	}
 
 	@Override

+ 33 - 6
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/ProjectServiceImpl.java

@@ -15,8 +15,11 @@ 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.Func;
 import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.system.entity.Dept;
+import org.springblade.system.feign.ISysClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -44,8 +47,10 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 	private final IProjectAuthService projectAuthService;
 	private final ITaskService taskService;
 	private final ITaskContractService taskContractService;
+	private final ISysClient sysClient;
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public boolean submit(Project project) {
 		boolean flag = false;
 		BladeUser user = AuthUtil.getUser();
@@ -53,6 +58,32 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 			LocalDate date = LocalDate.now();
 			project.setYear(String.valueOf(date.getYear()));
 			flag = this.save(project);
+
+			//权限
+			String deptIdStr = user.getDeptId();
+			if (deptIdStr != null) {
+				Long deptId = Func.firstLong(deptIdStr);
+				ProjectAuth auth = new ProjectAuth();
+				auth.setUserId(user.getUserId());
+				R<Dept> rpc = sysClient.getDept(deptId);
+				if (rpc.isSuccess()) {
+					String ancestors = rpc.getData().getAncestors();
+					if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
+						List<Long> parentIds = Func.toLongList(ancestors);
+						if (!CollectionUtils.isEmpty(parentIds)) {
+							if (parentIds.size() > 1) {
+								auth.setTopDept(parentIds.get(1));
+							} else {
+								auth.setTopDept(Long.valueOf(deptIdStr));
+							}
+						}
+					}
+				}
+				auth.setUserDept(deptId);
+				auth.setProjectId(project.getId());
+				projectAuthService.save(auth);
+			}
+
 			asyncService.createProject(project, user);
 		} else {
 			flag = this.updateById(project);
@@ -142,7 +173,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 						}
 					} else if (role.contains(STAFF_USER) || role.contains(STAFF_PROJECT_MANAGER)) {
 						//1.2.3 普通员工和项目经理   --->项目权限表里 userId 是自己的
-						List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(topDept, deptId, userId);
+						List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(null, null, userId);
 						if (!CollectionUtils.isEmpty(auths)) {
 							Set<Long> ids = auths.stream().map(ProjectAuth::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
 							projectIds.addAll(ids);
@@ -182,10 +213,6 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 		return projectIPage;
 	}
 
-	@Override
-	public Set<Long> getByCreate(Long createDept, Long createUser) {
-		return baseMapper.selectByCreate(createDept, createUser);
-	}
 
 	@Override
 	public ProjectStatisticsVO projectStatistics(Long topDept, Integer deptCategory, String year) {
@@ -290,7 +317,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project>
 						}
 					} else if (role.contains(STAFF_USER) || role.contains(STAFF_PROJECT_MANAGER)) {
 						//1.2.3 普通员工和项目经理   --->项目权限表里 userId 是自己的
-						List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(topDept, deptId, userId);
+						List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(null, null, userId);
 						if (!CollectionUtils.isEmpty(auths)) {
 							Set<Long> projectIds = auths.stream().map(ProjectAuth::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
 							LambdaQueryWrapper<Project> lqw = new LambdaQueryWrapper<>();

+ 79 - 21
blade-service/wt-okr/src/main/java/com/wtkj/service/impl/QrcodeServiceImpl.java

@@ -2,17 +2,23 @@ package com.wtkj.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.wtkj.entity.*;
+import com.wtkj.entity.FileShare;
+import com.wtkj.entity.Project;
+import com.wtkj.entity.ProjectAuth;
+import com.wtkj.entity.ProjectGroup;
 import com.wtkj.service.*;
 import com.wutong.file.entity.FileAttach;
 import com.wutong.file.feign.IFileClient;
-import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 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;
@@ -21,6 +27,7 @@ import java.time.Duration;
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.wtkj.config.MagicValue.ZERO;
 import static com.wtkj.config.NacosConfigValue.expireIn;
 import static com.wtkj.config.NacosConfigValue.scanCount;
 
@@ -37,63 +44,88 @@ public class QrcodeServiceImpl implements IQrcodeService {
 	private final IUserClient userClient;
 	private final IProjectAuthService projectAuthService;
 	private final IProjectGroupService projectGroupService;
-	private final IContactOuterService contactOuterService;
 	private final IProjectService projectService;
 	private final IFileShareService fileShareService;
 	private final IFileClient fileClient;
-	private final IApplyJoinService applyJoinService;
+	private final ISysClient sysClient;
 
 	@Override
-	public JSONObject createQrcode() {
+	public JSONObject createDeptQrcode(Long deptId) {
 		JSONObject res = new JSONObject();
 		String kv = IdWorker.getIdStr();
 		Long userId = AuthUtil.getUserId();
 		redis.setEx(kv, 0, Duration.ofSeconds(expireIn));
 		res.put("qrcodeId", kv);
 		res.put("createUser", userId);
+		res.put("deptId", deptId);
 		return res;
 	}
 
 	@Override
-	@GlobalTransactional(rollbackFor = Exception.class)
-	public boolean inviteToDept(Long createUser, Integer type, String qrcodeId, Long userId, Long deptId) {
+	public boolean inviteToDept(String qrcodeId, Long createUser, Long deptId) {
 		boolean flag = false;
 		boolean exist = isExist(qrcodeId);
+		Long userId = AuthUtil.getUserId();
 		//二维码可用前提下
 		if (exist) {
-//			ApplyJoin join = new ApplyJoin();
-//			join.setDeptId(deptId);
-//			join.setUserId(userId);
-//			flag = applyJoinService.save(join);
 			//1.绑定机构
 			R<Boolean> rpc = userClient.bindUser(userId, deptId);
 			//2.保存外部联系人
 			if (rpc.isSuccess()) {
 				flag = rpc.getData();
 			}
-			if (type == 2) {
-				ContactOuter contact = new ContactOuter();
-				contact.setRelatedDeptId(deptId);
-				contact.setRelatedUserId(userId);
-				contact.setUserId(createUser);
-				contactOuterService.save(contact);
-			}
 		}
 		return flag;
 	}
 
+	@Override
+	public JSONObject scanInviteToDept(String qrcodeId, Long createUser, Long deptId) {
+		JSONObject res = new JSONObject();
+		User user = null;
+		Dept topDept = null;
+		Dept dept = null;
+
+		R<User> userR = userClient.userInfoById(createUser);
+		if (userR.isSuccess()) {
+			user = userR.getData();
+		}
+		R<Dept> rpc = sysClient.getDept(deptId);
+		if (rpc.isSuccess()) {
+			Dept data = rpc.getData();
+			String ancestors = data.getAncestors();
+			// ancestors 0,1689540492698267649
+			if (StringUtil.isNotBlank(ancestors) && ancestors.contains(String.valueOf(ZERO))) {
+				List<Long> deptIds = Func.toLongList(ancestors);
+				if (deptIds.size() > 1) {
+					Long topDeptId = deptIds.get(1);
+					R<Dept> deptR = sysClient.getDept(topDeptId);
+					if (deptR.isSuccess()) {
+						topDept = deptR.getData();
+						dept = data;
+					}
+				} else {
+					topDept = data;
+				}
+			}
+		}
+		res.put("user", user);
+		res.put("topDept", topDept);
+		res.put("dept", dept);
+		return res;
+	}
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean inviteToProject(String qrcodeId, Long deptId, Long projectId) {
+	public boolean inviteToProject(String qrcodeId, Long createUser, Long projectId, Long deptId) {
 		boolean flag = false;
 		boolean exist = isExist(qrcodeId);
 		if (exist) {
-			//1.权限 2.联系人 3.项目组
+			//1.权限 3.项目组
 			ProjectAuth auth = new ProjectAuth();
 			auth.setProjectId(projectId);
 			auth.setTopDept(deptId);
 			auth.setUserDept(Func.firstLong(AuthUtil.getDeptId()));
-			auth.setUserId(auth.getUserId());
+			auth.setUserId(AuthUtil.getUserId());
 			projectAuthService.save(auth);
 
 
@@ -109,6 +141,32 @@ public class QrcodeServiceImpl implements IQrcodeService {
 		return flag;
 	}
 
+	@Override
+	public JSONObject scanInviteToProject(String qrcodeId, Long createUser, Long projectId, Long topDept) {
+		JSONObject res = new JSONObject();
+		User user = null;
+		String projectName = null;
+		String unitName = null;
+
+		R<User> userR = userClient.userInfoById(createUser);
+		if (userR.isSuccess()) {
+			user = userR.getData();
+		}
+		Project project = projectService.getById(projectId);
+		if (project != null) {
+			projectName = project.getName();
+			Long competentUnit = project.getCompetentUnit();
+			R<Dept> dept = sysClient.getDept(competentUnit);
+			if (dept.isSuccess()) {
+				unitName = dept.getData().getDeptName();
+			}
+		}
+		res.put("user", user);
+		res.put("projectName", projectName);
+		res.put("unitName", unitName);
+		return res;
+	}
+
 	@Override
 	public JSONObject createGroupQrcode(Long projectId) {
 		JSONObject res = new JSONObject();

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

@@ -750,6 +750,11 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 		return baseMapper.selectByCompetentUnit(deptId);
 	}
 
+	@Override
+	public List<Task> getByStatus(Integer status) {
+		return baseMapper.selectByTaskStatus(status);
+	}
+
 
 	private List<Task> getListByDateAndStageAndStatus(Long stageId, String formatDate, Integer taskStatus) {
 		return baseMapper.selectByDateAndStageAndStatus(stageId, formatDate, taskStatus);

+ 16 - 7
blade-service/wt-okr/src/main/java/com/wtkj/wrapper/TaskWrapper.java

@@ -117,14 +117,22 @@ public class TaskWrapper extends BaseEntityWrapper<Task, TaskVO> {
 		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);
+			if (!CollectionUtils.isEmpty(fileIds)) {
+				Set<String> collect1 = fileIds.stream().map(Object::toString).collect(Collectors.toSet());
+
+				List<FileRead> reads = fileReadService.getByUser(first);
+				if (!CollectionUtils.isEmpty(reads)) {
+					Set<String> collect = reads.stream().map(FileRead::getBladeFileId).collect(Collectors.toSet());
+					if (collect.containsAll(collect1)) {
+						users.add(first);
+					}
 				}
-				if (userIds.contains(second)) {
-					users.add(second);
+				List<FileRead> readList = fileReadService.getByUser(second);
+				if (!CollectionUtils.isEmpty(readList)) {
+					Set<String> collect = readList.stream().map(FileRead::getBladeFileId).collect(Collectors.toSet());
+					if (collect.containsAll(collect1)) {
+						users.add(second);
+					}
 				}
 			}
 		}
@@ -157,6 +165,7 @@ public class TaskWrapper extends BaseEntityWrapper<Task, TaskVO> {
 			});
 			vo.setFiles(files);
 		}
+
 		//任务标签的数组
 		String tags = entity.getTags();
 		String category = entity.getCategory();

+ 3 - 1
blade-service/wt-okr/src/main/resources/application-prod.yml

@@ -1,9 +1,11 @@
 #服务器端口
 server:
-  port: 8409
+  port: 8410
 
 #数据源配置
 spring:
+  application:
+    name: wutong-okr
   #排除DruidDataSourceAutoConfigure
   autoconfigure:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure

+ 9 - 12
pom.xml

@@ -4,15 +4,16 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
-    <groupId>com.wtkj</groupId>
+    <groupId>org.springblade</groupId>
     <artifactId>wt-service-okr</artifactId>
-    <version>1.0.RELEASE</version>
+    <version>2.9.1.RELEASE</version>
     <packaging>pom</packaging>
 
+
     <modules>
-        <module>blade-common</module>
-        <module>blade-service-api</module>
+        <module>blade-biz-common</module>
         <module>blade-service</module>
+        <module>blade-service-api</module>
     </modules>
 
     <properties>
@@ -46,16 +47,12 @@
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
-            <!--            <dependency>-->
-            <!--                <groupId>org.springblade</groupId>-->
-            <!--                <artifactId>blade-biz-common</artifactId>-->
-            <!--                <version>2.9.1.RELEASE</version>-->
-            <!--            </dependency>-->
             <dependency>
-                <groupId>com.wtkj</groupId>
-                <artifactId>blade-common</artifactId>
-                <version>1.0.RELEASE</version>
+                <groupId>org.springblade</groupId>
+                <artifactId>blade-biz-common</artifactId>
+                <version>2.9.1.RELEASE</version>
             </dependency>
+
             <dependency>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-dependencies</artifactId>