yonge 3 年之前
父节点
当前提交
ea8d897632

+ 20 - 0
mec-student/src/main/java/com/ym/mec/student/controller/TenantInfoController.java

@@ -1,11 +1,18 @@
 package com.ym.mec.student.controller;
 
+import javax.annotation.Resource;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.controller.BaseController;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -23,12 +30,25 @@ public class TenantInfoController extends BaseController {
     @Autowired
     private TenantInfoService tenantInfoService;
 
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/info/{id}")
     public Object queryTenantInfo(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {
         return succeed(tenantInfoService.queryTenantInfo(id));
     }
 
+    @ApiOperation("查询用户机构信息")
+    @GetMapping(value = "/queryUserTenantInfo")
+    public Object queryUserTenantInfo() {
+    	SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || user.getId() == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(tenantInfoService.queryTenantInfo(user.getTenantId()));
+    }
+
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/checkInfo/{id}")
     public Object queryTenantInfoCheck(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {

+ 28 - 11
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TenantInfoController.java

@@ -1,18 +1,22 @@
 package com.ym.mec.teacher.controller;
 
-import com.ym.mec.biz.dal.dto.TenantInfoDto;
-import com.ym.mec.biz.service.TenantInfoService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.thirdparty.yqpay.Msg;
-import com.ym.mec.util.validator.ValidationKit;
-import io.swagger.annotations.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import javax.annotation.Resource;
+
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import javax.validation.Valid;
-import java.util.Map;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.service.TenantInfoService;
+import com.ym.mec.common.controller.BaseController;
 
 /**
  * @author hgw
@@ -26,12 +30,25 @@ public class TenantInfoController extends BaseController {
     @Autowired
     private TenantInfoService tenantInfoService;
 
+    @Resource
+    private SysUserFeignService sysUserFeignService;
+
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/info/{id}")
     public Object queryTenantInfo(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {
         return succeed(tenantInfoService.queryTenantInfo(id));
     }
 
+    @ApiOperation("查询用户机构信息")
+    @GetMapping(value = "/queryUserTenantInfo")
+    public Object queryUserTenantInfo() {
+    	SysUser user = sysUserFeignService.queryUserInfo();
+        if (user == null || user.getId() == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(tenantInfoService.queryTenantInfo(user.getTenantId()));
+    }
+
     @ApiOperation("查询单个机构详情")
     @GetMapping(value = "/checkInfo/{id}")
     public Object queryTenantInfoCheck(@ApiParam(value = "机构ID", required = true) @PathVariable("id") Integer id) {