dbf6c8947d7fdb758adac66f8da20adc5af4b2b3.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. package cn.com.goldenwater.dcproj.controller.system;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.model.BisInspAll;
  5. import cn.com.goldenwater.dcproj.model.BisInspAllNode;
  6. import cn.com.goldenwater.dcproj.model.OrganizationAndBatchAndGroup;
  7. import cn.com.goldenwater.dcproj.service.BisInspAllService;
  8. import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
  9. import cn.com.goldenwater.dcproj.service.impl.system.OrganizationTreeImpl;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import io.swagger.annotations.ApiParam;
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RequestMethod;
  18. import org.springframework.web.bind.annotation.RequestParam;
  19. import org.springframework.web.bind.annotation.RestController;
  20. import javax.servlet.http.HttpServletRequest;
  21. import java.util.List;
  22. import java.util.Map;
  23. /**
  24. * @author wanghang
  25. * @date 2018-12-28
  26. */
  27. @Api(value = "机构组织管理(树形机构+计划+组)", tags = "机构组织管理(树形机构+计划+组)")
  28. @RestController
  29. @RequestMapping("/dc/organization/base")
  30. public class OrganizationTreeController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private OrganizationTreeImpl organizationTree;
  34. @Autowired
  35. private BisInspAllService bisInspAllService;
  36. @Autowired
  37. private OlBisInspOrgService olBisInspOrgService;
  38. /**
  39. * @param guid 机构id
  40. * @param userId 用户userid 非机构id
  41. * @param type 用户所属类型 //1是监督司2是各委3是批次4是督查组
  42. * @param code 对应机构id或者批次id或者督查组id
  43. * @return
  44. */
  45. @ApiOperation(value = "获取该用户对应的树形结构", notes = "参数字段说明:{\n\r" +
  46. " \"guid\":\"机构人员id\",\n\r" +
  47. " \"userId\":\"登录后反给前端的id\",\n\r" +
  48. " \"type\":\"树形节点的类型1是监督司2是各委3是批次4是组\",\n\r" +
  49. " \"code\":\"对应节点的code\",\n\r" +
  50. " };\n\r" +
  51. "返回结构说明:{\n\r" +
  52. " \"success\":\"是否成功(true为成功,false为失败)\",\n\r" +
  53. " \"code\":\"错误代码\",\n\r" +
  54. " \"message\":\"描述信息\",\n\r" +
  55. " \"throwable\":\"异常信息\",\n\r" +
  56. " \"data(数据信息)\":[\n\r" +
  57. " {\n\r" +
  58. " \"code\":\"对应节点的code\",\n\r" +
  59. " \"name\":\"节点的名称\",\n\r" +
  60. " \"type\":\"节点的类型同上述type\",\n\r" +
  61. " }\n\r" +
  62. " ]\n\r" +
  63. " }")
  64. @RequestMapping(value = "/getOrganizationTreeByGuidAndOthers", method = RequestMethod.GET)
  65. public BaseResponse<List<OrganizationAndBatchAndGroup>> getOrganizationTreeByGuidAndOthers(@RequestParam(value = "guid", required = false) String guid,
  66. @RequestParam(value = "userId", required = false) String userId,
  67. @RequestParam(value = "type", required = false) String type,
  68. @RequestParam(value = "code", required = false) String code) {
  69. List<OrganizationAndBatchAndGroup> list = organizationTree.getOrganizationTreeByGuidAndOthers(guid, userId, type, code);
  70. return buildSuccessResponse(list);
  71. }
  72. @ApiOperation(value = "新版获取用户对应的树", notes = "参数字段说明:{\n\r" +
  73. " \"guid\":\"机构人员id\",\n\r" +
  74. " \"userId\":\"登录后反给前端的id\",\n\r" +
  75. " \"type\":\"树形节点的类型1是监督司2是各委3是批次4是组\",\n\r" +
  76. " \"code\":\"对应节点的code\",\n\r" +
  77. " \"objType\":\"督查类型 1 2 3 4\",\n\r" +
  78. " };\n\r" +
  79. "返回结构说明:{\n\r" +
  80. " \"success\":\"是否成功(true为成功,false为失败)\",\n\r" +
  81. " \"code\":\"错误代码\",\n\r" +
  82. " \"message\":\"描述信息\",\n\r" +
  83. " \"throwable\":\"异常信息\",\n\r" +
  84. " \"data(数据信息)\":[\n\r" +
  85. " {\n\r" +
  86. " \"code\":\"对应节点的code\",\n\r" +
  87. " \"name\":\"节点的名称\",\n\r" +
  88. " \"type\":\"节点的类型同上述type\",\n\r" +
  89. " }\n\r" +
  90. " ]\n\r" +
  91. " }")
  92. @RequestMapping(value = "/getOrganizationTreeByParams", method = RequestMethod.GET)
  93. public BaseResponse<List<OrganizationAndBatchAndGroup>> getOrganizationTreeByParams(@RequestParam(value = "guid", required = false) String guid,
  94. @RequestParam(value = "userId", required = false) String userId,
  95. @RequestParam(value = "type", required = false) String type,
  96. @RequestParam(value = "code", required = false) String code,
  97. @RequestParam(value = "objType", required = false) String objType) {
  98. List<OrganizationAndBatchAndGroup> list = organizationTree.getOrganizationTreeByParams(guid, userId, type, code, objType);
  99. return buildSuccessResponse(list);
  100. }
  101. @ApiOperation(value = "根据用户名获取用户所有节点", notes = "tabType类型:0为全部,1为当前,2为历史数据")
  102. @RequestMapping(value = "/getAllNode", method = RequestMethod.GET)
  103. public BaseResponse<List<BisInspAll>> getAllNode(
  104. @RequestParam(value = "userId", required = false) String userId,@RequestParam(value = "leadDep", required = false) String leadDep,
  105. @RequestParam(value = "orgType", required = false) String orgType,
  106. @RequestParam(value = "curYear", required = false) String curYear,
  107. @RequestParam(value = "tabType", required = false, defaultValue = "0") String tabType,
  108. @ApiParam(name = "year", value = "年度", required = false) @RequestParam(value = "year", required = false) String year,
  109. @ApiParam(name = "yearTaskId", value = "年度Id", required = false) @RequestParam(value = "yearTaskId", required = false) String yearTaskId) {
  110. List<BisInspAll> list = organizationTree.getAllNode(userId, orgType, getCurrentOrgId(), tabType, year, yearTaskId,curYear,leadDep);
  111. return buildSuccessResponse(list);
  112. }
  113. @ApiOperation(value = "根据id获取对应节点", notes = "")
  114. @RequestMapping(value = "/getAllNodeById", method = RequestMethod.GET)
  115. public BaseResponse<List<BisInspAll>> getAllNodeById(
  116. @ApiParam("一个id串:001020006,001020001") @RequestParam(value = "id", required = false) String id) {
  117. List<BisInspAll> list = organizationTree.getAllNodeById(id);
  118. return buildSuccessResponse(list);
  119. }
  120. @ApiOperation(value = "根据督查类型查询组织机构及用户", notes = "")
  121. @RequestMapping(value = "/getUserByOrg", method = RequestMethod.GET)
  122. public BaseResponse<List<Map<String, Object>>> getUserInfoByOrg(@RequestParam(value = "orgType", required = false) String orgType) {
  123. List<Map<String, Object>> list = bisInspAllService.getUserByOrg(orgType, getCurrentOrgId());
  124. return buildSuccessResponse(list);
  125. }
  126. @ApiOperation(value = "根据父节点ID和行政区划查询流域树节点列表", notes = "参数字段说明:{\n\r" +
  127. " \"pid\":\"流域id\",\n\r" +
  128. " \"code\":\"行政区划编码(截取后)\",\n\r" +
  129. " \"type\":\"查询类型 水库1 人饮2 水毁3\",\n\r" +
  130. " };\n\r" +
  131. "返回结构说明:{\n\r" +
  132. " \"success\":\"是否成功(true为成功,false为失败)\",\n\r" +
  133. " \"code\":\"错误代码\",\n\r" +
  134. " \"message\":\"描述信息\",\n\r" +
  135. " \"throwable\":\"异常信息\",\n\r" +
  136. " \"data(数据信息)\":[\n\r" +
  137. " {\n\r" +
  138. " \"id\":\"流域id\",\n\r" +
  139. " \"pnm\":\"流域名称\",\n\r" +
  140. " \"code\":\"行政区划编码\",\n\r" +
  141. " \"nm\":\"行政区划名称\",\n\r" +
  142. " }\n\r" +
  143. " ]\n\r" +
  144. " }")
  145. @RequestMapping(value = "/getNodeByPidAndCode", method = {RequestMethod.GET, RequestMethod.POST})
  146. public BaseResponse<List<Map<String, Object>>> getNodeByPidAndCode(@RequestParam(value = "pid", required = false) String pid,
  147. @RequestParam(value = "code", required = false) String code,
  148. @RequestParam(value = "type", required = false) String type) {
  149. List<Map<String, Object>> list = bisInspAllService.getNodeByPidAndCode(pid, code, type, getCurrentOrgId());
  150. return buildSuccessResponse(list);
  151. }
  152. @ApiOperation(value = "根据用户名获取用户所有节点和督查对象", notes = "")
  153. @RequestMapping(value = "/getAllNodeAndObj", method = RequestMethod.GET)
  154. public BaseResponse<List<BisInspAllNode>> getAllNodeAndObj(HttpServletRequest request,
  155. @ApiParam(name = "objType", value = "督查类型", required = false) @RequestParam(value = "objType", required = false) String objType,
  156. @ApiParam(name = "level", value = "节点开始等级", required = false) @RequestParam(value = "level", required = false, defaultValue = "0") int level) {
  157. String persId = request.getHeader("persId");
  158. String province = olBisInspOrgService.getProvince(getCurrentOrgId());
  159. List<BisInspAllNode> list = organizationTree.getAllNodeAndObj(persId, objType, level, province);
  160. return buildSuccessResponse(list);
  161. }
  162. }