OrganizationController.java 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.bosshand.virgo.controller;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.bosshand.virgo.core.model.MgrOrganization;
  4. import com.bosshand.virgo.core.response.Response;
  5. import com.bosshand.virgo.service.OrganizationService;
  6. import io.swagger.annotations.ApiOperation;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.*;
  9. import java.util.HashMap;
  10. import java.util.List;
  11. import java.util.Map;
  12. @RestController
  13. @RequestMapping("base")
  14. public class OrganizationController {
  15. @Autowired
  16. OrganizationService organizationService;
  17. @ApiOperation(value="组织列表", notes="组织列表")
  18. @RequestMapping(value = "/organization/list", method = RequestMethod.POST)
  19. public Response getOrganizationList(@RequestBody JSONObject parameter) {
  20. List<MgrOrganization> list = organizationService.getList(parameter);
  21. int totalCount = organizationService.getTotalCount(parameter);
  22. Map<String, Object> result = new HashMap<String, Object>();
  23. result.put("dataList", list);
  24. result.put("totalCount", totalCount);
  25. return Response.ok(result);
  26. }
  27. @ApiOperation(value="组织详情", notes="组织详情")
  28. @RequestMapping(value = "/organization/{id}", method = RequestMethod.GET)
  29. public Response getOrganization(@PathVariable long id) {
  30. MgrOrganization mgrOrganization = organizationService.get(id);
  31. return Response.ok(mgrOrganization);
  32. }
  33. @ApiOperation(value="组织信息更新", notes="组织信息更新")
  34. @RequestMapping(value = "/organization/update", method = RequestMethod.POST)
  35. public Response updateOrganization(@RequestBody MgrOrganization mgrOrganization) {
  36. organizationService.update(mgrOrganization);
  37. return Response.ok();
  38. }
  39. @ApiOperation(value="组织信息审核", notes="组织信息审核")
  40. @RequestMapping(value = "/organization/updateStatus", method = RequestMethod.POST)
  41. public Response updateStatusOrganization(@RequestBody MgrOrganization mgrOrganization) {
  42. organizationService.updateStatus(mgrOrganization);
  43. return Response.ok();
  44. }
  45. @ApiOperation(value="根据organizationIds获取组织列表", notes="根据organizationIds获取组织列表")
  46. @RequestMapping(value = "/{organizationIds}/organization", method = RequestMethod.GET)
  47. public Response organizationByIds(@PathVariable String organizationIds) {
  48. return Response.ok(organizationService.organizationByIds(organizationIds));
  49. }
  50. @ApiOperation(value="设置组织文件", notes="设置组织文件")
  51. @RequestMapping(value = "/organization/organizedDataCenter", method = RequestMethod.PUT)
  52. public Response setOrganizedDataCenter(@RequestBody MgrOrganization mgrOrganization) {
  53. return Response.ok(organizationService.setOrganizedDataCenter(mgrOrganization));
  54. }
  55. @ApiOperation(value="根据组织名称获取组织", notes="根据组织名称获取组织")
  56. @RequestMapping(value = "/organizationName/{name}", method = RequestMethod.GET)
  57. public Response getByOrganizationName(@PathVariable String name) {
  58. return Response.ok(organizationService.getByOrganizationName(name));
  59. }
  60. @ApiOperation(value="根据organizationCode获取组织", notes="根据organizationCode获取组织")
  61. @RequestMapping(value = "/organizationCode/{organizationCode}", method = RequestMethod.GET)
  62. public Response getByOrganizationCode(@PathVariable String organizationCode) {
  63. MgrOrganization mgrOrganization = organizationService.getByOrganizationCode(organizationCode);
  64. return Response.ok(mgrOrganization);
  65. }
  66. }