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

📄 createsupplyinfohtml.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		str = StrReplace.replace(str, "{#calalog-sale#}", select);
		FileIO.SaveToFile(str, filepath);
		return 0;
	}
	
	
	
	// 专区信息
	public String getClassInfoByType() throws SaasApplicationException {

		Productclass product = new Productclass();
		String select = product.getSelectedByComm("5", "1");
		return select;
	}
	
	
	
	// 替换省份信息
	
	public String getProvinceInfo() throws SaasApplicationException {

		String province = "";
		AreaInfo area = new AreaInfo();
		province = area.getCountrySelect("5J2mc0X0G85BH");
		return province;
	}
	
	
	public String getHtmlTemplateStr(String up_id, String type, String linkUrl) throws SaasApplicationException {

		String html = "";
		ArrayList sourceList = getClassInfoByUpType(up_id, type);
		if (sourceList != null && sourceList.size() > 0) {
			for (int i = 0; i < 1; i++) {
				String temp = "", tt = "";
				HashMap map1 = (HashMap) sourceList.get(i);
				String idx1 = map1.get("class_id").toString();
				String name1 = map1.get("class_name").toString();
				
				HashMap map2 = (HashMap) sourceList.get(i + 1);
				String idx2 = map2.get("class_id").toString();
				String name2 = map2.get("class_name").toString();
				
				tt = replaceProduct(idx1, name1, idx2, name2, linkUrl, type);
				
				html = html + tt;
			}
		}
		
		return html;
	}
	
	
	public String replaceProduct(String idx1, String name1, String idx2, String name2, String linkUrl, String type) throws SaasApplicationException {

		String title = "<table width=\"96%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">  " + "<tr> " + "  <td height=\"30\"><img src=\"/zone_b2b/images/d_tb.gif\" width=\"5\" height=\"9\">	" + "       <a href=\"" + linkUrl + type + "&class_id=" + idx1 + "\"><strong>" + name1 + "</strong></a>  " + "  </td>  " + "</tr>  " + "<tr> " + "  <td class=\"xian\" height=\"1\"></td>     " + "</tr>  " + "<tr>  " + "  <td>   " + createHtmlTemplate(idx1, name1, linkUrl, type) + "  </td>  " + "</tr> " + "</table>    " + "<table width=\"96%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">  " + "<tr>  " + "  <td height=\"30\"><img src=\"/zone_b2b/images/d_tb.gif\" width=\"5\" height=\"9\"> " + "  	 <a href=\"" + linkUrl + type + "&class_id=" + idx2 + "\"><strong>" + name2 + "</strong></a> " + "  </td> " + "</tr>  " + "<tr>  " + "  <td class=\"xian\" height=\"1\"></td>  " + "</tr>  " + "<tr>  " + "  <td>  " + createHtmlTemplate(idx2, name2, linkUrl, type) + "  </td> " + "</tr> " + "</table>";
		
		return title;
	}
	
	
	public String createHtmlTemplate(String id, String name, String linkUrl, String type) throws SaasApplicationException {

		String classHtml = "";
		ArrayList secondList = getClassInfoByUpType(id, type);
		classHtml = classHtml + replaceTwo(secondList, linkUrl, type);
		
		return classHtml;
	}
	
	
	public String replaceTwo(ArrayList secondList, String linkUrl, String type) throws SaasApplicationException {

		String title = "";
		for (int i = 0; i < 12; i++) {
			HashMap map = (HashMap) secondList.get(i);
			String id = map.get("class_id").toString();
			String name = "", allName = "";
			if (map.get("class_name") != null) {
				allName = map.get("class_name").toString();
				if (allName.length() > 3) {
					name = StringUtil.getLimitLengthString(allName, "", 8);
				}
				else {
					name = allName;
					for (int j = 0; j < 5 - allName.length(); j++) {
						name = name + "&nbsp";
					}
				}
			}
			title = title + "<a href=\"" + linkUrl + type + "&class_id=" + id + "\" title=\"" + allName + "\"class=\"news\">" + name + " |</a> ";
		}
		return title;
	}
	
	
	public ArrayList getClassInfoByUpType(String up_id, String type) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		ProductclassExt pe = new ProductclassExt();
		pe.setParam(":VCLASS_TYPE", type);
		pe.setParam(":VUP_CLASS_ID", up_id);
		list = pe.selByList("SEL_BY_PARENTID");
		return list;
	}
	
	// 生成供应信息
	public String getSaleHtmlInfo(ArrayList list, int iStart, String sale_, String s_size, String type, String function) throws SaasApplicationException {

		int size = 0;
		String defaultImg = "/zone_b2b/images/cp.gif";
		String resource = "";
		String start = "<table  width=100% border=0 cellpadding=0 cellspacing=0 id=tbo0 align=top>" + "<tr>" + "	<td>" + "		<table width=100% border=0 cellpadding=0 cellspacing=1 bgcolor=FFC367>" + "			<tr>" + "				<td height=255 valign=top bgcolor=FFFFFF>" + "					<table width=98% border=0 align=center cellpadding=0 cellspacing=0>" + "						<tr>" + "							<td width=23% height=30>" + "								<img src=/zone_b2b/images/jiantou.gif width=20 height=17>" + "								<input type=submit name=Submit2 value=对比产品 onclick=" + function + ">" + "							</td>" + "							<td width=37% class=STYLE2>" + "								供应信息/公司" + "							</td>" + "							<td width=11% class=STYLE2>" + "								价格(元)" + "							</td>" + "							<td width=13% class=STYLE2>" + "								所在地" + "							</td>" + "							<td width=16% class=STYLE2>" + "								留言/联系" + "							</td>" + "						</tr>" + "						<tr>" + "							<td height=1 class=xian></td>" + "							<td class=xian></td>" + "							<td class=xian></td>" + "							<td class=xian></td>" + "							<td class=xian></td>" + "						</tr>" + "					</table>" + "<table width=98% border=0 align=center cellpadding=0 cellspacing=0>";
		String source = "<tr>" + "<td width=4% height=30>" + "	<input type=checkbox name=" + sale_ + "{#id-1#} id=" + sale_ + "{#id-2#} value={#sale-id#}>" + "</td>" + "<td width=19% height=130>" + "	<img src={#image#} width=100 height=100 alt={#alt-title#} border=0" + "</td>" + "<td width=37%>" + "	<a href=saleInquiry.jsp?sale_id={#url-id#} target=_blank class=cpbt>{#sale-title#}</a> {#pub-date#}" + "	<br>" + "	{#desc#}" + "</td>" + "<td width=11%>" + "	{#price#}" + "</td>" + "<td width=13%>" + "	{#addr#}" + "</td>" + "<td width=16%>" + "	<a href=saleInquiry.jsp?sale_id={#url-id-enq#}><img src=/zone_b2b/images/zx.gif border=0 width=75 height=21 alt=点击询价></a>" + "	<img src=/zone_b2b/images/msn.gif width=16 height=16>	" + "</td>" + "</tr>";
		
		if (list != null && list.size() > 0) {
			size = list.size();
			for (int i = 0; i < list.size(); i++) {
				HashMap map = (HashMap) list.get(i);
				String sale_id = map.get("sale_id").toString();
				String title = "", pub_date = "", content = "", addr = "", price = "", date = "";
				if (map.get("title") != null) {
					title = map.get("title").toString();
				}
				if (map.get("sale_price") != null) {
					price = map.get("sale_price").toString();
				}
				if (map.get("sale_addr") != null) {
					addr = map.get("sale_addr").toString();
				}
				if (map.get("content") != null) {
					content = map.get("content").toString();
					content = content.replaceAll("<[^<>]+>", "");
					if (content.length() > 40) {
						content = content.substring(0, 40) + "...";
					}
				}
				if (map.get("publish_date") != null) {
					pub_date = map.get("publish_date").toString();
					if (pub_date.length() > 10) {
						pub_date = pub_date.substring(0, 10);
					}
				}
				String file_path = "";
				if (map.get("file_path") != null) {
					file_path = map.get("file_path").toString();
					file_path = file_path.substring(23);
				}
				else {
					file_path = defaultImg;
				}
				resource = resource + StrReplace.replace(source, "{#id-1#}", i + "");
				resource = StrReplace.replace(resource, "{#id-2#}", i + "");
				resource = StrReplace.replace(resource, "{#sale-id#}", sale_id);
				resource = StrReplace.replace(resource, "{#image#}", file_path);
				resource = StrReplace.replace(resource, "{#url-id#}", sale_id);
				resource = StrReplace.replace(resource, "{#url-id-enq#}", sale_id);
				resource = StrReplace.replace(resource, "{#desc#}", content);
				resource = StrReplace.replace(resource, "{#sale-title#}", title);
				resource = StrReplace.replace(resource, "{#pub-date#}", date);
				resource = StrReplace.replace(resource, "{#price#}", price);
				resource = StrReplace.replace(resource, "{#addr#}", addr);
				resource = StrReplace.replace(resource, "{#alt-title#}", title);
			}
		}
		else {
			resource = resource + StrReplace.replace(source, "{#id-1#}", "");
			resource = StrReplace.replace(resource, "{#id-2#}", "");
			resource = StrReplace.replace(resource, "{#sale-id#}", "");
			resource = StrReplace.replace(resource, "{#image#}", defaultImg);
			resource = StrReplace.replace(resource, "{#url-id#}", "");
			resource = StrReplace.replace(resource, "{#url-id-enq#}", "");
			resource = StrReplace.replace(resource, "{#desc#}", "");
			resource = StrReplace.replace(resource, "{#sale-title#}", "");
			resource = StrReplace.replace(resource, "{#pub-date#}", "");
			resource = StrReplace.replace(resource, "{#price#}", "");
			resource = StrReplace.replace(resource, "{#addr#}", "");
			resource = StrReplace.replace(resource, "{#alt-title#}", "未知");
		}
		
		String end = "</table>" + "</td>" + "</tr>" + "</table>" + "<table width=100% border=0 cellpadding=0 cellspacing=0>" + "<tr>" + "	<td height=10>" + "	<input type=hidden name=" + s_size + " id=" + s_size + " value=" + size + ">" + "	</td>" + "</tr>" + "</table>" + "<table width=100% border=0 cellpadding=1 cellspacing=1 bgcolor=E3E3E3>" + "	<tr style=font-weight:bold;>" + "		<td height=32 align=center background=/zone_b2b/images/btt1.gif>" + "			<a href=/zone_b2b/supply/index.html?s=" + type + ">1</a> <a href=/zone_b2b/supply/index2.html?s=" + type + ">[2]</a> <a href=/zone_b2b/supply/index3.html?s=" + type + ">[3]</a> <a href=/zone_b2b/supply/index4.html?s=" + type + ">[4]</a> <a href=/zone_b2b/supply/index5.html?s=" + type + ">[5]</a> <a href=/zone_b2b/supply/index6.html?s=" + type + ">[6]</a> <a href=/zone_b2b/supply/index7.html?s=" + type + ">[7]</a> <a href=/zone_b2b/supply/index8.html?s=" + type + ">[8]</a> <a href=/zone_b2b/supply/index9.html?s=" + type + ">[9]</a> <a href=/zone_b2b/supply/supply_List.jsp?s=" + type + ">全部</a>" + "			</td>" + "		</tr>" + "	</table>" + "	<table width=100% border=0 cellpadding=0 cellspacing=0>" + "		<tr>" + "			<td height=10></td>" + "		</tr>" + "	</table>" + "</td>" + "</tr>" + "</table>";
		return start + resource + end;
	}
}

⌨️ 快捷键说明

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