AsraOpController.java
3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package com.zteits.oa.report.web;
import com.alibaba.fastjson.JSONObject;
import com.xiaoleilu.hutool.util.CollectionUtil;
import com.zteits.oa.api.base.bean.BizResult;
import com.zteits.oa.api.base.bean.PageBean;
import com.zteits.oa.api.base.constants.SessionEnum;
import com.zteits.oa.api.dto.asraop.AsraOpDTO;
import com.zteits.oa.api.dto.asraop.param.AsraOpQueryReq;
import com.zteits.oa.api.dto.asraoprelations.AsraOpRelationsDTO;
import com.zteits.oa.api.dto.asraoprelations.param.AsraOpRelationsQueryReq;
import com.zteits.oa.api.service.report.query.AsraOpQueryService;
import com.zteits.oa.api.service.report.query.AsraOpRelationsQueryService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.core.CollectionUtils;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
@Api(value = "日报系统-员工管理", description = "日报系统-员工管理")
@RestController
@RequestMapping("/asraOp")
public class AsraOpController {
private static final Logger logger = LoggerFactory.getLogger(AsraOpController.class);
@Autowired
private AsraOpQueryService asraOpQueryService;
@Autowired
private AsraOpRelationsQueryService asraOpRelationsQueryService;
@RequestMapping(value="/queryAsraOpPage",method = RequestMethod.POST)
public BizResult<PageBean<AsraOpDTO>> queryAsraOpPage(@RequestBody AsraOpQueryReq asraOpQueryReq, HttpServletRequest request){
logger.info("日报系统-员工管理-根据登录人分页查询员工信息入参:{}", JSONObject.toJSON(asraOpQueryReq));
/**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/
AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key());
// /**2.判断登录人是领导还是员工 ,2:员工,1:领导*/
// List<Long> opIdLists = new ArrayList<>();
// opIdLists.add(asraOpDTO.getId());
// if(asraOpDTO.getRoleId() == 1){
// /**如果是领导,获取领导下面的员工信息*/
// AsraOpRelationsQueryReq asraOpRelationsQueryReq = new AsraOpRelationsQueryReq();
// asraOpRelationsQueryReq.setParentId(asraOpDTO.getId());
// BizResult<List<AsraOpRelationsDTO>> listBizResult = asraOpRelationsQueryService.queryAsraOpRelations(asraOpRelationsQueryReq);
// if(listBizResult.isSuccess() && CollectionUtil.isNotEmpty(listBizResult.getData())){
// for(AsraOpRelationsDTO asraOpRelationsDTO : listBizResult.getData()){
// opIdLists.add(asraOpRelationsDTO.getOpId());
// }
// }
// }
// asraOpQueryReq.setOpIdLists(opIdLists);
asraOpQueryReq.setId(asraOpDTO.getId());
BizResult<PageBean<AsraOpDTO>> result = asraOpQueryService.queryAsraOpForPage(asraOpQueryReq);
logger.info("日报系统-员工管理-根据登录人分页查询员工信息结果:{}", JSONObject.toJSON(result));
return result;
}
}