📄 createcustomerhtml.java
字号:
for (int i = 0; i < biddingList.size(); i++) {
HashMap biddingInfo = (HashMap) biddingList.get(i);
String bidding_id = biddingInfo.get("bidding_id").toString();
String title = "";
String bidding_no = "";
String publish_date = "";
String addr = "";
if (biddingInfo.get("title") != null) {
title = biddingInfo.get("title").toString();
}
if (biddingInfo.get("bidding_no") != null) {
bidding_no = biddingInfo.get("bidding_no").toString();
}
if (biddingInfo.get("publish_date") != null) {
publish_date = biddingInfo.get("publish_date").toString();
if (publish_date.length() > 10) {
publish_date = publish_date.substring(0, 10);
}
}
if (biddingInfo.get("addr") != null) {
addr = biddingInfo.get("addr").toString();
}
biddingTemp = biddingTemp + initStr;
biddingTemp = StrReplace.replace(biddingTemp, "{#bid:title#}", "标题:" + title);
biddingTemp = StrReplace.replace(biddingTemp, "{#bid:no#}", "标号:" + bidding_no);
biddingTemp = StrReplace.replace(biddingTemp, "{#bid:pub#}", "发布期日:" + publish_date);
biddingTemp = StrReplace.replace(biddingTemp, "{#bid:addr#}", "地址:" + addr);
}
}
return biddingTemp;
}
/*
* 生成公司技术
*/
public int createCustomerTech(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 = "techo.htm";
String templatePath = rootpath + "/" + "templates/enterprise/default/ym_tech.html";
String[] tab = { "{#include:bottom#}", "{#cust:name#}", "{#cust:scope#}", "{#company_logo#}", "{#juristic#}", "{#mail#}", "{#telephone#}", "{#fax#}", "{#address#}", "{#postcode#}", "{#website#}", "{#linker#}", "{#product_list#}", "{#tech_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 saleStrTemp = SaleList(cust_id);
String repStrTemp = RepositoryList(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], repStrTemp);
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 RepositoryList(String cust_id) throws SaasApplicationException {
String reposTemp = "";
String initStr = "<div>\n " + " <div>\n " + " <h5>\n " + " <a href={#repository:link#} target=_self>{#repository:title#}</a>\n " + " </a>\n " + " </h5>\n " + " {#repository:desc#}\n " + " {#repository:pub_date#}\n " + " </div>\n " + " </div>";
RepositoryInfo repository = new RepositoryInfo();
ArrayList reposList = repository.genCustRepository(cust_id);
if (reposList != null && reposList.size() > 0) {
for (int i = 0; i < reposList.size() && i < 10; i++) {
HashMap repInfo = (HashMap) reposList.get(i);
String repository_id = repInfo.get("repository_id").toString();
String title = "";
String content = "";
String publish_date = "";
if (repInfo.get("title") != null) {
title = repInfo.get("title").toString();
}
if (repInfo.get("content") != null) {
content = repInfo.get("content").toString();
}
if (repInfo.get("publish_date") != null) {
publish_date = repInfo.get("publish_date").toString();
if (publish_date.length() > 10)
publish_date = publish_date.substring(0, 10);
}
reposTemp = reposTemp + initStr;
reposTemp = StrReplace.replace(reposTemp, "{#repository:title#}", "标题:" + title);
reposTemp = StrReplace.replace(reposTemp, "{#repository:link#}", "/zone_b2b/school/sch_knowlist_con.jsp?repository_id=" + repository_id);
reposTemp = StrReplace.replace(reposTemp, " {#repository:desc#}", " " + content + "...");
reposTemp = StrReplace.replace(reposTemp, "{#repository:pub_date#}", "[" + publish_date + "]");
}
}
return reposTemp;
}
/*
* 生成企业产品
*/
public int createCustomerProduct(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 = "product.htm";
String listStr = "";
String templatePath = rootpath + "/" + "templates/enterprise/default/ym_prod.html";
String[] tab = { "{#include:bottom#}", "{#cust:name#}", "{#cust:scope#}", "{#company_logo#}", "{#juristic#}", "{#mail#}", "{#telephone#}", "{#fax#}", "{#address#}", "{#postcode#}", "{#website#}", "{#linker#}", "{#product_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 = ProductionList(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], cust_id);
tempStr = StrReplace.replace(tempStr, tab[14], 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 ProductionList(String cust_id) throws SaasApplicationException {
String prodTemp = "";
String initStr = "<tr> " +
" <td> " +
" <a href={#prod:link#} target=_self>{#prod:pict#}</a> " +
" </td><td width=5> </td> " +
" <td> " +
" 名称: <font size=2> " +
" <b><a href={#prod:link#} target=_self>{#prod:title#}</a></b> " +
" </font> <br> " +
" 单位: {#prod:unit#} <br> " +
" 发布日期: {#prod:end_date#} <br> " +
" 地址: {#prod:addr#} " +
" </td> " +
"</tr>";
ProductInfo product = new ProductInfo();
ArrayList prodList = product.getproductListByLimit(cust_id, 10);
if (prodList != null && prodList.size() > 0)
{
for (int i = 0; i < prodList.size(); i++)
{
HashMap prodInfo = (HashMap) prodList.get(i);
String product_id = prodInfo.get("product_id").toString();
cust_id = "";
String cust_name = "";
String product_name = "";
String product_site = "";
String publish_date = "";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -