ludc
2025-01-15 c659560c7ee8d8f8278b938421de13bf65d1e1b1
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
package com.vci.web.service;
 
import com.vci.corba.common.PLException;
import com.vci.dto.SmUserDTO;
import com.vci.pagemodel.SmUserVO;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.*;
import org.springframework.web.multipart.MultipartFile;
 
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
/**
 * 用户的查询相关的服务,可以兼容老平台和老的pdm
 * 其中包含登录相关的接口和参照,根据主键查询等接口
 * 所有的数据全部转换为新平台的对象
 * @author weidy
 * @date 2020/3/1
 */
public interface SmUserQueryServiceI{
 
    /**
     * 检查用户是否存在,可以根据用户名,也可以根据用户oid
     * @param userName  传null,即用oid作为检查条件
     * @param oid    传null,即用userName作为检查条件
     * @return true存在,false不存在
     */
    boolean checkUserExist(String userName,String oid) throws PLException;
 
    /**
     * 根据用户名获取用户的对象,不区分大小写
     * @param userId 用户名
     * @return 用户的显示对象,如果用户不存在则返回null,不会抛出异常
     * @throws VciBaseException 参数为空或者数据库存在问题的时候会抛出异常
     */
    SmUserVO getUserByUserId(String userId);
 
    /**
     * 批量获取用户的信息(根据用户名)
     * @param userIdCollections 用户名的集合,可以超过1000个
     * @return 用户的显示对象,如果用户不存在则返回空的列表,不会抛出异常
     * @throws VciBaseException 参数为空或者数据库存在问题的时候会抛出异常
     */
    List<SmUserVO> listUserByUserIds(Collection<String> userIdCollections);
 
    /**
     * 根据用户主键获取用户的信息
     * @param userOid 用户主键
     * @return 用户的显示对象,如果用户不存在则返回null,不会抛出异常
     * @throws VciBaseException 参数为空或者数据库存在问题的时候会抛出异常
     */
    SmUserVO getUserByUserOid(String userOid);
 
    /**
     * 批量获取用户的信息 (根据用户主键)
     * @param userOidCollections 用户主键的集合,可以超过1000个
     * @return 用户的显示对象,如果用户不存在则返回空的列表,不会抛出异常
     * @throws VciBaseException 参数为空或者数据库存在问题的时候会抛出异常
     */
    List<SmUserVO> listUserByUserOids(Collection<String> userOidCollections);
 
    /**
     * 用户管理界面分页查询
     * @param conditionMap 查询条件
     * @param pageHelper 分页参数
     * @return
     */
    DataGrid<SmUserVO> getDataGridUsers(Map<String, String> conditionMap, PageHelper pageHelper);
 
    /**
     * 根据用户名获取用户的姓名
     * @param userId 用户名
     * @return 用户姓名,如果不存在会返回Null
     */
    String getUserNameByUserId(String userId);
 
    /**
     * 根据用户主键获取用户的姓名
     * @param userOid 用户主键
     * @return 用户姓名,如果不存在会返回null
     */
    String getUserNameByUserOid(String userOid);
 
    /**
     * 批量根据部门的主键获取用户
     * @param deptOidCollection 部门的主键集合
     * @return 部门主键和对应的用户显示对象列表的映射,key部门的主键,value是这个部门下的用户
     * @throws VciBaseException 参数为空或者查询出错的时候会抛出异常
     */
    Map<String,List<SmUserVO>> batchListUserByDeptOids(Collection<String> deptOidCollection);
 
    /**
     * 统计部门下的用户:包含子部门下的用户
     * @param deptOid
     * @param queryMap
     * @return
     * @throws VciBaseException
     */
    List<SmUserVO> countSmUserByDeptOid(String deptOid, Map<String, String> queryMap);
 
    /**
     * 查询某个部门下的用户对象
     * @param deptOid 部门的主键
     * @param queryMap 查询条件,如果是部门的某个属性作为查询条件,则可以使用pkDepartment.xxx这样的方式
     * @return 用户的显示对象列表
     * @throws VciBaseException 参数为空或者查询出错的时候会抛出异常
     */
    List<SmUserVO> listUserByDeptOid(String deptOid, Map<String, String> queryMap);
 
    /**
     * 查询不在某个部门下的用户对象列表
     * @param deptOid 部门的主键
     * @param queryMap 查询条件,如果是部门的某个属性作为查询条件,则可以使用pkDepartment.xxx这样的方式
     * @return 用户的显示对象列表,默认使用用户名升序排列
     * @throws VciBaseException 参数为空或者查询出错的时候会抛出异常
     */
    List<SmUserVO> listUserUnInDeptOid(String deptOid, Map<String, String> queryMap);
 
    /**
     *  查询某个角色下的用户对象列表
     * @param roleOid 角色的主键
     * @param queryMap 查询条件,如果是角色的某个属性作为查询条件,则可以使用pkRole.xxx这样的方式
     * @return 用户的显示对象列表
     * @throws VciBaseException 参数为空或者查询出错的时候会抛出异常
     */
    List<SmUserVO> listUserByRoleOid(String roleOid, Map<String, String> queryMap);
 
