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

📄 createcustomerhtml.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	public String SaleList(String cust_id) throws SaasApplicationException {

		String saleTemp = "";
		String initStr = "<div class=\"cp\"><div><a href={#sale:link#} target=_self>{#sale:pict#}</a></div>" + 
		 "<div><b>名称:<a href={#sale:link#}  target=_self>{#sale:title#}</a></b><br>价格:{#sale:sale_price#}<br/>有效日期:{#sale:end_date#}<br>地址: {#sale:addr#}</div></div>";
		SaleInfo sale = new SaleInfo();
		ArrayList saleList = sale.genSaleListByCust_ID(cust_id,12 );
		if (saleList != null && saleList.size() > 0) {
			for (int i = 0; i < saleList.size(); i++) {
				HashMap saleInfo = (HashMap) saleList.get(i);
				String sale_id = saleInfo.get("sale_id").toString();
				String title = "";
				String sale_price = "";
				String end_date = "";
				String sale_addr = "";
				if (saleInfo.get("title") != null) {
					title = saleInfo.get("title").toString();
				}
				if (saleInfo.get("sale_price") != null) {
					sale_price = saleInfo.get("sale_price").toString();
				}
				if (saleInfo.get("end_date") != null) {
					end_date = saleInfo.get("end_date").toString();
					if( end_date.length() > 10 )
					end_date = end_date.substring( 0, 10 );
				}
				if (saleInfo.get("sale_addr") != null) {
					sale_addr = saleInfo.get("sale_addr").toString();
				}
				String pict_path = new SaleInfo().searchfj(sale_id, "0");
				if (pict_path == null || pict_path == "") {
					pict_path = "/upload/default.gif";
				}
				saleTemp = saleTemp + initStr;
				saleTemp = StrReplace.replace(saleTemp, "{#sale:title#}", title);
				saleTemp = StrReplace.replace(saleTemp, "{#sale:sale_price#}", sale_price);
				saleTemp = StrReplace.replace(saleTemp, "{#sale:end_date#}", end_date);
				saleTemp = StrReplace.replace(saleTemp, "{#sale:addr#}", sale_addr);
				saleTemp = StrReplace.replace(saleTemp, "{#sale:link#}", "/zone_b2b/supply/saleInquiry.jsp?sale_id=" + sale_id);
				saleTemp = StrReplace.replace(saleTemp, "{#sale:pict#}", "<img src=" + pict_path + " border=0>");
			}
		}
		return saleTemp;
	}
	
	
	
	/*
	 * 生成企业资质荣誉
	 */
	public int createCustomerCredit(String rootpath) throws SaasApplicationException 
	{
		log.LOG_INFO("生成企业资质荣誉");
		int error = 0;
		config configFile = new config();
	  configFile.init();
	  String webtitle = configFile.getString("mysqlbase.webtitle");
		String str = "", cust_id = "";
		String filepath = rootpath + "/" + "enterprise/customer/";
		String temppath = filepath;
		String filename = "credit.htm";
		String templatePath = rootpath + "/" + "templates/enterprise/default/ym_credit.html";
		String[] tab = { "{#include:bottom#}", "{#cust:name#}", "{#cust:scope#}", "{#company_logo#}", "{#juristic#}", "{#mail#}", "{#telephone#}", "{#fax#}", "{#address#}", "{#postcode#}", "{#website#}", "{#linker#}", "{#product_list#}", "{#credit_list#}", "{#cust_id#}" ,"{#WebTitle#}"};
		str = FileIO.LoadFile(templatePath);
		
		Custinfo custInfo = new Custinfo();
		String tempStr = "";
		ArrayList custList = custInfo.getAllCust();
		try {
			if (custList != null && custList.size() > 0) {
				for (int i = 0; i < custList.size(); i++) {
					tempStr = str;
					HashMap info = (HashMap) custList.get(i);
					cust_id = info.get("cust_id").toString();
					String cust_name = "";
					String cust_scope = "";
					String email = "";
					String juristic = "";
					String group_contact_phone = "";
					String fax_nbr = "";
					String company_address = "";
					String post_code = "";
					String website = "";
					if (info.get("cust_name") != null) {
						cust_name = info.get("cust_name").toString();
					}
					if (info.get("juristic") != null) {
						juristic = info.get("juristic").toString();
					}
					if (info.get("scope") != null) {
						cust_scope = info.get("scope").toString();
					}
					if (info.get("email") != null) {
						email = info.get("email").toString();
					}
					if (info.get("group_contact_phone") != null) {
						group_contact_phone = info.get("group_contact_phone").toString();
					}
					if (info.get("fax_nbr") != null) {
						fax_nbr = info.get("fax_nbr").toString();
					}
					if (info.get("company_address") != null) {
						company_address = info.get("company_address").toString();
					}
					if (info.get("post_code") != null) {
						post_code = info.get("post_code").toString();
					}
					if (info.get("website") != null) {
						website = info.get("website").toString();
					}
					filepath = temppath + "/" + cust_id + "/";
					String LinkStrTemp = FriendlyLink(cust_id);
					String ProductStrTemp = ProductList(cust_id);
					String creditStrTemp = CreditList(cust_id);
					String file_path = new Custinfo().getCustAttachPath(cust_id, "0");
					if (file_path == null || file_path == "") {
						file_path = "/upload/default.gif";
					}
					tempStr = StrReplace.replace(tempStr, tab[0], FileString.f2s(rootpath + "/footer.jsp"));
					tempStr = StrReplace.replace(tempStr, tab[1], cust_name);
					tempStr = StrReplace.replace(tempStr, tab[2], cust_scope);
					tempStr = StrReplace.replace(tempStr, tab[3], file_path);
					tempStr = StrReplace.replace(tempStr, tab[4], juristic);
					tempStr = StrReplace.replace(tempStr, tab[5], email);
					tempStr = StrReplace.replace(tempStr, tab[6], group_contact_phone);
					tempStr = StrReplace.replace(tempStr, tab[7], fax_nbr);
					tempStr = StrReplace.replace(tempStr, tab[8], company_address);
					tempStr = StrReplace.replace(tempStr, tab[9], post_code);
					tempStr = StrReplace.replace(tempStr, tab[10], website);
					tempStr = StrReplace.replace(tempStr, tab[11], LinkStrTemp);
					tempStr = StrReplace.replace(tempStr, tab[12], ProductStrTemp);
					tempStr = StrReplace.replace(tempStr, tab[13], creditStrTemp);
					tempStr = StrReplace.replace(tempStr, tab[14], cust_id);
					tempStr = StrReplace.replace(tempStr, tab[15], webtitle);
					if (FileIO.ExistFloder(filepath)) {
						FileIO.SaveToFile(tempStr, filepath + filename);
					}
					else {
						FileIO.CreateFloder(filepath);
						FileIO.SaveToFile(tempStr, filepath + filename);
					}
				}
			}
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		log.LOG_INFO("生成企业资质荣誉结束");
		return error;
	}
	
	
	
	// ///////////////企业资质证书生成结束///////////////////////
	/*
	 * 替换资质证书方法
	 */
	public String CreditList(String cust_id) throws SaasApplicationException {

		String creditTemp = "";
		String initStr = "<div>\n" + "          <div>\n" + "            {#sale:pict#}\n" + "          </div>\n" + "          <div>\n" + "            <h5>\n" + "             {#sale:title#}\n" + "            </h5>\n" + "            {#sale:credit_type#}\n<br>" + "            {#sale:end_date#}\n<br>" + "            {#sale:desc#}\n" + "          </div>\n" + "        </div>";
		ParamethodMgr param = new ParamethodMgr();
		CreditInfo credit = new CreditInfo();
		ArrayList creditList = credit.genCustCredit(cust_id);
		if (creditList != null && creditList.size() > 0) {
			for (int i = 0; i < creditList.size(); i++) {
				HashMap creditInfo = (HashMap) creditList.get(i);
				String credit_id = creditInfo.get("credit_id").toString();
				String credit_title = "";
				String credit_type = "";
				String credit_end_date = "";
				String credit_desc = "";
				if (creditInfo.get("credit_title") != null) {
					credit_title = creditInfo.get("credit_title").toString();
				}
				if (creditInfo.get("credit_type") != null) {
					credit_type = creditInfo.get("credit_type").toString();
				}
				
				if (creditInfo.get("credit_end_date") != null) {
					credit_end_date = creditInfo.get("credit_end_date").toString();
					if (credit_end_date.length() > 10) {
						credit_end_date = credit_end_date.substring(0, 10);
					}
				}
				if (creditInfo.get("credit_desc") != null) {
					credit_desc = creditInfo.get("credit_desc").toString();
					credit_desc = credit_desc.replaceAll("<[^<>]+>", "");
				}
				if (credit_type != null) {
					credit_type = param.getParamNameByValue("7", credit_type);
				}
				String pict_path = new Custinfo().getCustAttachPath(credit_id, "0");
				if (pict_path == null || pict_path == "") {
					pict_path = "/upload/default.gif";
				}
				creditTemp = creditTemp + initStr;
				creditTemp = StrReplace.replace(creditTemp, "{#sale:title#}", "名称:" + credit_title);
				creditTemp = StrReplace.replace(creditTemp, "{#sale:credit_type#}", "类型:" + credit_type);
				creditTemp = StrReplace.replace(creditTemp, "{#sale:end_date#}", "有效日期:" + credit_end_date);
				creditTemp = StrReplace.replace(creditTemp, "{#sale:desc#}", "说明:" + credit_desc);
				creditTemp = StrReplace.replace(creditTemp, "{#sale:pict#}", "<img src=" + pict_path + " border=0>");
			}
		}
		return creditTemp;
	}
	
	
	
	/*
	 * 生成企业采购
	 */
	public int createCustomerStock(String rootpath) throws SaasApplicationException 
	{
		log.LOG_INFO("生成企业采购");
		int error = 0;
		config configFile = new config();
	  configFile.init();
	  String webtitle = configFile.getString("mysqlbase.webtitle");
		String str = "", cust_id = "";
		String filepath = rootpath + "/" + "enterprise/customer/";
		String temppath = filepath;
		String filename = "stock.htm";
		String templatePath = rootpath + "/" + "templates/enterprise/default/ym_stock.html";
		String[] tab = { "{#include:bottom#}", "{#cust:name#}", "{#cust:scope#}", "{#company_logo#}", "{#juristic#}", "{#mail#}", "{#telephone#}", "{#fax#}", "{#address#}", "{#postcode#}", "{#website#}", "{#linker#}", "{#product_list#}", "{#stock_list#}", "{#cust_id#}","{#WebTitle#}" };
		str = FileIO.LoadFile(templatePath);
		String tempStr = "";
		Custinfo custInfo = new Custinfo();
		ArrayList custList = custInfo.getAllCust();
		try {
			if (custList != null && custList.size() > 0) {
				for (int i = 0; i < custList.size(); i++) {
					tempStr = str;
					HashMap info = (HashMap) custList.get(i);
					cust_id = info.get("cust_id").toString();
					String cust_name = "";
					String cust_scope = "";
					String email = "";
					String juristic = "";
					String group_contact_phone = "";
					String fax_nbr = "";
					String company_address = "";
					String post_code = "";
					String website = "";
					if (info.get("cust_name") != null) {
						cust_name = info.get("cust_name").toString();
					}
					if (info.get("juristic") != null) {
						juristic = info.get("juristic").toString();
					}
					if (info.get("scope") != null) {
						cust_scope = info.get("scope").toString();
					}
					if (info.get("email") != null) {
						email = info.get("email").toString();
					}
					if (info.get("group_contact_phone") != null) {
						group_contact_phone = info.get("group_contact_phone").toString();
					}
					if (info.get("fax_nbr") != null) {
						fax_nbr = info.get("fax_nbr").toString();
					}
					if (info.get("company_address") != null) {
						company_address = info.get("company_address").toString();
					}
					if (info.get("post_code") != null) {
						post_code = info.get("post_code").toString();
					}
					if (info.get("website") != null) {
						website = info.get("website").toString();
					}
					filepath = temppath + "/" + cust_id + "/";
					String LinkStrTemp = FriendlyLink(cust_id);
					String ProductStrTemp = ProductList(cust_id);
					String stockStrTemp = StockList(cust_id);
					String file_path = new Custinfo().getCustAttachPath(cust_id, "0");
					if (file_path == null || file_path == "") {
						file_path = "/upload/default.gif";
					}
					tempStr = StrReplace.replace(tempStr, tab[0], FileString.f2s(rootpath + "/footer.jsp"));
					tempStr = StrReplace.replace(tempStr, tab[1], cust_name);
					tempStr = StrReplace.replace(tempStr, tab[2], cust_scope);
					tempStr = StrReplace.replace(tempStr, tab[3], file_path);
					tempStr = StrReplace.replace(tempStr, tab[4], juristic);
					tempStr = StrReplace.replace(tempStr, tab[5], email);
					tempStr = StrReplace.replace(tempStr, tab[6], group_contact_phone);
					tempStr = StrReplace.replace(tempStr, tab[7], fax_nbr);
					tempStr = StrReplace.replace(tempStr, tab[8], company_address);
					tempStr = StrReplace.replace(tempStr, tab[9], post_code);
					tempStr = StrReplace.replace(tempStr, tab[10], website);
					tempStr = StrReplace.replace(tempStr, tab[11], LinkStrTemp);
					tempStr = StrReplace.replace(tempStr, tab[12], ProductStrTemp);
					tempStr = StrReplace.replace(tempStr, tab[13], stockStrTemp);
					tempStr = StrReplace.replace(tempStr, tab[14], cust_id);
					tempStr = StrReplace.replace(tempStr, tab[15], webtitle);
					if (FileIO.ExistFloder(filepath)) {
						FileIO.SaveToFile(tempStr, filepath + filename);
					}
					else {
						FileIO.CreateFloder(filepath);
						FileIO.SaveToFile(tempStr, filepath + filename);
					}
				}
			}
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		log.LOG_INFO("生成企业采购结束");
		return error;
	}
	
	
	
	// ///////////////企业求购生成结束///////////////////////
	
	
	/*
	 * 替换求购
	 */

⌨️ 快捷键说明

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