package com.zcloud.controller.bus; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.PageData; import com.zcloud.service.system.RegulatoryUsersService; import net.sf.json.JSONArray; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 说明:获取港股公司部门人员信息 * 作者:luoxiaobao * 官网:www.qdkjchina.com */ @Controller @RequestMapping("/regulatory/user") public class RegulatoryUsersController extends BaseController { @Autowired private RegulatoryUsersService regulatoryUsersService; /** * 显示列表ztree * @return */ @RequestMapping(value="/deptListTree") @ResponseBody public Object listTree()throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); PageData dept=regulatoryUsersService.getDeptByShares(pd).get(0);; PageData depar = new PageData(); depar.put("DEPARTMENT_ID",dept.get("DEPARTMENT_ID")); depar.put("PARENT_ID",dept.get("PARENT_ID")); depar.put("NAME",dept.get("NAME")); depar.put("subDepartment",regulatoryUsersService.listAllDepartment(depar.get("DEPARTMENT_ID").toString())); // depar.setDEPARTMENT_ID(dept.getDEPARTMENT_ID()); // depar.setPARENT_ID(dept.getPARENT_ID()); // depar.setNAME(dept.getNAME()); // depar.setSubDepartment(regulatoryUsersService.listAllDepartment(depar.getDEPARTMENT_ID())); List zdepartmentPdList = new ArrayList(); zdepartmentPdList.add(depar); // zdepartmentPdList.addAll(departmentService.listAllDepartment(ZDEPARTMENT_ID)); JSONArray arr = JSONArray.fromObject(zdepartmentPdList); String json = arr.toString(); json = json.replaceAll("DEPARTMENT_ID", "id").replaceAll("NAME", "name").replaceAll("subDepartment", "children"); map.put("zTreeNodes", json); map.put("result", errInfo); return map; } /**列表 * @param page * @throws Exception */ @RequestMapping(value="/listUser") @ResponseBody public Object listAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); List userList = regulatoryUsersService.listAllUser(pd); //列出Post列表 map.put("userList", userList); map.put("result", errInfo); return map; } }