    /**
     * 查询不在某个角色下的用户对象列表
     * @param roleOid 角色的主键
     * @param queryMap 查询条件,如果是角色的某个属性作为查询条件,则可以使用pkRole.xxx这样的方式
     * @return 用户的显示对象列表,默认使用用户名升序排列
     * @throws VciBaseException 参数为空或者查询出错的时候会抛出异常
     */
    List<SmUserVO> listUserUnInRoleOid(String roleOid, Map<String, String> queryMap);
 
    /**
     * 批量根据角色的主键获取用户
     * @param roleOidCollection 角色的主键集合
     * @return 角色主键和对应的用户显示对象列表的映射,key角色的主键,value是这个角色下的用户
     * @throws VciBaseException 参数为空或者查询出错的时候会抛出异常
     */
    Map<String,List<SmUserVO>> batchListUserByRoleOids(Collection<String> roleOidCollection);
 
    /**
     * 参照生效的用户
     * @param queryMap 查询条件
     * @param pageHelper 分页对象
     * @return 用户的显示对象,默认使用用户名升序排列
     * @throws VciBaseException 查询出错的时候会抛出异常
     */
    DataGrid<SmUserVO> refGridUsers(Map<String, String> queryMap, PageHelper pageHelper);
 
    /**
     * 参照用户的树形显示
     * @param treeQueryObject 树型接口查询对象
     * @return 用户的树形信息,里面会包含用户对象里的所有属性
     * @throws VciBaseException 查询出错的时候会抛出异常
     */
    List<Tree> refTreeUsers(TreeQueryObject treeQueryObject);
 
    /**
     * 人员权限选择树
     * @param treeQueryObject
     * @return
     * @throws VciBaseException
     */
    List<Tree> refPersonOrgTree(TreeQueryObject treeQueryObject);
 
    /**
     * 校验密码是否相同,在新平台中存储的密码是两次md5
     * @param userOid 用户主键
     * @param md5Password 已经md5加密一次的密码
     * @return true 表示相等,false表示不相等
     */
    boolean checkPasswordEqual(String md5Password, String userOid);
 
    /**
     * 校验用户是否锁定
     * @param smUserVO 用户对象
     * @param wrongCount 密码错误次数,如果wrongCount为空时,会校验用户本身是否已经锁定了
     * @return true表示已经锁定
     */
    boolean checkUserLock(SmUserVO smUserVO, Integer wrongCount);
 
    /**
     * 设置某个用户是锁定状态
     * @param userId 用户名
     */
    void lockUser(String userId);
 
    /**
     * 设置某个用户不是锁定状态
     * @param userId 用户名
     */
    void unLockUser(String userId);
 
    /**
     * 修改密码
     * @param userName 用户主键
     * @param oldPassword 旧的密码
     * @param password 新的密码
     * @param confirmPassword 确认密码
     */
    boolean changePassword(String userName,String oldPassword, String password, String confirmPassword) throws Exception;
 
    /**
     * 更新用户的密码错误次数
     * @param userOid 用户的主键
     * @param wrongCount 密码的错误次数
     * @throws VciBaseException 参数为空或者存储到数据库中出错的时候会抛出异常
     */
    void updateUserPwdWrongCount(String userOid, int wrongCount);
 
    /**
     * 更新用户的最后登录时间
     * @param userOid 用户的主键
     * @throws VciBaseException 参数为空的时候会抛出异常
     */
    void updateUserLoginTime(String userOid);
 
    /**
     * 添加用户
     * @param smUserDTO
     * @return
     */
    boolean addUser(SmUserDTO smUserDTO) throws PLException;
 
    /**
     * 修改用户
     * @param smUserDTO
     * @return
     */
    boolean updateUser(SmUserDTO smUserDTO) throws PLException;
 
    /**
     * 删除用户
     * @param ids
     * @return
     */
    boolean deleteUser(String[] ids) throws PLException;
 
    /**
     * 用户停用/启用
     * @param ids
     * @param flag
     * @return
     */
    boolean stopUsers(String[] ids,boolean flag) throws PLException;
 
    /**
     * 下载导入人员的excel模板。
     * @param downloadFileName
     * @return
     */
    String downloadImportTemplate(String downloadFileName);
 
    /**
     * 导入成员
     * @param file
     * @return
     * @throws VciBaseException
     */
    BaseResult importUser(File file) throws Exception;
 
    /**
     * 根据角色类型查询用户名
     * @param roleType
     * @return
     */
    List<String> queryUserNameByRoleType(String roleType);
 
    /**
     * 使用当前用户的类型查询用户
     * @return
     * @throws VciBaseException
     */
    List<SmUserVO> listUserByUserType(Integer type) throws PLException;
 
    /**
     * 导出用户列表三员账号除外
     * @return
     */
    String expUser() throws PLException;
    /**
     * 修改用户头像
     * @param file 文件
     * @return
     */
    boolean updateUserPhoto(MultipartFile file) throws PLException;
 
    String getUserPhoto() throws PLException;
}