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

📄 postinfo.java

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

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

import com.saas.biz.dao.postDAO.PostDAO;
import com.saas.biz.dao.postDAO.PostExt;
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 PostInfo{
	Dbtable tradeQuery;

	Logger log;

	Buffers inBuffer;

	Buffers outBuffer;

	ArrayList queryResult = new ArrayList();

	public PostInfo() {
		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 addPostInfo(Buffers inbuffer) {
		log.LOG_INFO("进入addPostInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String dq = inbuffer.getString("DQ");
		String dm = inbuffer.getString("DM");
		String yb = inbuffer.getString("YB");
		String qh = inbuffer.getString("QH");
		try {
			PostDAO postDao = new PostDAO(dq, dm, yb, qh);
			iResult = addPostInfo(postDao);
		}
		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("退出addPostInfo方法...");
	}

	public int addPostInfo(PostDAO postDao) throws SaasApplicationException {
		PostExt postExt = new PostExt();
		postExt.setParam(":VDQ", postDao.getDq());
		postExt.setParam(":VDM", postDao.getDm());
		postExt.setParam(":VYB", postDao.getYb());
		postExt.setParam(":VQH", postDao.getQh());
		tradeQuery.executeBy(postExt.insBy("INS_BY_ALL"));
		return 0;
	}

	public String getPostInfoByQuery(String keys) throws SaasApplicationException {
		String Html = "";
		String keyword = "%" + keys + "%";
		ArrayList list = new ArrayList();
		PostExt postExt = new PostExt();
		postExt.setParam(":VDQ", keyword);
		postExt.setParam(":VDM", keyword);
		postExt.setParam(":VYB", keyword);
		postExt.setParam(":VQH", keyword);
		list = postExt.selByList("SEL_BY_KEYS");
		Html = createHtmlCode(list);
		return Html;
	}

	public String getPostInfoByArea(String area) throws SaasApplicationException {
		String Html = "";
		ArrayList list = new ArrayList();
		PostExt postExt = new PostExt();
		postExt.setParam(":VDQ", area);
		postExt.setParam(":VDM", area);
		list = postExt.selByList("SEL_BY_AREA");
		Html = createHtmlCode(list);
		return Html;
	}

	// 生成HTML代码
	public String createHtmlCode(ArrayList list) throws SaasApplicationException {
		String html_Code = "<table width=710 border=1 cellspacing=0 cellpadding=0>";
		String html_rows = "";
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				HashMap map = (HashMap) list.get(i);
				String dq = map.get("dq").toString();
				String dm = map.get("dm").toString();
				String yb = map.get("yb").toString();
				String qh = map.get("qh").toString();
				html_rows = html_rows + "<tr>" + "<td width=27% align=center><div style=text-align:center; margin-left:10px; font-weight:100;>" + dq + "</div></td>" + "<td width=26% align=center><div style=text-align:center; margin-left:10px; font-weight:100;>" + dm + "</div></td>" + "<td width=26% align=center><div style=text-align:center; margin-left:10px; font-weight:100;>" + yb + "</div></td>" + "<td width=21% align=center><div style=text-align:center; margin-left:10px; font-weight:100;>" + qh
						+ "</div></td></tr>";
			}
			html_Code = html_Code + html_rows + "</table>";
		}
		else {
			html_Code = html_Code + "<tr><td colspan=4><div style=text-align:center; margin-left:10px; font-weight:100;>对不起!未找到你想要的信息!" + "</div></td></tr></table>";
		}
		return html_Code;
	}
}

⌨️ 快捷键说明

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