|
@@ -0,0 +1,61 @@
|
|
|
+package com.ym.mec.web.controller;
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+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.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
|
|
|
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
|
|
|
+import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+
|
|
|
+@Api(tags = "首页")
|
|
|
+@RequestMapping()
|
|
|
+@RestController
|
|
|
+public class IndexController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupDao musicGroupDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TeacherDao teacherDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StudentRegistrationDao studentRegistrationDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取首页数据")
|
|
|
+ @GetMapping("/index")
|
|
|
+ public Object index() {
|
|
|
+
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null || sysUser.getId() == null) {
|
|
|
+ return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer organId = sysUser.getOrganId();
|
|
|
+ if ("admin".equals(sysUser.getUsername())) {
|
|
|
+ organId = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Integer> musicDatas = musicGroupDao.queryOrganMusicGroupNum(organId);
|
|
|
+
|
|
|
+ Map<String, Integer> teacherDatas = teacherDao.queryOrganTeacherNum(organId);
|
|
|
+
|
|
|
+ Map<String, Integer> studentDatas = studentRegistrationDao.queryStudentNum();
|
|
|
+
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|