?? createcustomerhtml.java
字號:
if (prodInfo.get("cust_id") != null) {
cust_id = prodInfo.get("cust_id").toString();
}
if (prodInfo.get("product_site") != null) {
product_site = prodInfo.get("product_site").toString();
}
if (prodInfo.get("product_name") != null) {
product_name = prodInfo.get("product_name").toString();
}
if (prodInfo.get("publish_date") != null) {
publish_date = prodInfo.get("publish_date").toString();
if (publish_date.length() > 10)
publish_date = publish_date.substring(0, 10);
}
cust_name = new Custinfo().getCustCompany( cust_id );
prodTemp = prodTemp + initStr;
prodTemp = StrReplace.replace(prodTemp, "{#prod:title#}",product_name);
prodTemp = StrReplace.replace(prodTemp, "{#prod:unit#}", cust_name);
prodTemp = StrReplace.replace(prodTemp, "{#prod:end_date#}", publish_date);
prodTemp = StrReplace.replace(prodTemp, "{#prod:addr#}", product_site);
prodTemp = StrReplace.replace(prodTemp, "{#prod:link#}", "/zone_b2b/enterprise/productInfo.jsp?product_id=" + product_id+"&cust_id=" + cust_id);
String pict_path = new ProductInfo().getCustAttachPath(product_id, "0");
if (pict_path == null) {
pict_path = "/upload/default.gif";
}
prodTemp = StrReplace.replace(prodTemp, "{#prod:pict#}", "<img src=" + pict_path + " border=0>");
}
}
return prodTemp;
}
/*
* 生成企業招聘
*/
public int createCustomerResume(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 = "resume.htm";
String templatePath = rootpath + "/" + "templates/enterprise/default/ym_resume.html";
String[] tab = { "{#include:bottom#}", "{#cust:name#}", "{#cust:scope#}", "{#company_logo#}", "{#juristic#}", "{#mail#}", "{#telephone#}", "{#fax#}", "{#address#}", "{#postcode#}", "{#website#}", "{#linker#}", "{#product_list#}", "{#resume_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 JobStrTemp = JobList(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], JobStrTemp);
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 JobList(String cust_id) throws SaasApplicationException {
String jobTemp = "";
String initStr = "<div><div><b>職位:</b><b><font size=3><a href=\"{#link#}\">{#job:title#}</a></font></b><br>工作地點:{#job:addr#}<br>要求:{#job:request#}</div></div><br>";
JobInfo job = new JobInfo();
ArrayList jobList = job.genNewJobList(cust_id);
log.LOG_INFO( "" + jobList );
if (jobList != null && jobList.size() > 0)
{
for (int i = 0; i < jobList.size(); i++)
{
HashMap jobInfo = (HashMap) jobList.get(i);
String job_id = jobInfo.get("job_id").toString();
String title = "";
String job_addr = "";
String request = "";
String job_unit = "";
if (jobInfo.get("title") != null)
{
title = jobInfo.get("title").toString();
}
if (jobInfo.get("job_unit") != null)
{
job_unit = jobInfo.get("job_unit").toString();
}
if (jobInfo.get("job_addr") != null)
{
job_addr = jobInfo.get("job_addr").toString();
}
if (jobInfo.get("request") != null)
{
request = jobInfo.get("request").toString();
}
jobTemp = jobTemp + initStr;
jobTemp = StrReplace.replace(jobTemp, "{#link#}", "/zone_b2b/job/jobinfo.jsp?cust_id=" + job_unit );
jobTemp = StrReplace.replace(jobTemp, "{#job:title#}",title);
jobTemp = StrReplace.replace(jobTemp, "{#job:addr#}", job_addr);
jobTemp = StrReplace.replace(jobTemp, "{#job:request#}",request);
}
}
return jobTemp;
}
// 生成企業留言
public int createCustomerLeave(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 = "leavel.htm";
String listStr = "";
String templatePath = rootpath + "/" + "templates/enterprise/default/ym_leave.html";
String[] tab = { "{#include:bottom#}", "{#cust:name#}", "{#cust:scope#}",
"{#company_logo#}", "{#juristic#}", "{#mail#}", "{#telephone#}",
"{#fax#}", "{#address#}", "{#postcode#}", "{#website#}", "{#linker#}",
"{#product_list#}", "{#leave_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 LeaveStrTemp=LeaveList( 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[14], cust_id);
tempStr = StrReplace.replace(tempStr, tab[15], webtitle);
// tempStr = StrReplace.replace( tempStr,tab[13],LeaveStrTemp );
tempStr = StrReplace.replace(tempStr, "{#cust:idx#}", cust_id);
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 void createCustomer(String rootpath) throws SaasApplicationException {
this.createCustomerIntroduce(rootpath);
this.createCustomerSupply(rootpath);
this.createCustomerCredit(rootpath);
this.createCustomerStock(rootpath);
this.createCustomerNews(rootpath);
this.createCustomerBidding(rootpath);
this.createCustomerTech(rootpath);
this.createCustomerProduct(rootpath);
this.createCustomerResume(rootpath);
// this.createCustomerCon( rootpath );
// this.createCustomerFriendly( rootpath );
this.createCustomerLeave(rootpath);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -