xiejun
2023-06-15 8e6c58eec222c4bbea613e02703d9af22da72bee
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
/*
 *      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.omd.feign;
 
import com.vci.ubcs.omd.entity.Enum;
import com.vci.ubcs.omd.entity.EnumItem;
import com.vci.ubcs.omd.vo.EnumVO;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.system.user.vo.UserVO;
import io.swagger.models.auth.In;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
 
import java.util.List;
 
/**
 * 枚举定义 Feign接口类
 *
 * @author yuxc
 * @since 2023-05-08
 */
@FeignClient(
    value = AppConstant.APPLICATION_NAME_OMD,
    fallback = IWebSecretFallback.class
)
public interface IWebSecretClient {
 
    String API_PREFIX = "/client";
    String MINUSER = API_PREFIX + "/secret/min-user";
    String MINDATA = API_PREFIX + "/secret/min-data";
    String MINIP = API_PREFIX + "/secret/min-ip";
    String USER = API_PREFIX + "/secret/user";
    String USERVO = API_PREFIX + "/secret/uservo";
    String CHECKDATA = API_PREFIX + "/secret/check-data";
    String CHECKUSERDATA = API_PREFIX + "/secret/chec-user-data";
    String CHECKUSERIDDATA = API_PREFIX + "/secret/chec-userid-data";
    String CHECKVO = API_PREFIX + "/secret/checkvo";
    String IP = API_PREFIX + "/secret/ip";
    String IPUSER = API_PREFIX + "/secret/ip-user";
    String IPSECRET = API_PREFIX + "/secret/ip-secret";
    String IPUSERID = API_PREFIX + "/secret/ip-userid";
    String IPUSERVO = API_PREFIX + "/secret/ip-uservo";
 
    /**
     * 获取用户密级的最小值
     * @return 密级的值
     * @throws VciBaseException 查询出错会抛出异常
     */
    @GetMapping(MINUSER)
    R<Integer> getMinUserSecret() throws VciBaseException;
 
    /**
     * 获取数据密级的默认值
     * @return 密级的值
     * @throws VciBaseException 查询出错会抛出异常
     */
    @GetMapping(MINDATA)
    R<Integer> getMinDataSecret() throws VciBaseException;
 
    /**
     * 获取IP密级的默认值
     * @return 密级的值
     * @throws VciBaseException 查询出错会抛出异常
     */
    @GetMapping(MINIP)
    R<Integer> getMinIpSecret() throws VciBaseException;
 
    /**
     * 获取用户密级
     * @param userId 用户主键
     * @return 用户的密级
     * @throws VciBaseException 参数错误,用户不存在会抛出异常
     */
    @GetMapping(USER)
    R<Integer> getUserSecret(@RequestParam("userId") String userId) throws VciBaseException ;
 
    /**
     * 获取用户密级
     * @param userVO 用户的显示对象
     * @return 用户的密级
     * @throws VciBaseException 参数错误,用户不存在会抛出异常
     */
    @GetMapping(USERVO)
    R<Integer> getUserSecret(@RequestBody UserVO userVO) throws VciBaseException;
 
    /**
     * 校验当前用户是否有权限访问数据
     * @param secret 数据的密级
     * @return true表示允许访问
     */
    @GetMapping(CHECKDATA)
    R<Boolean> checkDataSecret(@RequestParam("secret") int secret);
 
    /**
     * 校验用户的密级是否是否有权限访问数据
     * @param secret 数据的密级
     * @param userSecret 用户密级
     * @return true表示允许访问
     */
    @GetMapping(CHECKUSERDATA)
    R<Boolean> checkDataSecret(@RequestParam("secret") int secret, @RequestParam("userSecret") int userSecret) ;
 
    /**
     * 根据用户名来校验数据密级
     * @param secret 数据的密级
     * @param userId 用户名
     * @return true表示允许访问
     * @throws VciBaseException 参数错误,用户不存在会抛出异常
     */
    @GetMapping(CHECKUSERIDDATA)
    R<Boolean> checkDataSecret(@RequestParam("secret") int secret, @RequestParam("userId") String userId) throws VciBaseException;
 
    /**
     * 根据用户对象来校验数据密级
     * @param secret  数据的密级
     * @param userVO 用户的显示对象
     * @return true表示允许访问
     */
    @GetMapping(CHECKVO)
    R<Boolean> checkDataSecret(@RequestParam("secret") int secret,@RequestBody UserVO userVO) ;
 
    /**
     * 获取IP地址的密级
     * @param ip ip地址
     * @return 密级的值
     * @throws VciBaseException 查询出错的时候会抛出异常
     */
    @GetMapping(IP)
    R<Integer> getIpSecret(@RequestParam("ip") String ip) throws VciBaseException;
    /**
     * 检查机器密级
     * @param ipSecret 机器密级
     * @param userSecret 用户的密级
     * @return 密级的值
     */
    @GetMapping(IPUSER)
    R<Boolean> checkIpSecret(@RequestParam("ipSecret") int ipSecret, @RequestParam("userSecret") int userSecret);
 
    /**
     * 检查当前用户是否符合机器密级
     * @param ipSecret 机器密级
     * @return true表示允许访问
     */
    @GetMapping(IPSECRET)
    R<Boolean> checkIpSecret(@RequestParam("ipSecret") int ipSecret) ;
 
    /**
     * 校验指定ip和用户是否符合机器密级
     * @param ip ip地址
     * @param userId 用户名
     * @return true表示允许访问
     * @throws VciBaseException 参数错误,用户不存在会抛出异常
     */
    @GetMapping(IPUSERID)
    R<Boolean> checkIpSecret(@RequestParam("ip") String ip, @RequestParam("userId") String userId) throws VciBaseException;
 
    /**
     * 校验指定IP和用户对象符合机器密级
     * @param ip ip地址
     * @param userVO 用户对象
     * @return  true表示允许访问
     */
    @GetMapping(IPUSERVO)
    R<Boolean> checkIpSecret(@RequestParam("ip") String ip,@RequestBody UserVO userVO) ;
}