|
@@ -1,12 +1,56 @@
|
|
|
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.dto.ChildrenStatisticsDto;
|
|
|
+import com.ym.mec.biz.dal.entity.Employee;
|
|
|
+import com.ym.mec.biz.dal.page.ChildrenReserveQueryInfo;
|
|
|
+import com.ym.mec.biz.service.ChildrenDayReserveService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.page.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
@RequestMapping("childrenReserve")
|
|
|
@Api(tags = "儿童节活动")
|
|
|
@RestController
|
|
|
public class ChildrenReserveController extends BaseController {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ChildrenDayReserveService childrenDayReserveService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private EmployeeDao employeeDao;
|
|
|
+
|
|
|
+ @ApiOperation(value = "21年暑期考级活动统计页面")
|
|
|
+ @GetMapping("/queryStatisticsPage")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('childrenReserve/queryStatisticsPage')")
|
|
|
+ public HttpResponseResult<PageInfo<ChildrenStatisticsDto>> queryPage(ChildrenReserveQueryInfo queryInfo) {
|
|
|
+ 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("非法请求");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return succeed(childrenDayReserveService.queryStatisticsPage(queryInfo));
|
|
|
+ }
|
|
|
}
|