package com.zcloud.controller.app; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.entity.system.Department; import com.zcloud.entity.system.Dictionaries; import com.zcloud.entity.system.Role; import com.zcloud.service.bus.*; import com.zcloud.service.system.*; import com.zcloud.util.*; import net.sf.json.JSONArray; import org.apache.commons.collections.map.ListOrderedMap; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.crypto.hash.SimpleHash; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.*; /** * 说明:获取港股公司部门人员信息 * 作者:luoxiaobao * 官网:www.qdkjchina.com */ @Controller @RequestMapping("/app/regulatory/user") public class AppRegulatoryUsersController 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; } /** * 显示列表ztree * @return */ @RequestMapping(value="/departListTree") @ResponseBody public Object departListTree()throws Exception{ Map map = new HashMap(); String errInfo = "success"; JSONArray arr = JSONArray.fromObject(regulatoryUsersService.listAllDepartment("0")); String json = arr.toString(); json = json.replaceAll("DEPARTMENT_ID", "id").replaceAll("PARENT_ID", "pId").replaceAll("NAME", "name").replaceAll("subDepartment", "nodes").replaceAll("hasDepartment", "checked").replaceAll("treeurl", "url"); map.put("zTreeNodes", json); map.put("result", errInfo); return map; } }