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

📄 notifyinfo.java

📁 java阿里巴巴代码
💻 JAVA
字号:
package com.saas.biz.notifyMgr;

import java.util.ArrayList;
import java.util.HashMap;

import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.notifyDAO.NotifyDAO;
import com.saas.biz.dao.notifyDAO.NotifyExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;

public class NotifyInfo{

	Logger log;

	Buffers inBuffer;

	Buffers outBuffer;

	Dbtable tradeQuery;

	commMethodMgr commen;

	ArrayList queryResult = new ArrayList();

	public NotifyInfo() {
		log = new Logger(this);
		tradeQuery = new Dbtable();
		commen = new commMethodMgr();
		outBuffer = new Buffers();
	}

	public void setOutBuffer(Buffers outBuffer) {
		this.outBuffer = outBuffer;
	}

	public Buffers getOutBuffer() {
		return this.outBuffer;
	}

	public void setTradeQuery(Dbtable tradeQuery) {
		this.tradeQuery = tradeQuery;
	}

	public Dbtable getTradeQuery() {
		return this.tradeQuery;
	}

	public ArrayList getQueryResult() {
		return this.queryResult;
	}

	public void setQueryResult(ArrayList queryResult) {
		this.queryResult = queryResult;
	}

	// 发布通知
	public void addNotifyInfo(Buffers inbuffer) {
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		log.LOG_INFO("进入addReportsDelivery方法...");
		int iResult = -1;
		String id = commen.GenTradeId();
		String title = inbuffer.getString("TITLE");
		String content = inbuffer.getString("CONTENT");
		String user = inbuffer.getString("SESSION_USER_NAME");
		String part = inbuffer.getString("DEPART_CODE");
		String path = inbuffer.getString("PATH");
		String xvisible = inbuffer.getString("SESSION_CUST_ID");
        
		NotifyDAO notiDao = new NotifyDAO();
		notiDao.setId(id);
		notiDao.setTitle(title);
		notiDao.setContent(content);
		notiDao.setUser(user);
		notiDao.setPart(part);
		notiDao.setXvisible(xvisible);
		notiDao.setPath(path);
		try {
			iResult = addNotifyInfo(notiDao);
		}
		catch (Exception e) {
			iResult = -1;
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出addReportsDelivery方法...");
	}

	public int addNotifyInfo(NotifyDAO notiDao) throws SaasApplicationException {
		NotifyExt notifyExt = new NotifyExt();
		notifyExt.setParam(":VID", notiDao.getId());
		notifyExt.setParam(":VTITLE", notiDao.getTitle());
		notifyExt.setParam(":VCONTENT", notiDao.getContent());
		notifyExt.setParam(":VPATH", notiDao.getPath());
		notifyExt.setParam(":VUSER", notiDao.getUser());
		notifyExt.setParam(":VPART", notiDao.getPart());
		notifyExt.setParam(":VCHECKED", "0");
		notifyExt.setParam(":VVALIDITY", notiDao.getXvisible());
		tradeQuery.executeBy(notifyExt.insBy("INS_BY_ALL"));
		return 0;
	}

	public void deleteNotifyInfo(Buffers inbuffer) {
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		log.LOG_INFO("进入addReportsDelivery方法...");
		int iResult = -1;
		String id = inbuffer.getString("ID");
		try {
			iResult = deleteNotifyInfo(id);
		}
		catch (Exception e) {
			iResult = -1;
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出addReportsDelivery方法...");
	}

	public int deleteNotifyInfo(String id) throws SaasApplicationException {
		NotifyExt notifyExt = new NotifyExt();
		notifyExt.setParam(":VID", id);
		tradeQuery.executeBy(notifyExt.insBy("DELETE_BY_ID"));
		return 0;
	}

	// 通过部门找上级发布的通过
	public ArrayList getNotifyByPart(int iStart, String part,String cust_id) throws SaasApplicationException {
		NotifyExt notifyExt = new NotifyExt();
		ArrayList notList = new ArrayList();
		try {
			iStart=iStart*20;
			notifyExt.setParam(":VPART", part);
			notifyExt.setParam(":VCHECKED", "0");
			notifyExt.setParam(":VXVISIBLE", cust_id);
			notList = notifyExt.selByList("SEL_BY_PART", iStart, 20);
			
		}
		catch (RuntimeException e) {
			log.LOG_INFO(e.getMessage());
		}
		return notList;
	}

	public int getNotifyByPartCT(String part,String cust_id) throws SaasApplicationException {
		NotifyExt notifyExt = new NotifyExt();
		int size = 0;
		ArrayList notList = new ArrayList();
		try {
			notifyExt.setParam(":VPART", part);
			notifyExt.setParam(":VCHECKED", "0");
			notifyExt.setParam(":VXVISIBLE", cust_id);
			notList = notifyExt.selByList("SEL_BY_PART_COUNT");
			if (notList != null && notList.size() > 0) {
				HashMap map = (HashMap) notList.get(0);
				if (map.get("ct") != null) {
					size = Integer.parseInt(map.get("ct").toString());
				}
			}
		}
		catch (RuntimeException e) {
			log.LOG_INFO(e.getMessage());
		}
		return size;
	}

	// 通过Id找出发布的通过
	public ArrayList getNotifyById(String id) throws SaasApplicationException {
		NotifyExt notifyExt = new NotifyExt();
		ArrayList notList = new ArrayList();
		notifyExt.setParam(":VID", id);
		notList = notifyExt.selByList("SEL_BY_ID");
		return notList;
	}

	// 通过Id找出发布的通过
	public String getNotifyContentById(String id) throws SaasApplicationException {
		String content = "";
		NotifyExt notifyExt = new NotifyExt();
		ArrayList notList = new ArrayList();
		notifyExt.setParam(":VID", id);
		notList = notifyExt.selByList("SEL_BY_ID");
		if (notList != null && notList.size() > 0) {
			HashMap map = (HashMap) notList.get(0);
			if (map.get("content") != null) {
				content = map.get("content").toString();
			}
		}
		return content;
	}
}

⌨️ 快捷键说明

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