待办事务的提示信息

 

 

1、给出待办事务的提示信息

 

import nc.bs.framework.common.NCLocator;
import nc.bs.hawk.ExtendedBaseDAO;
import nc.itf.hxsale.IPendingAffair;
import nc.itf.uap.pf.IPFMessage;
import nc.itf.uap.rbac.IUserManageQuery;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDateTime;
import nc.vo.pub.msg.CommonMessageVO;
import nc.vo.pub.msg.UserNameObject;
import nc.vo.sm.UserVO;

/**
 * 此类用作手写代码写入代办事务、业务预警、公告的实现类
 * 
 * @author zhangyu
 * 
 */
public class PendingAffairImpl extends ExtendedBaseDAO implements
	IPendingAffair {

    public void insertCommonMsg(CommonMessageVO commonMsgVO)
	    throws BusinessException {
	IPFMessage pfs = (IPFMessage) NCLocator.getInstance().lookup(
		IPFMessage.class.getName());//
	pfs.insertCommonMsg(commonMsgVO);
    }

    public void insertCommonMsg(String content, String title,
	    UFDateTime sendDateTime, String user_pk, String billtypeName,
	    String billid) throws BusinessException {
	IPFMessage pfs = (IPFMessage) NCLocator.getInstance().lookup(
		IPFMessage.class.getName());
	CommonMessageVO commonMsgVO = createCommonMsg(content, title,
		sendDateTime, user_pk, billtypeName, billid);
	pfs.insertCommonMsg(commonMsgVO);
    }

    /**
     * 获得用户名或角色对象
     * 
     * @param pk_user
     * @return
     * @throws BusinessException
     */
    public UserNameObject getUserNameObject(String pk_user)
	    throws BusinessException {
	IUserManageQuery queryUser = NCLocator.getInstance().lookup(
		IUserManageQuery.class);
	UserVO user = queryUser
		.findNamesByPrimaryKeys(new String[] { pk_user })[0];
	// UserVO user = (UserVO) PIProxy.getIBaseService().queryBaseVOs(
	// UserVO.class,
	// " dr = 0 and cuserid ='" + data.getPk_check() + "'").get(0);
	// 用户名或角色对象
	UserNameObject obj = new UserNameObject(user.getUserName());
	obj.setPkcorp(user.getCorpId());
	obj.setAvaiable(true);
	obj.setRole(false);
	obj.setUserPK(user.getPrimaryKey());
	obj.setUserName(user.getUserName());
	obj.setUserCode(user.getUserCode());
	return obj;
    }

    /**
     * @param content
     * @param title
     * @param sendDateTime
     * @param user_pk
     * @param billtypeName
     *            cxb add 2010-10-20 添加单据类型
     * @return
     * @throws BusinessException
     */
    private CommonMessageVO createCommonMsg(String content, String title,
	    UFDateTime sendDateTime, String user_pk, String billtypeName,
	    String billid) throws BusinessException {
	CommonMessageVO commonMsgVO = new CommonMessageVO();
	UserNameObject userNameObject = getUserNameObject(user_pk);
	StringBuilder contentSb = new StringBuilder(" ");
	contentSb.append(userNameObject.getUserName()).append(content);
	commonMsgVO.setMessageContent(contentSb.toString());// 内容
	commonMsgVO.setTitle(title);// 标题
	commonMsgVO.setSendDataTime(sendDateTime);// 发送时间
	commonMsgVO.setReceiver(new UserNameObject[] { userNameObject });
	commonMsgVO.setSender(userNameObject.getUserName());
	commonMsgVO.setBilltype(billtypeName);
	commonMsgVO.setBillid(billid);
	// *************************************************//
	// PfRealMsgExecutor rfmsg = new PfRealMsgExecutor();
	// rfmsg.setContexct(context)
	return commonMsgVO;
    }

}

 

 

2、手动刷新待办事务信息

 

public static synchronized void doRefresh(String userId, String pk_corp)
	    throws Exception {
	HashMap<Integer, MessageFilter> mapFilter = new HashMap<Integer, MessageFilter>();
	MessagePanelOptions mpo = MessageRepository.getInstance()
		.getMsgPanelOptions();
	mapFilter.put(MessageVO.SPACE_IN_BULLETIN, mpo.getBulletinFilter());
	mapFilter.put(MessageVO.SPACE_IN_WORKLIST, mpo.getWorklistFilter());
	mapFilter.put(MessageVO.SPACE_IN_PREALERT, mpo.getInfoFilter());
	fetchNewMessagesWithFilter(mapFilter, userId, pk_corp);
    }

    private static synchronized MessageDateTimeVO fetchNewMessagesWithFilter(
	    HashMap<Integer, MessageFilter> mapFilter, String userId,
	    String pk_corp) throws Exception {
	// 1.查询所有最新的消息
	IplatFormEntry name = (IplatFormEntry) NCLocator.getInstance().lookup(
		IplatFormEntry.class.getName());

	MessageDateTimeVO mdt = name.getFilteredReceivedMsgs(userId, pk_corp,
		mapFilter);
	// 2.填充到消息库中
	if (mapFilter.containsKey(MessageVO.SPACE_IN_BULLETIN)) {
	    MessageRepository.getInstance().clearBulletinMsgs();
	    MessageRepository.getInstance().addBulletinMsgs(
		    mdt.getBulletinMsgs());
	}
	if (mapFilter.containsKey(MessageVO.SPACE_IN_WORKLIST)) {
	    MessageRepository.getInstance().clearWorkList();
	    MessageRepository.getInstance().addWorkItems(mdt.getWorkitems());
	}
	if (mapFilter.containsKey(MessageVO.SPACE_IN_PREALERT)) {
	    MessageRepository.getInstance().clearPaMsgs();
	    MessageRepository.getInstance().addPaMsgs(mdt.getPAMsgs());
	}

	MessageRepository.getInstance().handNofityOserver(null);

	// 3.通知待办条数的更新
	MessagePanelUtils.updateUncheckedCount();

	return mdt;
    }

 

 

 

 

你可能感兴趣的:(公告)