SettingsController.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. package thyyxxk.webserver.controller.settings;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import lombok.Data;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.web.bind.annotation.*;
  6. import thyyxxk.webserver.entity.ResultVo;
  7. import thyyxxk.webserver.entity.login.PersonnelQueryConditions;
  8. import thyyxxk.webserver.entity.login.UserInfo;
  9. import thyyxxk.webserver.entity.login.VueMenu;
  10. import thyyxxk.webserver.entity.settings.deptphones.DeptPhones;
  11. import thyyxxk.webserver.entity.settings.permissions.*;
  12. import thyyxxk.webserver.entity.settings.users.ChangePwdParam;
  13. import thyyxxk.webserver.entity.settings.users.WorkIntegrationPlatformAdvice;
  14. import thyyxxk.webserver.service.settings.SettingsService;
  15. import java.util.List;
  16. @RestController
  17. @RequestMapping("/settings")
  18. public class SettingsController {
  19. private final SettingsService service;
  20. @Autowired
  21. public SettingsController(SettingsService service) {
  22. this.service = service;
  23. }
  24. @GetMapping("/getUserInfo")
  25. public ResultVo<UserInfo> getUserInfo() {
  26. return service.getUserInfo();
  27. }
  28. @PostMapping("/changePassword")
  29. public ResultVo<String> changePassword(@RequestBody ChangePwdParam param) {
  30. return service.changePassword(param);
  31. }
  32. @GetMapping("/getDeptTree")
  33. public ResultVo<List<DeptTree>> getDeptTree() {
  34. return service.getDeptTree();
  35. }
  36. @PostMapping("/getAllUsers")
  37. public ResultVo<IPage<UserInfo>> getAllUsers(@RequestBody PersonnelQueryConditions param) {
  38. return service.getAllUsers(param);
  39. }
  40. @GetMapping("/getAllRoles")
  41. public ResultVo<List<Role>> getAllRoles() {
  42. return service.getAllRoles();
  43. }
  44. @GetMapping("/getUserRoles")
  45. public ResultVo<List<Integer>> getUserRoles(@RequestParam("code") String code) {
  46. return service.getUserRoles(code);
  47. }
  48. @PostMapping("/saveUserRoles")
  49. public ResultVo<String> saveUserRoles(@RequestBody SaveUserRolesParam param) {
  50. return service.saveUserRoles(param);
  51. }
  52. @GetMapping("/addNewRole")
  53. public ResultVo<String> addNewRole(@RequestParam("name") String name) {
  54. return service.addNewRole(name.trim());
  55. }
  56. @Deprecated
  57. @GetMapping("/getRoleMenus")
  58. public ResultVo<List<Integer>> getRoleMenus(@RequestParam("id") Integer id) {
  59. return service.getRoleMenus(id);
  60. }
  61. @Deprecated
  62. @PostMapping("/saveRoleMenus")
  63. public ResultVo<String> saveRoleMenus(@RequestBody SaveRoleMenusParam param) {
  64. return service.saveRoleMenus(param);
  65. }
  66. @GetMapping("/getDeptPhones")
  67. public ResultVo<List<DeptPhones>> getDeptPhones() {
  68. return service.getDeptPhones();
  69. }
  70. @PostMapping("/saveDeptPhone")
  71. public ResultVo<String> saveDeptPhone(@RequestBody DeptPhones param) {
  72. return service.saveDeptPhone(param);
  73. }
  74. @GetMapping("/getMyAdvices")
  75. public ResultVo<List<WorkIntegrationPlatformAdvice>> getMyAdvices() {
  76. return service.getMyAdvices();
  77. }
  78. @PostMapping("/submitNewAdvice")
  79. public ResultVo<String> submitNewAdvice(@RequestBody WorkIntegrationPlatformAdvice advice) {
  80. return service.submitNewAdvice(advice);
  81. }
  82. @GetMapping("/checkAdvice")
  83. public ResultVo<String> checkAdvice(@RequestParam("id") Integer id) {
  84. return service.checkAdvice(id);
  85. }
  86. @GetMapping("/dismissUserBadge")
  87. public ResultVo<String> dismissUserBadge(@RequestParam("id") Integer id) {
  88. return service.dismissUserBadge(id);
  89. }
  90. @PostMapping("/replyAdvice")
  91. public ResultVo<String> replyAdvice(@RequestBody WorkIntegrationPlatformAdvice advice) {
  92. return service.replyAdvice(advice);
  93. }
  94. @GetMapping("/getAllVueMenus")
  95. public ResultVo<List<VueMenu>> getAllVueMenus() {
  96. return service.getAllVueMenus();
  97. }
  98. @GetMapping("/getRoleVueMenus")
  99. public ResultVo<List<Integer>> getRoleVueMenus(@RequestParam("id") Integer id) {
  100. return service.getRoleVueMenus(id);
  101. }
  102. @PostMapping("/saveRoleVueMenus")
  103. public ResultVo<String> saveRoleVueMenus(@RequestBody SaveRoleMenusParam param) {
  104. return service.saveRoleVueMenus(param);
  105. }
  106. @PostMapping("/modifyEmployeeInfo")
  107. public ResultVo<String> modifyEmployeeInfo(@RequestBody UserInfo userInfo) {
  108. return service.modifyEmployeeInfo(userInfo);
  109. }
  110. @PostMapping("/saveEmployeeInfo")
  111. public ResultVo<String> saveEmployeeInfo(@RequestBody UserInfo userInfo) {
  112. return service.saveEmployeeInfo(userInfo);
  113. }
  114. @Data
  115. public static class ResetPassword {
  116. private String code;
  117. private Integer nextTime;
  118. }
  119. @PostMapping("/resetPasswordByCode")
  120. public ResultVo<String> resetPasswordByCode(@RequestBody ResetPassword r) {
  121. return service.resetPasswordByCode(r.getCode(), r.getNextTime());
  122. }
  123. }