57e4c4dba3aa4c9277205ba30ffbc2eed1bedaa5.svn-base 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. package org.jeecg.common.system.api;
  2. import com.alibaba.fastjson.JSONObject;
  3. import org.jeecg.common.api.CommonAPI;
  4. import org.jeecg.common.api.dto.OnlineAuthDTO;
  5. import org.jeecg.common.api.dto.message.*;
  6. import org.jeecg.common.constant.ServiceNameConstants;
  7. import org.jeecg.common.system.api.factory.SysBaseAPIFallbackFactory;
  8. import org.jeecg.common.system.vo.*;
  9. import org.springframework.cloud.openfeign.FeignClient;
  10. import org.springframework.stereotype.Component;
  11. import org.springframework.web.bind.annotation.*;
  12. import java.util.List;
  13. import java.util.Map;
  14. import java.util.Set;
  15. /**
  16. * 相比较local版
  17. * 去掉了一些方法:
  18. * addLog getDatabaseType queryAllDepart
  19. * queryAllUser(Wrapper wrapper) queryAllUser(String[] userIds, int pageNo, int pageSize)
  20. * 修改了一些方法:
  21. * createLog
  22. * sendSysAnnouncement 只保留了一个,其余全部干掉
  23. *
  24. * cloud接口数量43 local:35 common:9 额外一个特殊queryAllRole一个当两个用
  25. */
  26. @Component
  27. @FeignClient(contextId = "sysBaseRemoteApi", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = SysBaseAPIFallbackFactory.class)
  28. public interface ISysBaseAPI extends CommonAPI {
  29. /**
  30. * 1发送系统消息
  31. * @param message 使用构造器赋值参数 如果不设置category(消息类型)则默认为2 发送系统消息
  32. */
  33. @PostMapping("/sys/api/sendSysAnnouncement")
  34. void sendSysAnnouncement(@RequestBody MessageDTO message);
  35. /**
  36. * 2发送消息 附带业务参数
  37. * @param message 使用构造器赋值参数
  38. */
  39. @PostMapping("/sys/api/sendBusAnnouncement")
  40. void sendBusAnnouncement(@RequestBody BusMessageDTO message);
  41. /**
  42. * 3通过模板发送消息
  43. * @param message 使用构造器赋值参数
  44. */
  45. @PostMapping("/sys/api/sendTemplateAnnouncement")
  46. void sendTemplateAnnouncement(@RequestBody TemplateMessageDTO message);
  47. /**
  48. * 4通过模板发送消息 附带业务参数
  49. * @param message 使用构造器赋值参数
  50. */
  51. @PostMapping("/sys/api/sendBusTemplateAnnouncement")
  52. void sendBusTemplateAnnouncement(@RequestBody BusTemplateMessageDTO message);
  53. /**
  54. * 5通过消息中心模板,生成推送内容
  55. * @param templateDTO 使用构造器赋值参数
  56. * @return
  57. */
  58. @PostMapping("/sys/api/parseTemplateByCode")
  59. String parseTemplateByCode(@RequestBody TemplateDTO templateDTO);
  60. /**
  61. * 6根据用户id查询用户信息
  62. * @param id
  63. * @return
  64. */
  65. @GetMapping("/sys/api/getUserById")
  66. LoginUser getUserById(@RequestParam("id") String id);
  67. /**
  68. * 7通过用户账号查询角色集合
  69. * @param username
  70. * @return
  71. */
  72. @GetMapping("/sys/api/getRolesByUsername")
  73. List<String> getRolesByUsername(@RequestParam("username") String username);
  74. /**
  75. * 8通过用户账号查询部门集合
  76. * @param username
  77. * @return 部门 id
  78. */
  79. @GetMapping("/sys/api/getDepartIdsByUsername")
  80. List<String> getDepartIdsByUsername(@RequestParam("username") String username);
  81. /**
  82. * 9通过用户账号查询部门 name
  83. * @param username
  84. * @return 部门 name
  85. */
  86. @GetMapping("/sys/api/getDepartNamesByUsername")
  87. List<String> getDepartNamesByUsername(@RequestParam("username") String username);
  88. /**
  89. * 10获取数据字典
  90. * @param code
  91. * @return
  92. */
  93. @GetMapping("/sys/api/queryDictItemsByCode")
  94. List<DictModel> queryDictItemsByCode(@RequestParam("code") String code);
  95. /**
  96. * 获取有效的数据字典项
  97. * @param code
  98. * @return
  99. */
  100. @GetMapping("/sys/api/queryEnableDictItemsByCode")
  101. public List<DictModel> queryEnableDictItemsByCode(@RequestParam("code") String code);
  102. /** 11查询所有的父级字典,按照create_time排序 */
  103. @GetMapping("/sys/api/queryAllDict")
  104. List<DictModel> queryAllDict();
  105. /**
  106. * 12查询所有分类字典
  107. * @return
  108. */
  109. @GetMapping("/sys/api/queryAllDSysCategory")
  110. List<SysCategoryModel> queryAllDSysCategory();
  111. /**
  112. * 13获取表数据字典
  113. * @param table
  114. * @param text
  115. * @param code
  116. * @return
  117. */
  118. @GetMapping("/sys/api/queryTableDictItemsByCode")
  119. List<DictModel> queryTableDictItemsByCode(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code);
  120. /**
  121. * 14查询所有部门 作为字典信息 id -->value,departName -->text
  122. * @return
  123. */
  124. @GetMapping("/sys/api/queryAllDepartBackDictModel")
  125. List<DictModel> queryAllDepartBackDictModel();
  126. /**
  127. * 15根据业务类型 busType 及业务 busId 修改消息已读
  128. */
  129. @GetMapping("/sys/api/updateSysAnnounReadFlag")
  130. public void updateSysAnnounReadFlag(@RequestParam("busType") String busType, @RequestParam("busId")String busId);
  131. /**
  132. * 16查询表字典 支持过滤数据
  133. * @param table
  134. * @param text
  135. * @param code
  136. * @param filterSql
  137. * @return
  138. */
  139. @GetMapping("/sys/api/queryFilterTableDictInfo")
  140. List<DictModel> queryFilterTableDictInfo(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("filterSql") String filterSql);
  141. /**
  142. * 17查询指定table的 text code 获取字典,包含text和value
  143. * @param table
  144. * @param text
  145. * @param code
  146. * @param keyArray
  147. * @return
  148. */
  149. @Deprecated
  150. @GetMapping("/sys/api/queryTableDictByKeys")
  151. public List<String> queryTableDictByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keyArray") String[] keyArray);
  152. /**
  153. * 18查询所有用户 返回ComboModel
  154. * @return
  155. */
  156. @GetMapping("/sys/api/queryAllUserBackCombo")
  157. public List<ComboModel> queryAllUserBackCombo();
  158. /**
  159. * 19分页查询用户 返回JSONObject
  160. * @return
  161. */
  162. @GetMapping("/sys/api/queryAllUser")
  163. public JSONObject queryAllUser(@RequestParam(name="userIds",required=false)String userIds, @RequestParam(name="pageNo",required=false) Integer pageNo,@RequestParam(name="pageSize",required=false) int pageSize);
  164. /**
  165. * 20获取所有角色 带参
  166. * roleIds 默认选中角色
  167. * @return
  168. */
  169. @GetMapping("/sys/api/queryAllRole")
  170. public List<ComboModel> queryAllRole(@RequestParam(name = "roleIds",required = false)String[] roleIds);
  171. /**
  172. * 21通过用户账号查询角色Id集合
  173. * @param username
  174. * @return
  175. */
  176. @GetMapping("/sys/api/getRoleIdsByUsername")
  177. public List<String> getRoleIdsByUsername(@RequestParam("username")String username);
  178. /**
  179. * 22通过部门编号查询部门id
  180. * @param orgCode
  181. * @return
  182. */
  183. @GetMapping("/sys/api/getDepartIdsByOrgCode")
  184. public String getDepartIdsByOrgCode(@RequestParam("orgCode")String orgCode);
  185. /**
  186. * 23查询所有部门
  187. * @return
  188. */
  189. @GetMapping("/sys/api/getAllSysDepart")
  190. public List<SysDepartModel> getAllSysDepart();
  191. /**
  192. * 24查找父级部门
  193. * @param departId
  194. * @return
  195. */
  196. @GetMapping("/sys/api/getParentDepartId")
  197. DictModel getParentDepartId(@RequestParam("departId")String departId);
  198. /**
  199. * 25根据部门Id获取部门负责人
  200. * @param deptId
  201. * @return
  202. */
  203. @GetMapping("/sys/api/getDeptHeadByDepId")
  204. public List<String> getDeptHeadByDepId(@RequestParam("deptId") String deptId);
  205. /**
  206. * 26给指定用户发消息
  207. * @param userIds
  208. * @param cmd
  209. */
  210. @GetMapping("/sys/api/sendWebSocketMsg")
  211. public void sendWebSocketMsg(@RequestParam("userIds")String[] userIds, @RequestParam("cmd") String cmd);
  212. /**
  213. * 27根据id获取所有参与用户
  214. * userIds
  215. * @return
  216. */
  217. @GetMapping("/sys/api/queryAllUserByIds")
  218. public List<LoginUser> queryAllUserByIds(@RequestParam("userIds") String[] userIds);
  219. /**
  220. * 28将会议签到信息推动到预览
  221. * userIds
  222. * @return
  223. * @param userId
  224. */
  225. @GetMapping("/sys/api/meetingSignWebsocket")
  226. void meetingSignWebsocket(@RequestParam("userId")String userId);
  227. /**
  228. * 29根据name获取所有参与用户
  229. * userNames
  230. * @return
  231. */
  232. @GetMapping("/sys/api/queryUserByNames")
  233. List<LoginUser> queryUserByNames(@RequestParam("userNames")String[] userNames);
  234. /**
  235. * 30获取用户的角色集合
  236. * @param username
  237. * @return
  238. */
  239. @GetMapping("/sys/api/getUserRoleSet")
  240. Set<String> getUserRoleSet(@RequestParam("username")String username);
  241. /**
  242. * 31获取用户的权限集合
  243. * @param username
  244. * @return
  245. */
  246. @GetMapping("/sys/api/getUserPermissionSet")
  247. Set<String> getUserPermissionSet(@RequestParam("username") String username);
  248. /**
  249. * 32判断是否有online访问的权限
  250. * @param onlineAuthDTO
  251. * @return
  252. */
  253. @PostMapping("/sys/api/hasOnlineAuth")
  254. boolean hasOnlineAuth(@RequestBody OnlineAuthDTO onlineAuthDTO);
  255. /**
  256. * 33通过部门id获取部门全部信息
  257. */
  258. @GetMapping("/sys/api/selectAllById")
  259. SysDepartModel selectAllById(@RequestParam("id") String id);
  260. /**
  261. * 34根据用户id查询用户所属公司下所有用户ids
  262. * @param userId
  263. * @return
  264. */
  265. @GetMapping("/sys/api/queryDeptUsersByUserId")
  266. List<String> queryDeptUsersByUserId(@RequestParam("userId") String userId);
  267. //---
  268. /**
  269. * 35查询用户角色信息
  270. * @param username
  271. * @return
  272. */
  273. @GetMapping("/sys/api/queryUserRoles")
  274. Set<String> queryUserRoles(@RequestParam("username")String username);
  275. /**
  276. * 36查询用户权限信息
  277. * @param username
  278. * @return
  279. */
  280. @GetMapping("/sys/api/queryUserAuths")
  281. Set<String> queryUserAuths(@RequestParam("username")String username);
  282. /**
  283. * 37根据 id 查询数据库中存储的 DynamicDataSourceModel
  284. *
  285. * @param dbSourceId
  286. * @return
  287. */
  288. @GetMapping("/sys/api/getDynamicDbSourceById")
  289. DynamicDataSourceModel getDynamicDbSourceById(@RequestParam("dbSourceId") String dbSourceId);
  290. /**
  291. * 38根据 code 查询数据库中存储的 DynamicDataSourceModel
  292. *
  293. * @param dbSourceCode
  294. * @return
  295. */
  296. @GetMapping("/sys/api/getDynamicDbSourceByCode")
  297. DynamicDataSourceModel getDynamicDbSourceByCode(@RequestParam("dbSourceCode") String dbSourceCode);
  298. /**
  299. * 39根据用户账号查询用户信息 CommonAPI中定义
  300. * @param username
  301. */
  302. @GetMapping("/sys/api/getUserByName")
  303. LoginUser getUserByName(@RequestParam("username") String username);
  304. /**
  305. * 40字典表的 翻译
  306. * @param table
  307. * @param text
  308. * @param code
  309. * @param key
  310. * @return
  311. */
  312. @GetMapping("/sys/api/translateDictFromTable")
  313. String translateDictFromTable(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("key") String key);
  314. /**
  315. * 41普通字典的翻译
  316. * @param code
  317. * @param key
  318. * @return
  319. */
  320. @GetMapping("/sys/api/translateDict")
  321. String translateDict(@RequestParam("code") String code, @RequestParam("key") String key);
  322. /**
  323. * 42查询数据权限
  324. * @return
  325. */
  326. @GetMapping("/sys/api/queryPermissionDataRule")
  327. List<SysPermissionDataRuleModel> queryPermissionDataRule(@RequestParam("component") String component, @RequestParam("requestPath")String requestPath, @RequestParam("username") String username);
  328. /**
  329. * 43查询用户信息
  330. * @param username
  331. * @return
  332. */
  333. @GetMapping("/sys/api/getCacheUser")
  334. SysUserCacheInfo getCacheUser(@RequestParam("username") String username);
  335. /**
  336. * 36根据多个用户账号(逗号分隔),查询返回多个用户信息
  337. * @param usernames
  338. * @return
  339. */
  340. @GetMapping("/sys/api/queryUsersByUsernames")
  341. List<JSONObject> queryUsersByUsernames(@RequestParam("usernames") String usernames);
  342. /**
  343. * 37根据多个用户ID(逗号分隔),查询返回多个用户信息
  344. * @param ids
  345. * @return
  346. */
  347. @RequestMapping("/sys/api/queryUsersByIds")
  348. List<JSONObject> queryUsersByIds(@RequestParam("ids") String ids);
  349. /**
  350. * 38根据多个部门编码(逗号分隔),查询返回多个部门信息
  351. * @param orgCodes
  352. * @return
  353. */
  354. @RequestMapping("/sys/api/queryDepartsByOrgcodes")
  355. List<JSONObject> queryDepartsByOrgcodes(@RequestParam("orgCodes") String orgCodes);
  356. /**
  357. * 39根据多个部门编码(逗号分隔),查询返回多个部门信息
  358. * @param ids
  359. * @return
  360. */
  361. @GetMapping("/sys/api/queryDepartsByOrgIds")
  362. List<JSONObject> queryDepartsByOrgIds(@RequestParam("ids") String ids);
  363. /**
  364. * 40发送邮件消息
  365. * @param email
  366. * @param title
  367. * @param content
  368. */
  369. @GetMapping("/sys/api/sendEmailMsg")
  370. void sendEmailMsg(@RequestParam("email")String email,@RequestParam("title")String title,@RequestParam("content")String content);
  371. /**
  372. * 41 获取公司下级部门和公司下所有用户id
  373. * @param orgCode
  374. */
  375. @GetMapping("/sys/api/getDeptUserByOrgCode")
  376. List<Map> getDeptUserByOrgCode(@RequestParam("orgCode")String orgCode);
  377. /**
  378. * 42 查询分类字典翻译
  379. */
  380. @GetMapping("/sys/api/loadCategoryDictItem")
  381. List<String> loadCategoryDictItem(@RequestParam("ids") String ids);
  382. /**
  383. * 43 根据字典code加载字典text
  384. *
  385. * @param dictCode 顺序:tableName,text,code
  386. * @param keys 要查询的key
  387. * @return
  388. */
  389. @GetMapping("/sys/api/loadDictItem")
  390. List<String> loadDictItem(@RequestParam("dictCode") String dictCode, @RequestParam("keys") String keys);
  391. /**
  392. * 44 根据字典code查询字典项
  393. *
  394. * @param dictCode 顺序:tableName,text,code
  395. * @param dictCode 要查询的key
  396. * @return
  397. */
  398. @GetMapping("/sys/api/getDictItems")
  399. List<DictModel> getDictItems(@RequestParam("dictCode") String dictCode);
  400. /**
  401. * 45 根据多个字典code查询多个字典项
  402. *
  403. * @param dictCodeList
  404. * @return key = dictCode ; value=对应的字典项
  405. */
  406. @RequestMapping("/sys/api/getManyDictItems")
  407. Map<String, List<DictModel>> getManyDictItems(@RequestParam("dictCodeList") List<String> dictCodeList);
  408. /**
  409. * 46 【JSearchSelectTag下拉搜索组件专用接口】
  410. * 大数据量的字典表 走异步加载 即前端输入内容过滤数据
  411. *
  412. * @param dictCode 字典code格式:table,text,code
  413. * @param keyword 过滤关键字
  414. * @return
  415. */
  416. @GetMapping("/sys/api/loadDictItemByKeyword")
  417. List<DictModel> loadDictItemByKeyword(@RequestParam("dictCode") String dictCode, @RequestParam("keyword") String keyword, @RequestParam(value = "pageSize", required = false) Integer pageSize);
  418. /**
  419. * 47 根据多个部门id(逗号分隔),查询返回多个部门信息
  420. * @param ids
  421. * @return
  422. */
  423. @GetMapping("/sys/api/queryDepartsByIds")
  424. List<JSONObject> queryDepartsByIds(@RequestParam("ids") String ids);
  425. /**
  426. * 48 普通字典的翻译,根据多个dictCode和多条数据,多个以逗号分割
  427. * @param dictCodes
  428. * @param keys
  429. * @return
  430. */
  431. @Override
  432. @GetMapping("/sys/api/translateManyDict")
  433. Map<String, List<DictModel>> translateManyDict(@RequestParam("dictCodes") String dictCodes, @RequestParam("keys") String keys);
  434. /**
  435. * 49 字典表的 翻译,可批量
  436. * @param table
  437. * @param text
  438. * @param code
  439. * @param keys 多个用逗号分割
  440. * @return
  441. */
  442. @Override
  443. @GetMapping("/sys/api/translateDictFromTableByKeys")
  444. List<DictModel> translateDictFromTableByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keys") String keys);
  445. }