TRX 1 an în urmă
părinte
comite
84477fff3e

+ 3 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/service/org/OrganizationService.java

@@ -1,5 +1,6 @@
 package com.zhongshu.card.client.service.org;
 
+import com.github.microservice.auth.security.type.AuthType;
 import com.zhongshu.card.client.model.org.*;
 import com.zhongshu.card.client.ret.ResultContent;
 import io.swagger.v3.oas.annotations.Operation;
@@ -24,5 +25,7 @@ public interface OrganizationService {
 
     public ResultContent<Page<OrganizationModel>> pageProject(OrganizationSearchParam param, Pageable pageable);
 
+    public ResultContent buildCode(AuthType authType);
+
     ResultContent initSuperOrganization();
 }

+ 6 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/org/OrganizationController.java

@@ -76,5 +76,11 @@ public class OrganizationController {
         return this.organizationService.update(param);
     }
 
+    @ResourceAuth(value = "user",type = AuthType.User)
+    @Operation(summary = "项目编码生成器", description = "项目编码生成器")
+    @RequestMapping(value = "buildProjectCode", method = {RequestMethod.GET})
+    public ResultContent buildProjectCode() {
+        return this.organizationService.buildCode(AuthType.Project);
+    }
 
 }

+ 10 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/OrganizationServiceImpl.java

@@ -258,6 +258,16 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
         return ResultContent.buildSuccess(PageEntityUtil.toPageModel(page, this::toProjectModel));
     }
 
+    /**
+     * 生成编码
+     * @param authType
+     * @return
+     */
+    public ResultContent buildCode(AuthType authType){
+        String code = NextNoUtil.getNextNo(authType.getCode().toUpperCase());
+        return ResultContent.buildSuccess(code);
+    }
+
     /**
      * 初始平台信息
      *