⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addressgroupmanager.java

📁 负责公文的传输及一些处理功能
💻 JAVA
字号:
package com.example.gw.addressgroup;

import com.example.businessmodel.Page;
import com.example.exception.LogicException;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import com.example.gw.unit.Unit;
import com.example.gw.unit.IUnitManager;
import com.example.util.StringUtils;
public class AddressGroupManager implements IAddressGroupManager{
	private IAddressGroupDao groupDao;
	private IUnitManager unitManager;
	public void setGroupDao(IAddressGroupDao groupDao){
		this.groupDao = groupDao;
	}
	public IAddressGroupDao getGroupDao(){
		return groupDao;
	}
	public void setUnitManager(IUnitManager unitManager){
		this.unitManager = unitManager;
	}
	public IUnitManager getUnitManager(){
		return unitManager;
	}
    public Page getGroupList(String unitId,int start,int rowNum)throws Exception{
    	String where = " from AddressGroup where unitId="+unitId;
    	return groupDao.loadPage(where,start,rowNum);
    }
    public List getGroupList(String unitId){
    	String where = " from AddressGroup where unitId="+unitId;
    	return groupDao.find(where);
    }
    public AddressGroup getGroup(String groupId){
    	return (AddressGroup)groupDao.findById(AddressGroup.class,new Integer(groupId));
    }
    public void saveGroup(AddressGroup group)throws Exception{
    	String where = " from AddressGroup where groupName ='" + group.getGroupName() + "' and unitId = " + group.getUnit().getUnitId() + " and groupId <> " + group.getGroupId() + "";
    	if(groupDao.find(where).size()>0){
    		throw new LogicException("本单位已经存在" + group.getGroupName() + "这个群组");
    	}
    	groupDao.save(group);
    }
    public void deleteGroup(String groupId){
    	AddressGroup group = (AddressGroup)groupDao.findById(AddressGroup.class,new Integer(groupId));
    	groupDao.delete(group);
    }
    public List viewGroup(AddressGroup group){
    	String unitIdStr = group.getContent();
    	String[] printNum = StringUtils.split(group.getPrintNum(),",");
    	List unitList = unitManager.getUnitList(unitIdStr);
    	Iterator iter = unitList.iterator();
    	List retList = new ArrayList();
    	for(int i=0;i<printNum.length;i++){
            List list = new ArrayList();
            list.add(i+1+"");
            list.add(((Unit)unitList.get(i)).getUnitName());
            list.add(printNum[i]);
    		retList.add(list);
    	}
    	return retList;
    }
    
    public List getGroupUnitList(String groupId){
    	AddressGroup group = (AddressGroup)groupDao.findById(AddressGroup.class,new Integer(groupId));
    	String content = group.getContent();
    	return unitManager.getUnitList(content);
    }

    public String getGroupUnitListXml(String groupId)throws Exception{
    	AddressGroup group = (AddressGroup)groupDao.findById(AddressGroup.class,new Integer(groupId));
    	String content = group.getContent();
    	String printNum = group.getPrintNum();
    	String ret = unitManager.getUnitListXml(content).substring(0,unitManager.getUnitListXml(content).length()-7)+"<printNum>"+printNum+"</printNum></root>";
    	return ret ;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -