|
@@ -3,6 +3,8 @@ package com.ym.mec.web.controller;
|
|
|
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
+import com.ym.mec.biz.dal.entity.Employee;
|
|
|
import com.ym.mec.biz.dal.entity.StudentInstrument;
|
|
|
import com.ym.mec.biz.dal.page.StudentInstrumentQueryInfo;
|
|
|
import com.ym.mec.biz.service.StudentInstrumentService;
|
|
@@ -13,6 +15,7 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -21,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@RequestMapping("studentInstrument")
|
|
|
@Api(tags = "乐器与月保服务")
|
|
@@ -30,16 +35,28 @@ public class StudentInstrumentController extends BaseController {
|
|
|
private StudentInstrumentService studentInstrumentService;
|
|
|
@Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private EmployeeDao employeeDao;
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取乐器与月保列表")
|
|
|
@GetMapping("/getList")
|
|
|
public HttpResponseResult<PageInfo<StudentInstrument>> getList(StudentInstrumentQueryInfo queryInfo) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || user.getId() == null) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ return failed("用户信息获取失败");
|
|
|
+ }
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ if (StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
+ queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
+ } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
+ return failed("用户所在分部异常");
|
|
|
+ } else {
|
|
|
+ List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
+ if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
|
|
|
+ return failed("非法请求");
|
|
|
+ }
|
|
|
}
|
|
|
- queryInfo.setStudentId(user.getId());
|
|
|
return succeed(studentInstrumentService.queryPage(queryInfo));
|
|
|
}
|
|
|
|