|
|
@@ -1,22 +1,37 @@
|
|
|
package com.zhongshu.card.server.core.controller.org;
|
|
|
|
|
|
+import com.github.microservice.auth.client.constant.AuthConstant;
|
|
|
import com.github.microservice.auth.client.model.LoginTokenModel;
|
|
|
+import com.github.microservice.auth.security.annotations.ResourceAuth;
|
|
|
+import com.github.microservice.auth.security.helper.AuthHelper;
|
|
|
+import com.github.microservice.auth.security.type.AuthType;
|
|
|
import com.zhongshu.card.client.model.org.LoginParam;
|
|
|
+import com.zhongshu.card.client.model.org.OrganizationModel;
|
|
|
+import com.zhongshu.card.client.model.org.OrganizationSearchParam;
|
|
|
+import com.zhongshu.card.client.model.org.OrganizationUserSearch;
|
|
|
import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.ret.ResultState;
|
|
|
+import com.zhongshu.card.client.service.org.OrganizationService;
|
|
|
+import com.zhongshu.card.client.utils.type.UserState;
|
|
|
import com.zhongshu.card.server.core.service.org.IndexService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import jakarta.servlet.http.Cookie;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.web.PageableDefault;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* @author TRX
|
|
|
* @date 2024/6/4
|
|
|
@@ -29,6 +44,12 @@ public class IndexController {
|
|
|
@Autowired
|
|
|
IndexService indexService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ OrganizationService organizationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ AuthHelper authHelper;
|
|
|
+
|
|
|
/**
|
|
|
* 登录
|
|
|
*
|
|
|
@@ -38,7 +59,6 @@ public class IndexController {
|
|
|
@Operation(summary = "登录--web端登录使用", description = "登录--web端登录使用")
|
|
|
@RequestMapping(value = "login", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public ResultContent login(@RequestBody LoginParam param, HttpServletRequest request, HttpServletResponse response) {
|
|
|
-
|
|
|
ResultContent result = indexService.login(param);
|
|
|
if (result != null && result.getState() == ResultState.Success) {
|
|
|
LoginTokenModel tokenModel = (LoginTokenModel) result.getContent();
|
|
|
@@ -52,4 +72,53 @@ public class IndexController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @ResourceAuth(value = "user",type = AuthType.User)
|
|
|
+ @Operation(summary = "查询用户加入的平台数据列表", description = "查询用户加入的 平台数据列表")
|
|
|
+ @RequestMapping(value = {"getUserPlatform"}, method = {RequestMethod.GET})
|
|
|
+ public ResultContent<List<OrganizationModel>> getUserPlatform() {
|
|
|
+ OrganizationUserSearch param = new OrganizationUserSearch();
|
|
|
+ param.setAuthType(AuthType.Platform);
|
|
|
+ param.setState(UserState.Normal);
|
|
|
+ return organizationService.getUserOrgList(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user",type = AuthType.User)
|
|
|
+ @Operation(summary = "查询用户加入的 项目数据列表", description = "查询用户加入的 项目数据列表")
|
|
|
+ @RequestMapping(value = {"getUserProject"}, method = {RequestMethod.GET})
|
|
|
+ public ResultContent<List<OrganizationModel>> getUserProject() {
|
|
|
+ OrganizationUserSearch param = new OrganizationUserSearch();
|
|
|
+ param.setAuthType(AuthType.Project);
|
|
|
+ param.setState(UserState.Normal);
|
|
|
+ return organizationService.getUserOrgList(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user",type = AuthType.User)
|
|
|
+ @Operation(summary = "查询用户加入的 学校数据列表", description = "查询用户加入的 学校数据列表")
|
|
|
+ @RequestMapping(value = {"getUserSchool"}, method = {RequestMethod.GET})
|
|
|
+ public ResultContent<List<OrganizationModel>> getUserSchool() {
|
|
|
+ OrganizationUserSearch param = new OrganizationUserSearch();
|
|
|
+ param.setAuthType(AuthType.School);
|
|
|
+ param.setState(UserState.Normal);
|
|
|
+ return organizationService.getUserOrgList(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user",type = AuthType.User)
|
|
|
+ @Operation(summary = "查询用户加入的 商家数据列表", description = "查询用户加入的 商家数据列表")
|
|
|
+ @RequestMapping(value = {"getUserShop"}, method = {RequestMethod.GET})
|
|
|
+ public ResultContent<List<OrganizationModel>> getUserShop() {
|
|
|
+ OrganizationUserSearch param = new OrganizationUserSearch();
|
|
|
+ param.setAuthType(AuthType.Shop);
|
|
|
+ param.setState(UserState.Normal);
|
|
|
+ return organizationService.getUserOrgList(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user",type = AuthType.User)
|
|
|
+ @Operation(summary = "查询用户加入的 企业数据列表", description = "查询用户加入的 企业数据列表")
|
|
|
+ @RequestMapping(value = {"getUserEnterprise"}, method = {RequestMethod.GET})
|
|
|
+ public ResultContent<List<OrganizationModel>> getUserEnterprise() {
|
|
|
+ OrganizationUserSearch param = new OrganizationUserSearch();
|
|
|
+ param.setAuthType(AuthType.Enterprise);
|
|
|
+ param.setState(UserState.Normal);
|
|
|
+ return organizationService.getUserOrgList(param);
|
|
|
+ }
|
|
|
}
|