EntmicroDepartmentController.java
5.32 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package cn.com.glsx.entmicro.controller;
import cn.com.glsx.entmicro.model.response.DepartmentTreeResponse;
import cn.com.glsx.entmicro.model.response.EntmicroDepartmentResponse;
import cn.com.glsx.entmicro.request.department.DepartmentListRequest;
import cn.com.glsx.entmicro.request.department.DepartmentPageRequest;
import cn.com.glsx.entmicro.request.department.DepartmentTreeRequest;
import cn.com.glsx.entmicro.request.department.MerchantRequest;
import cn.com.glsx.entmicro.service.DepartmentService;
import cn.com.glsx.entmicro.utils.Pagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @author Lichongyuan
* @Description: 部门服务
* @date 2021/9/28 11:29
*/
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("部门服务")
@Slf4j
public class EntmicroDepartmentController {
@Autowired
private DepartmentService departmentService;
/**
* 查询组织树
* @param departmentTreeRequest
* @return
*/
@ServiceMethod(method = "entmicro.api.department.listDepartmentTree", needInSession = NeedInSessionType.YES)
@ApiOperation("查询组织树")
public RopResponse<List<DepartmentTreeResponse>> listDepartmentTree(DepartmentTreeRequest departmentTreeRequest) {
try {
List<DepartmentTreeResponse> departmentTreeRopResponses = departmentService.listDepartmentTree(departmentTreeRequest);
return RopResponse.success(departmentTreeRopResponses);
} catch (RpcServiceException e) {
log.info("=======EntmicroDepartmentController__invoke__listDepartmentTree__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 查询组织树(无session)
* @param departmentTreeRequest
* @return
*/
@ServiceMethod(method = "entmicro.api.department.listDepartmentTreeNoSession", needInSession = NeedInSessionType.NO)
@ApiOperation("查询组织树(无session)")
public RopResponse<List<DepartmentTreeResponse>> listDepartmentTreeNoSession(DepartmentTreeRequest departmentTreeRequest) {
try {
List<DepartmentTreeResponse> departmentTreeRopResponses = departmentService.listDepartmentTree(departmentTreeRequest);
return RopResponse.success(departmentTreeRopResponses);
} catch (RpcServiceException e) {
log.info("=======EntmicroDepartmentController__invoke__listDepartmentTree__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 根据父部门id查询子部门集合
* @param departmentRequest
* @return
*/
@ServiceMethod(method = "entmicro.api.department.listDepartment", needInSession = NeedInSessionType.YES)
@ApiOperation("根据父部门id查询子部门集合")
public RopResponse<List<EntmicroDepartmentResponse>> listDepartmentBySupId(DepartmentListRequest departmentRequest) {
try {
List<EntmicroDepartmentResponse> DepartmentResponses = departmentService.listDepartmentBySupId(departmentRequest);
return RopResponse.success(DepartmentResponses);
} catch (RpcServiceException e) {
log.info("=======EntmicroDepartmentController__invoke__listDepartment__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 分页查询部门列表
* @param departmentPageRequest
* @return
*/
@ServiceMethod(method = "entmicro.api.department.findDepartmentListByPage", needInSession = NeedInSessionType.YES)
@ApiOperation("分页查询部门列表")
public RopResponse<Pagination<EntmicroDepartmentResponse>> findDepartmentListByPage(DepartmentPageRequest departmentPageRequest){
try {
Pagination<EntmicroDepartmentResponse> DepartmentResponses = departmentService.findDepartmentListByPage(departmentPageRequest);
return RopResponse.success(DepartmentResponses);
} catch (RpcServiceException e) {
log.info("=======EntmicroDepartmentController__invoke__findDepartmentListByPage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 查询授权商户
* @param merchantRequest
* @return
*/
@ServiceMethod(method = "entmicro.api.department.authorizeMerchant", needInSession = NeedInSessionType.NO)
@ApiOperation("查询授权商户")
public RopResponse<Integer> authorizeMerchant(MerchantRequest merchantRequest) {
try {
Integer departmentTreeRopResponses = departmentService.authorizeMerchant(merchantRequest);
return RopResponse.success(departmentTreeRopResponses);
} catch (RpcServiceException e) {
log.info("=======EntmicroDepartmentController__invoke__listDepartmentTree__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}