DeptController.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.sooka.sponest.mobile.system.dept;
  2. import com.ruoyi.common.core.web.domain.AjaxResult;
  3. import com.ruoyi.system.api.domain.SysDept;
  4. import com.sooka.sponest.mobile.remoteapi.RemoteSystemBaseService;
  5. import org.springframework.web.bind.annotation.*;
  6. import javax.annotation.Resource;
  7. import java.util.ArrayList;
  8. import java.util.HashMap;
  9. import java.util.List;
  10. /**
  11. * @Author LG
  12. * @Date 2023/10/11 - 9:57
  13. */
  14. @RestController
  15. @RequestMapping("/dept")
  16. public class DeptController {
  17. @Resource
  18. RemoteSystemBaseService remoteSystemBaseService;
  19. @GetMapping("/userDeptSelectIncludeChildren")
  20. public AjaxResult getUserList(SysDept sysDept) {
  21. AjaxResult deptList = remoteSystemBaseService.userDeptSelectIncludeChildren(String.valueOf(sysDept.getDeptId()));
  22. return AjaxResult.success(deptList.get("data"));
  23. }
  24. /**
  25. * 获取当日用户的所属部门
  26. *
  27. * @return
  28. */
  29. @GetMapping("/userDeptSelect")
  30. public AjaxResult getUserDeptSelect() {
  31. AjaxResult result = remoteSystemBaseService.getUserDeptSelect();
  32. if ("200".equals(String.valueOf(result.get("code")))) {
  33. List<HashMap<String, Object>> data = (List<HashMap<String, Object>>) result.get("data");
  34. if(!data.isEmpty()){
  35. List<HashMap<String, Object>> resultList = new ArrayList<>();
  36. HashMap<String, Object> map = new HashMap<>();
  37. map.put("deptId", data.get(0).get("id"));
  38. map.put("deptName", data.get(0).get("label"));
  39. resultList.add(map);
  40. return AjaxResult.success(resultList);
  41. }else{
  42. return AjaxResult.error("500", "data is null");
  43. }
  44. } else {
  45. return AjaxResult.error(String.valueOf(result.get("code")), result.get("msg"));
  46. }
  47. }
  48. /**
  49. * 根据部门ID和岗位ID查询子节点集合
  50. * @param deptId
  51. * @param postId
  52. * @return
  53. */
  54. @GetMapping("/getChildren")
  55. public AjaxResult getChildren(@RequestParam("deptId") String deptId, @RequestParam("postId") String postId) {
  56. return remoteSystemBaseService.getChildren(deptId, postId);
  57. }
  58. /**
  59. * 查询所属开发区
  60. * @param sysDept
  61. * @return
  62. */
  63. @PostMapping("/getDeptsByDeptType")
  64. public AjaxResult getDeptsByDeptType(@RequestBody SysDept sysDept){
  65. sysDept.setDeptType("sys_dept_type_27");
  66. return remoteSystemBaseService.getDeptsByDeptType(sysDept);
  67. }
  68. }