| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- package cn.com.goldenwater.dcproj.controller.system;
- import cn.com.goldenwater.core.web.BaseController;
- import cn.com.goldenwater.core.web.BaseResponse;
- import cn.com.goldenwater.dcproj.model.BisInspAll;
- import cn.com.goldenwater.dcproj.model.BisInspAllNode;
- import cn.com.goldenwater.dcproj.model.OrganizationAndBatchAndGroup;
- import cn.com.goldenwater.dcproj.service.BisInspAllService;
- import cn.com.goldenwater.dcproj.service.OlBisInspOrgService;
- import cn.com.goldenwater.dcproj.service.impl.system.OrganizationTreeImpl;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import javax.servlet.http.HttpServletRequest;
- import java.util.List;
- import java.util.Map;
- /**
- * @author wanghang
- * @date 2018-12-28
- */
- @Api(value = "机构组织管理(树形机构+计划+组)", tags = "机构组织管理(树形机构+计划+组)")
- @RestController
- @RequestMapping("/dc/organization/base")
- public class OrganizationTreeController extends BaseController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private OrganizationTreeImpl organizationTree;
- @Autowired
- private BisInspAllService bisInspAllService;
- @Autowired
- private OlBisInspOrgService olBisInspOrgService;
- /**
- * @param guid 机构id
- * @param userId 用户userid 非机构id
- * @param type 用户所属类型 //1是监督司2是各委3是批次4是督查组
- * @param code 对应机构id或者批次id或者督查组id
- * @return
- */
- @ApiOperation(value = "获取该用户对应的树形结构", notes = "参数字段说明:{\n\r" +
- " \"guid\":\"机构人员id\",\n\r" +
- " \"userId\":\"登录后反给前端的id\",\n\r" +
- " \"type\":\"树形节点的类型1是监督司2是各委3是批次4是组\",\n\r" +
- " \"code\":\"对应节点的code\",\n\r" +
- " };\n\r" +
- "返回结构说明:{\n\r" +
- " \"success\":\"是否成功(true为成功,false为失败)\",\n\r" +
- " \"code\":\"错误代码\",\n\r" +
- " \"message\":\"描述信息\",\n\r" +
- " \"throwable\":\"异常信息\",\n\r" +
- " \"data(数据信息)\":[\n\r" +
- " {\n\r" +
- " \"code\":\"对应节点的code\",\n\r" +
- " \"name\":\"节点的名称\",\n\r" +
- " \"type\":\"节点的类型同上述type\",\n\r" +
- " }\n\r" +
- " ]\n\r" +
- " }")
- @RequestMapping(value = "/getOrganizationTreeByGuidAndOthers", method = RequestMethod.GET)
- public BaseResponse<List<OrganizationAndBatchAndGroup>> getOrganizationTreeByGuidAndOthers(@RequestParam(value = "guid", required = false) String guid,
- @RequestParam(value = "userId", required = false) String userId,
- @RequestParam(value = "type", required = false) String type,
- @RequestParam(value = "code", required = false) String code) {
- List<OrganizationAndBatchAndGroup> list = organizationTree.getOrganizationTreeByGuidAndOthers(guid, userId, type, code);
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "新版获取用户对应的树", notes = "参数字段说明:{\n\r" +
- " \"guid\":\"机构人员id\",\n\r" +
- " \"userId\":\"登录后反给前端的id\",\n\r" +
- " \"type\":\"树形节点的类型1是监督司2是各委3是批次4是组\",\n\r" +
- " \"code\":\"对应节点的code\",\n\r" +
- " \"objType\":\"督查类型 1 2 3 4\",\n\r" +
- " };\n\r" +
- "返回结构说明:{\n\r" +
- " \"success\":\"是否成功(true为成功,false为失败)\",\n\r" +
- " \"code\":\"错误代码\",\n\r" +
- " \"message\":\"描述信息\",\n\r" +
- " \"throwable\":\"异常信息\",\n\r" +
- " \"data(数据信息)\":[\n\r" +
- " {\n\r" +
- " \"code\":\"对应节点的code\",\n\r" +
- " \"name\":\"节点的名称\",\n\r" +
- " \"type\":\"节点的类型同上述type\",\n\r" +
- " }\n\r" +
- " ]\n\r" +
- " }")
- @RequestMapping(value = "/getOrganizationTreeByParams", method = RequestMethod.GET)
- public BaseResponse<List<OrganizationAndBatchAndGroup>> getOrganizationTreeByParams(@RequestParam(value = "guid", required = false) String guid,
- @RequestParam(value = "userId", required = false) String userId,
- @RequestParam(value = "type", required = false) String type,
- @RequestParam(value = "code", required = false) String code,
- @RequestParam(value = "objType", required = false) String objType) {
- List<OrganizationAndBatchAndGroup> list = organizationTree.getOrganizationTreeByParams(guid, userId, type, code, objType);
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "根据用户名获取用户所有节点", notes = "tabType类型:0为全部,1为当前,2为历史数据")
- @RequestMapping(value = "/getAllNode", method = RequestMethod.GET)
- public BaseResponse<List<BisInspAll>> getAllNode(
- @RequestParam(value = "userId", required = false) String userId,@RequestParam(value = "leadDep", required = false) String leadDep,
- @RequestParam(value = "orgType", required = false) String orgType,
- @RequestParam(value = "curYear", required = false) String curYear,
- @RequestParam(value = "tabType", required = false, defaultValue = "0") String tabType,
- @ApiParam(name = "year", value = "年度", required = false) @RequestParam(value = "year", required = false) String year,
- @ApiParam(name = "yearTaskId", value = "年度Id", required = false) @RequestParam(value = "yearTaskId", required = false) String yearTaskId) {
- List<BisInspAll> list = organizationTree.getAllNode(userId, orgType, getCurrentOrgId(), tabType, year, yearTaskId,curYear,leadDep);
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "根据id获取对应节点", notes = "")
- @RequestMapping(value = "/getAllNodeById", method = RequestMethod.GET)
- public BaseResponse<List<BisInspAll>> getAllNodeById(
- @ApiParam("一个id串:001020006,001020001") @RequestParam(value = "id", required = false) String id) {
- List<BisInspAll> list = organizationTree.getAllNodeById(id);
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "根据督查类型查询组织机构及用户", notes = "")
- @RequestMapping(value = "/getUserByOrg", method = RequestMethod.GET)
- public BaseResponse<List<Map<String, Object>>> getUserInfoByOrg(@RequestParam(value = "orgType", required = false) String orgType) {
- List<Map<String, Object>> list = bisInspAllService.getUserByOrg(orgType, getCurrentOrgId());
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "根据父节点ID和行政区划查询流域树节点列表", notes = "参数字段说明:{\n\r" +
- " \"pid\":\"流域id\",\n\r" +
- " \"code\":\"行政区划编码(截取后)\",\n\r" +
- " \"type\":\"查询类型 水库1 人饮2 水毁3\",\n\r" +
- " };\n\r" +
- "返回结构说明:{\n\r" +
- " \"success\":\"是否成功(true为成功,false为失败)\",\n\r" +
- " \"code\":\"错误代码\",\n\r" +
- " \"message\":\"描述信息\",\n\r" +
- " \"throwable\":\"异常信息\",\n\r" +
- " \"data(数据信息)\":[\n\r" +
- " {\n\r" +
- " \"id\":\"流域id\",\n\r" +
- " \"pnm\":\"流域名称\",\n\r" +
- " \"code\":\"行政区划编码\",\n\r" +
- " \"nm\":\"行政区划名称\",\n\r" +
- " }\n\r" +
- " ]\n\r" +
- " }")
- @RequestMapping(value = "/getNodeByPidAndCode", method = {RequestMethod.GET, RequestMethod.POST})
- public BaseResponse<List<Map<String, Object>>> getNodeByPidAndCode(@RequestParam(value = "pid", required = false) String pid,
- @RequestParam(value = "code", required = false) String code,
- @RequestParam(value = "type", required = false) String type) {
- List<Map<String, Object>> list = bisInspAllService.getNodeByPidAndCode(pid, code, type, getCurrentOrgId());
- return buildSuccessResponse(list);
- }
- @ApiOperation(value = "根据用户名获取用户所有节点和督查对象", notes = "")
- @RequestMapping(value = "/getAllNodeAndObj", method = RequestMethod.GET)
- public BaseResponse<List<BisInspAllNode>> getAllNodeAndObj(HttpServletRequest request,
- @ApiParam(name = "objType", value = "督查类型", required = false) @RequestParam(value = "objType", required = false) String objType,
- @ApiParam(name = "level", value = "节点开始等级", required = false) @RequestParam(value = "level", required = false, defaultValue = "0") int level) {
- String persId = request.getHeader("persId");
- String province = olBisInspOrgService.getProvince(getCurrentOrgId());
- List<BisInspAllNode> list = organizationTree.getAllNodeAndObj(persId, objType, level, province);
- return buildSuccessResponse(list);
- }
- }
|