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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package com.vci.ubcs.system.feign;
 
import com.vci.ubcs.system.entity.*;
import com.vci.ubcs.system.service.*;
import lombok.AllArgsConstructor;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
 
import java.util.List;
 
/**
 * 系统服务Feign实现类
 *
 * @author Chill
 */
@NonDS
@ApiIgnore
@RestController
@AllArgsConstructor
public class SysClient implements ISysClient {
 
    private final IDeptService deptService;
 
    private final IPostService postService;
 
    private final IRoleService roleService;
 
    private final IMenuService menuService;
 
    private final ITenantService tenantService;
 
    private final ITenantPackageService tenantPackageService;
 
    private final IParamService paramService;
 
    private final IRegionService regionService;
 
    private final IStrategyService strategyService;
 
    private final ICombinationService combinationService;
 
    @Override
    @GetMapping(MENU)
    public R<Menu> getMenu(Long id) {
        return R.data(menuService.getById(id));
    }
    @Override
    @GetMapping(MENU_BUTTON)
    public R<List<Menu>> getMenuButtonByType(String btmType) {
        return R.data(menuService.getMenuButtonByType(btmType));
    }
 
    @Override
    @GetMapping(DEPT)
    public R<Dept> getDept(Long id) {
        return R.data(deptService.getById(id));
    }
 
    @Override
    public R<String> getDeptIds(String tenantId, String deptNames) {
        return R.data(deptService.getDeptIds(tenantId, deptNames));
    }
 
    @Override
    public R<String> getDeptIdsByFuzzy(String tenantId, String deptNames) {
        return R.data(deptService.getDeptIdsByFuzzy(tenantId, deptNames));
    }
 
    @Override
    @GetMapping(DEPT_NAME)
    public R<String> getDeptName(Long id) {
        return R.data(deptService.getById(id).getDeptName());
    }
 
    @Override
    @GetMapping(DEPT_NAMES)
    public R<List<String>> getDeptNames(String deptIds) {
        return R.data(deptService.getDeptNames(deptIds));
    }
 
    @Override
    @GetMapping(DEPT_CHILD)
    public R<List<Dept>> getDeptChild(Long deptId) {
        return R.data(deptService.getDeptChild(deptId));
    }
 
    @Override
    public R<Post> getPost(Long id) {
        return R.data(postService.getById(id));
    }
 
    @Override
    public R<String> getPostIds(String tenantId, String postNames) {
        return R.data(postService.getPostIds(tenantId, postNames));
    }
 
    @Override
    public R<String> getPostIdsByFuzzy(String tenantId, String postNames) {
        return R.data(postService.getPostIdsByFuzzy(tenantId, postNames));
    }
 
    @Override
    public R<String> getPostName(Long id) {
        return R.data(postService.getById(id).getPostName());
    }
 
    @Override
    public R<List<String>> getPostNames(String postIds) {
        return R.data(postService.getPostNames(postIds));
    }
 
    @Override
    @GetMapping(ROLE)
    public R<Role> getRole(Long id) {
        return R.data(roleService.getById(id));
    }
 
    @Override
    public R<String> getRoleIds(String tenantId, String roleNames) {
        return R.data(roleService.getRoleIds(tenantId, roleNames));
    }
 
    @Override
    @GetMapping(ROLE_NAME)
    public R<String> getRoleName(Long id) {
        return R.data(roleService.getById(id).getRoleName());
    }
 
    @Override
    @GetMapping(ROLE_ALIAS)
    public R<String> getRoleAlias(Long id) {
        return R.data(roleService.getById(id).getRoleAlias());
    }
 
    @Override
    @GetMapping(ROLE_NAMES)
    public R<List<String>> getRoleNames(String roleIds) {
        return R.data(roleService.getRoleNames(roleIds));
    }
 
    @Override
    @GetMapping(ROLE_ALIASES)
    public R<List<String>> getRoleAliases(String roleIds) {
        return R.data(roleService.getRoleAliases(roleIds));
    }
 
    @Override
    @GetMapping(TENANT)
    public R<Tenant> getTenant(Long id) {
        return R.data(tenantService.getById(id));
    }
 
    @Override
    @GetMapping(TENANT_ID)
    public R<Tenant> getTenant(String tenantId) {
        return R.data(tenantService.getByTenantId(tenantId));
    }
 
    @Override
    @GetMapping(TENANT_PACKAGE)
    public R<TenantPackage> getTenantPackage(String tenantId) {
        Tenant tenant = tenantService.getByTenantId(tenantId);
        return R.data(tenantPackageService.getById(tenant.getPackageId()));
    }
 
    @Override
    @GetMapping(PARAM)
    public R<Param> getParam(Long id) {
        return R.data(paramService.getById(id));
    }
 
    @Override
    @GetMapping(PARAM_VALUE)
    public R<String> getParamValue(String paramKey) {
        return R.data(paramService.getValue(paramKey));
    }
 
    @Override
    @GetMapping(REGION)
    public R<Region> getRegion(String code) {
        return R.data(regionService.getById(code));
    }
 
    @Override
    @PostMapping(STRATEGY)
    public R<Strategy> getByTenantIdAndName(String tenantId, String name) {
        return R.data(strategyService.queryByNameAndTenantId(tenantId,name));
    }
 
    @Override
    @PostMapping(STRATEGYBYID)
    public R<Strategy> getByUserId(Long userId) {
        return R.data(strategyService.queryByUserId(userId));
    }
 
    @Override
    @PostMapping(REGEX)
    public R<String> getRegex(@RequestBody List<String> combinationIds) {
        return R.data(combinationService.getRegex(combinationIds));
    }
 
    @Override
    @PostMapping(REGEXONE)
    public R<List<String>> getRegexByList(List<String> combinationIds) {
        return R.data(combinationService.getRegexList(combinationIds));
    }
 
 
}