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

📄 newsinfo.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.saas.biz.newsMgr;

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

import com.saas.biz.attachMgr.Attachinfo;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.newsDAO.NewsDAO;
import com.saas.biz.dao.newsDAO.NewsExt;
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 NewsInfo {

	Dbtable tradeQuery;

	Logger log;

	Buffers inBuffer;

	Buffers outBuffer;

	ArrayList queryResult = new ArrayList();

	public NewsInfo() {

		log = new Logger(this);
		tradeQuery = new Dbtable();
	}

	public void setTradeQuery(Dbtable tradeQuery) {

		this.tradeQuery = tradeQuery;
	}

	public Dbtable getTradeQuery() {

		return this.tradeQuery;
	}

	public void setOutBuffer(Buffers outBuffer) {

		this.outBuffer = outBuffer;
	}

	public Buffers getOutBuffer() {

		return this.outBuffer;
	}

	public ArrayList getQueryResult() {

		return this.queryResult;
	}

	public void setQueryResult(ArrayList queryResult) {

		this.queryResult = queryResult;
	}

	public void genNews(Buffers inbuffer) {

		log.LOG_INFO("进入genStockorder方法...");
		try {
			this.queryResult = genNews();
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());

		}
		log.LOG_INFO("退出genStockorder方法...");
	}

	public ArrayList genNews() throws SaasApplicationException {

		ArrayList NewsList = new ArrayList();
		NewsExt newsExt = new NewsExt();
		NewsList = newsExt.selByList("SEL_BY_ALL");
		if (NewsList == null)
			return null;
		return NewsList;
	}

	public ArrayList genNewsByToday(int num) throws SaasApplicationException {

		ArrayList NewsList = new ArrayList();
		NewsExt newsExt = new NewsExt();
		NewsList = newsExt.selByList("SEL_BY_TODAY", 0, num);
		if (NewsList == null)
			return null;
		return NewsList;
	}

		public ArrayList genNewsByLevel( int num ) throws SaasApplicationException {
		ArrayList NewsList = new ArrayList();
		NewsExt newsExt = new NewsExt();
		NewsList = newsExt.selByList("SEL_BY_LEVEL",0,num);
		if (NewsList == null)
			return null;
		return NewsList;
	}

	// 查找客户新闻 modify by sjp date :2007-06-05
	public void genSpecNews(Buffers inbuffer) {

		log.LOG_INFO("进入genSpecNews方法...");
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String query_param = inbuffer.getString("QUERY_PARAM");
		try {
			if (query_param.equals(""))
				this.queryResult = genSpecNews(cust_id);
			else
				this.queryResult = searchNews(query_param, cust_id, "0");
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		log.LOG_INFO("退出genSpecNews方法...");
	}

	public ArrayList genSpecNews(String cust_id)
			throws SaasApplicationException {

		ArrayList NewsList = new ArrayList();
		NewsExt newsExt = new NewsExt();
		newsExt.setParam(":VCUST_ID", cust_id);
		newsExt.setParam(":VVALIDITY", "0");
		NewsList = newsExt.selByList("SEL_SPEC_NEWS");
		return NewsList;
	}

	// modify 2007.11.8 by 刘阳
	public void addNewsInfo(Buffers inbuffer) {

		log.LOG_INFO("进入addNewsInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		NewsDAO newsDAO = new NewsDAO();
		newsDAO.setNews_id(inbuffer.getString("NEWS_ID"));
		newsDAO.setNews_type(inbuffer.getString("NEWS_TYPE"));
		newsDAO.setCust_id(inbuffer.getString("SESSION_CUST_ID"));
		newsDAO.setTitle(inbuffer.getString("TITLE"));
		newsDAO.setContent(inbuffer.getString("CONTENT"));
		newsDAO.setSubject_tag(inbuffer.getString("SUBJECT_TAG"));
		newsDAO.setPublish_user_id(inbuffer.getString("SESSION_USER_ID"));
		newsDAO.setAudit_user_id(inbuffer.getString("SESSION_USER_ID"));
		try {
			iResult = addNewsInfo(newsDAO);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		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("退出addNewsInfo方法...");
	}

	public int addNewsInfo(NewsDAO newsDAO) throws SaasApplicationException {

		NewsExt newExt = new NewsExt();
		commMethodMgr comm = new commMethodMgr();
		String newcon = newsDAO.getContent();
		newcon = comm.setTextYin(newcon);
		newExt.setParam(":VNEWS_ID", newsDAO.getNews_id());
		newExt.setParam(":VUP_NEW_ID", "");
		newExt.setParam(":VNEWS_TYPE", newsDAO.getNews_type());
		newExt.setParam(":VCUST_ID", newsDAO.getCust_id());
		newExt.setParam(":VTITLE", newsDAO.getTitle());
		newExt.setParam(":VCONTENT", newcon);
		newExt.setParam(":VATTACHMENT_TAG", "0");
		newExt.setParam(":VVALIDITY", "0");
		newExt.setParam(":VNEWS_CLASS", "0");
		newExt.setParam(":VSUBJECT_TAG", newsDAO.getSubject_tag());
		newExt.setParam(":VPUBLISH_USER_ID", newsDAO.getPublish_user_id());
		newExt.setParam(":VAUDIT_USER_ID", newsDAO.getAudit_user_id());
		newExt.setParam(":VREMARK", "");
		tradeQuery.executeBy(newExt.insBy("INS_BY_ALL"));
		this.outBuffer.setString("SPEC_ROOT_ID", newsDAO.getNews_id());
		return 0;
	}

	// 添加专题 add by sjp date:2007-06-10
	public void addNewsZtInfo(Buffers inbuffer) {

		log.LOG_INFO("进入addNewsInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		NewsDAO newsDAO = new NewsDAO();
		newsDAO.setNews_id(inbuffer.getString("NEWS_ID"));
		newsDAO.setCust_id(inbuffer.getString("SESSION_CUST_ID"));
		newsDAO.setTitle(inbuffer.getString("TITLE"));
		newsDAO.setContent(inbuffer.getString("CONTENT"));

		newsDAO.setPublish_user_id(inbuffer.getString("SESSION_USER_ID"));
		newsDAO.setAudit_user_id(inbuffer.getString("SESSION_USER_ID"));

		try {
			iResult = addNewsZtInfo(newsDAO);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		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("退出addNewsInfo方法...");
	}

	public int addNewsZtInfo(NewsDAO newsDAO) throws SaasApplicationException {

		NewsExt newExt = new NewsExt();

		newExt.setParam(":VNEWS_ID", newsDAO.getNews_id());
		newExt.setParam(":VUP_NEW_ID", "");
		newExt.setParam(":VNEWS_TYPE", "0");
		newExt.setParam(":VCUST_ID", newsDAO.getCust_id());
		newExt.setParam(":VTITLE", newsDAO.getTitle());
		newExt.setParam(":VCONTENT", newsDAO.getContent());
		newExt.setParam(":VATTACHMENT_TAG", "0");
		newExt.setParam(":VVALIDITY", "0");
		newExt.setParam(":VNEWS_CLASS", "0");
		newExt.setParam(":VSUBJECT_TAG", "1");
		newExt.setParam(":VPUBLISH_USER_ID", newsDAO.getPublish_user_id());
		newExt.setParam(":VAUDIT_USER_ID", newsDAO.getAudit_user_id());
		newExt.setParam(":VREMARK", "");
		tradeQuery.executeBy(newExt.insBy("INS_BY_ALL"));
		return 0;
	}

	// 显示专题新闻列表 add by sjp date:2007-06-10
	public void genZt(Buffers inbuffer) {

		log.LOG_INFO("进入genZt方法...");
		this.outBuffer = inbuffer;
		try {
			this.queryResult = genZt();
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());

		}
		log.LOG_INFO("退出genZt方法...");
	}

	public ArrayList genZt() throws SaasApplicationException {

		ArrayList newsList = new ArrayList();
		NewsExt newExt = new NewsExt();
		newExt.setParam(":VSUBJECT_TAG", "0");
		newExt.setParam(":VVALIDITY", "0"); // add by Liuy 2007-7-18
		newsList = newExt.selByList("SEL_BY_ZT");
		return newsList;
	}

	public void genZtList(Buffers inbuffer) {

		log.LOG_INFO("进入genZt方法...");
		this.outBuffer = inbuffer;
		try {
			this.queryResult = genZtList();
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());

		}
		log.LOG_INFO("退出genZt方法...");
	}

	public ArrayList genZtList() throws SaasApplicationException {

		ArrayList newsList = new ArrayList();
		NewsExt newExt = new NewsExt();
		newExt.setParam(":VSUBJECT_TAG", "1");
		newExt.setParam(":VVALIDITY", "0"); // add by Liuy 2007-7-18
		newsList = newExt.selByList("SEL_BY_ZT");
		return newsList;
	}

	// 专题绑订 add by sjp date:2007-06-10
	public void addZtsonnewsInfo(Buffers inbuffer) {

		log.LOG_INFO("进入addZtsonnewsInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String news_id = inbuffer.getString("NEWS_ID");
		String ztsonnews = inbuffer.getString("ZTSONNEWS");
		try {
			iResult = addZtsonnewsInfo(news_id, ztsonnews);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		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("退出addZtsonnewsInfo方法...");
	}

	public int addZtsonnewsInfo(String strNewsId, String ztsonnews)
			throws SaasApplicationException {

		NewsExt newExt = new NewsExt();
		newExt.setParam(":VUP_NEW_ID", strNewsId);
		newExt.setParam(":VNEWS_ID", ztsonnews);
		tradeQuery.executeBy(newExt.insBy("ADD_ZT_SON"));
		return 0;
	}

	// 查找单条新闻 add by sjp date :2007-06-05
	public void genOneNews(Buffers inbuffer) {

		log.LOG_INFO("进入genOneNews方法...");
		this.outBuffer = inbuffer;
		String news_id = inbuffer.getString("NEWS_ID");
		try {
			this.queryResult = genOneNews(news_id);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());

		}
		log.LOG_INFO("退出genOneNews方法...");
	}

	public ArrayList genOneNews(String news_id) throws SaasApplicationException {

⌨️ 快捷键说明

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