/** * */ package com.sinosoft.am.org.dept.outdept.busi; import java.util.ArrayList; import com.persistence.service.PersistenceFactory; import com.persistence.service.SysPersistence; import com.persistence.service.exception.PersistenceException; import com.sinosoft.am.org.dept.outdept.dao.OrgOutDeptDao; import com.sinosoft.am.org.dept.outdept.vo.OrgOutDeptStatistics; import com.sinosoft.am.org.dept.outdept.vo.OrgOutDeptVo; import com.sysmodel.datamodel.xmlmodel.ModelFactory; import com.sysmodel.datamodel.xmlmodel.able.SysModel; import org.apache.log4j.Logger; /** * @author 蒋云涛 * */ public class OrgOutDeptBean { private Logger log = Logger.getLogger(OrgOutDeptBean.class); private OrgOutDeptDao dao = new OrgOutDeptDao(); public ArrayList getOrgOutDeptList(String parentId){ return dao.getOrgOutDeptList(parentId); } public boolean deleteOrgOutDept(String deptId){ return dao.deleteOrgOutDept(deptId); } public boolean editOrgOutDeptName(String deptId,String deptName){ return dao.editOrgOutDeptName(deptId, deptName); } public boolean addOrgOutDept(String deptId,String parentId,String deptName){ return dao.addOrgOutDept(deptId, parentId, deptName); } public boolean updateOrgOutDeptName(String deptId, String deptName){ return dao.updateOrgOutDeptName(deptId, deptName); } public boolean shamDeleteOrgOutDept(String deptId){ return dao.shamDeleteOrgOutDept(deptId); } /** 统计外部机构信息 根据传来的id 判断该id下的机构的人员信息 * 1.先找到传来id下的所有机构信息 compids * 2.判断每一个id下的人员数量 * * @param deptId * @return */ public String getOutStatistics(String deptId) { StringBuffer json = new StringBuffer(); //非空校验 if(deptId==null||""==deptId){ return json.toString(); } ArrayList compIds = new ArrayList(); OrgOutDeptDao oodd = new OrgOutDeptDao(); ArrayList oodv = oodd.getOrgOutDeptList(deptId); for(int i = 0;i -1) { json.deleteCharAt(json.lastIndexOf(",")); } json.append("]}"); return json.toString(); } /** * @param string * @return */ private String getOutOrgNumById(String compId) { SysModel sysmodel = ModelFactory.getSysmodel(); SysPersistence persistence = PersistenceFactory.getInstance(sysmodel); StringBuffer json = new StringBuffer(); StringBuffer sql = new StringBuffer(); if("".equals(compId)||compId==null){ return json.toString(); }; sql.append("-- 统计给定id的机构信息 \n"); sql.append(" SELECT b.ORG_DEPT_NAME AS 部门名称 ,SUM(DECODE(a.ORG_TYPE,'1',1,0)) AS 政府机关, SUM(DECODE(a.ORG_TYPE,'2',1,0)) AS 教育, SUM(DECODE(a.ORG_TYPE,'4',1,0)) AS 卫生, SUM(DECODE(a.ORG_TYPE,'3',1,0)) AS 公安, SUM(DECODE(a.ORG_TYPE,'5',1,0)) AS 消防, \n"); sql.append(" SUM(DECODE(a.ORG_TYPE,'6',1,0)) AS 三防, SUM(DECODE(a.ORG_TYPE,'7',1,0)) AS 厂家, SUM(DECODE(a.ORG_TYPE,'8',1,0)) AS 重要用户, SUM(DECODE(a.ORG_TYPE,'9',1,0)) AS 其他 ,SUM(1) AS 总计 FROM EMC_AM_ORG_OUTLINK a,EMC_AM_OUT_DEPARTMENT b \n"); sql.append(" WHERE a.ORG_DEPT_ID = b.FD_OBJECTID AND a.ORG_DEPT_ID IN \n "); sql.append("( SELECT c.FD_OBJECTID FROM EMC_AM_OUT_DEPARTMENT c WHERE c.PARENT_ID='"+compId+"' AND c.IS_DEL='0') AND a.IS_DEL='0' \n"); sql.append(" GROUP BY b.ORG_DEPT_NAME \n"); log.info("sql=========="+sql); ArrayList list; try { list = persistence.getSearchResult(99, sql.toString()); for(int i = 0 ;i -1) { json.deleteCharAt(json.lastIndexOf(",")); }*/ } catch (PersistenceException e) { e.printStackTrace(); } return json.toString(); } }