?? createcustomerhtml.java
字號(hào):
public String StockList(String cust_id) throws SaasApplicationException {
String stockTemp = "";
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></a></b><br>{#sale:sale_price#}<br>{#sale:end_date#}<br>{#sale:addr#}</div></div>";
Stockorderinfo stock = new Stockorderinfo();
ArrayList stockList = stock.genCustStockorder(cust_id);
if (stockList != null && stockList.size() > 0) {
for (int i = 0; i < stockList.size() && i < 10; i++) {
HashMap stockInfo = (HashMap) stockList.get(i);
String stock_id = stockInfo.get("stock_id").toString();
String title = "";
String stock_addr = "";
String publish_date = "";
String end_date = "";
if (stockInfo.get("title") != null) {
title = stockInfo.get("title").toString();
}
if (stockInfo.get("stock_addr") != null) {
stock_addr = stockInfo.get("stock_addr").toString();
}
if (stockInfo.get("publish_date") != null) {
publish_date = stockInfo.get("publish_date").toString();
if (publish_date.length() > 10) {
publish_date = publish_date.substring(0, 10);
}
}
if (stockInfo.get("end_date") != null) {
end_date = stockInfo.get("end_date").toString();
if (end_date.length() > 10) {
end_date = end_date.substring(0, 10);
}
}
String pict_path = new Custinfo().getCustAttachPath(stock_id, "0");
if (pict_path == null || pict_path == "") {
pict_path = "/upload/default.gif";
}
stockTemp = stockTemp + initStr;
stockTemp = StrReplace.replace(stockTemp, "{#sale:title#}", "名稱:" + title);
stockTemp = StrReplace.replace(stockTemp, "{#sale:sale_price#}", "發(fā)布日期:" + publish_date);
stockTemp = StrReplace.replace(stockTemp, "{#sale:end_date#}", "有效日期:" + end_date);
stockTemp = StrReplace.replace(stockTemp, "{#sale:addr#}", "地址:" + stock_addr);
stockTemp = StrReplace.replace(stockTemp, "{#sale:link#}", "/zone_b2b/stock/stockInquiry.jsp?stock_id=" + stock_id);
stockTemp = StrReplace.replace(stockTemp, "{#sale:pict#}", "<img src=" + pict_path + " border=0>");
}
}
return stockTemp;
}
/*
* 生成企業(yè)動(dòng)態(tài)
*/
public int createCustomerNews(String rootpath) throws SaasApplicationException
{
log.LOG_INFO("生成企業(yè)動(dòng)態(tài)");
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 = "active.htm";
String templatePath = rootpath + "/" + "templates/enterprise/default/ym_active.html";
String[] tab = { "{#include:bottom#}", "{#cust:name#}", "{#cust:scope#}", "{#company_logo#}", "{#juristic#}", "{#mail#}", "{#telephone#}", "{#fax#}", "{#address#}", "{#postcode#}", "{#website#}", "{#linker#}", "{#product_list#}", "{#active_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 NewsStrTemp = NewsList(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], NewsStrTemp);
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("企業(yè)動(dòng)態(tài)生成結(jié)束");
return error;
}
// ///////////////企業(yè)動(dòng)態(tài)生成結(jié)束///////////////////////
/*
* 替換企業(yè)動(dòng)態(tài)方法
*/
public String NewsList(String cust_id) throws SaasApplicationException {
String newsTemp = "";
String initStr = "<div>\n" + " <div>\n" + " <h5>\n" + " <a href={#news:link#} target=_self>{#news:title#}</a>\n" + " </a>\n" + " </h5>\n" + " {#news:desc#}\n" + " {#news:pub_date#}\n" + " </div>\n" + " </div>";
NewsInfo news = new NewsInfo();
ArrayList newsList = news.genSpecNews(cust_id);
if (newsList != null && newsList.size() > 0) {
for (int i = 0; i < newsList.size() && i < 10; i++) {
HashMap newsInfo = (HashMap) newsList.get(i);
String news_id = newsInfo.get("news_id").toString();
String title = "";
String content = "";
String publish_date = "";
if (newsInfo.get("title") != null) {
title = newsInfo.get("title").toString();
}
if (newsInfo.get("content") != null) {
content = newsInfo.get("content").toString();
content = content.replaceAll("<[^<>]+>", "");
if (content.length() > 50) {
content = content.substring(0, 50);
}
}
if (newsInfo.get("publish_date") != null) {
publish_date = newsInfo.get("publish_date").toString();
if (publish_date.length() > 10) {
publish_date = publish_date.substring(0, 10);
}
}
newsTemp = newsTemp + initStr;
newsTemp = StrReplace.replace(newsTemp, "{#news:title#}", "標(biāo)題:" + title);
newsTemp = StrReplace.replace(newsTemp, "{#news:link#}}", "/zone_b2b/news/zixun_list_content.jsp?news_id=" + news_id);
newsTemp = StrReplace.replace(newsTemp, " {#news:desc#}", " " + content + "...");
newsTemp = StrReplace.replace(newsTemp, "{#news:pub_date#}", "[" + publish_date + "]");
}
}
return newsTemp;
}
/*
* 生成企業(yè)招標(biāo)
*/
public int createCustomerBidding(String rootpath) throws SaasApplicationException {
log.LOG_INFO("生成企業(yè)招標(biāo)");
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 = "bidding.htm";
String listStr = "";
String templatePath = rootpath + "/" + "templates/enterprise/default/ym_bidding.html";
String[] tab = { "{#include:bottom#}", "{#cust:name#}", "{#cust:scope#}", "{#company_logo#}", "{#juristic#}", "{#mail#}", "{#telephone#}", "{#fax#}", "{#address#}", "{#postcode#}", "{#website#}", "{#linker#}", "{#product_list#}", "{#bidding_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 BiddingStrTemp = BiddingList(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], BiddingStrTemp);
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("企業(yè)招標(biāo)生成結(jié)束");
return error;
}
// ///////////////企業(yè)招標(biāo)生成結(jié)束///////////////////////
/*
* 替換企業(yè)招標(biāo)
*/
public String BiddingList(String cust_id) throws SaasApplicationException {
String biddingTemp = "";
String initStr = "<div>\n" + " <div>\n" + " <h5>\n" + " {#bid:title#}\n" + " </a>\n" + " </h5>\n" + " {#bid:no#}\n<br>" + " {#bid:addr#}<br>\n" + " {#bid:pub#}\n" + " </div>\n" + " </div>";
Biddinginfo bidding = new Biddinginfo();
ArrayList biddingList = bidding.genBiddingList(cust_id);
if (biddingList != null && biddingList.size() > 0) {
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -