📄 productcommandaction.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: ProductCommandAction.java
package com.keyshop.shop.product.controller;
import com.keyshop.pub.controller.PubAction;
import com.keyshop.pub.util.*;
import com.keyshop.shop.product.model.Product;
import com.keyshop.shop.product.util.ProductHelper;
import com.keyshop.shop.system.manager.SystemManager;
import com.keyshop.shop.system.model.*;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;
public class ProductCommandAction extends PubAction
{
Provider provider;
public ProductCommandAction()
{
provider = null;
}
public String getSelectSQL()
{
return "";
}
public void initClassName()
{
boClass = "com.keyshop.shop.product.bo.ProductBO";
beanClass = "com.keyshop.shop.product.model.Product";
formBeanClass = "com.keyshop.shop.product.controller.ProductCommandForm";
}
public ActionForward performList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
String productId = request.getParameter("bean.id");
if(!StringUtil.isEmpty(productId))
{
Product p = ProductHelper.getProductById(productId, true);
if(p != null)
request.setAttribute("Product", p);
else
request.setAttribute("no_product", "true");
} else
{
request.setAttribute("no_product", "true");
}
return mapping.findForward("list");
}
public ActionForward performCommand(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
String productId = request.getParameter("bean.id");
Product p = null;
if(!StringUtil.isEmpty(productId))
{
p = ProductHelper.getProductById(productId, true);
if(p != null)
{
request.setAttribute("Product", p);
} else
{
request.setAttribute("no_product", "true");
return mapping.findForward("list");
}
} else
{
request.setAttribute("no_product", "true");
return mapping.findForward("list");
}
String myname = request.getParameter("myname");
String myemail = request.getParameter("myemail");
String content = request.getParameter("content");
if(!StringUtil.isEmpty(myname) && !StringUtil.isEmpty(myemail))
{
for(int i = 1; i < 5; i++)
{
String r1 = request.getParameter("name" + i);
String m1 = request.getParameter("email" + i);
if(!StringUtil.isEmpty(m1))
sendCommandMail(myname, myemail, content, p, r1, m1);
}
}
request.setAttribute("send_success", "true");
return mapping.findForward("list");
}
private void sendCommandMail(String sender, String senderEmail, String content, Product product, String reciever1, String reemail)
{
MailConfig mailconfig = SystemManager.getMailConfig(httpRequest);
String contentModel = mailconfig.getProduct_command_mail();
HashMap rtbl = new HashMap();
rtbl.put("$$USERNAME$$$", reciever1);
rtbl.put("$$SENDER$$$", sender);
rtbl.put("$$SENDEREMAIL$$$", senderEmail);
if(StringUtil.isEmpty(content))
content = " ";
rtbl.put("$$CON$$$", content);
rtbl.put("$$PRODUCTID$$$", product.getId());
rtbl.put("$$PRODUCTNAME$$$", product.getName());
rtbl.put("$$PRODUCTPRICE$$$", (new StringBuffer(String.valueOf(product.getUnitPrice()))).toString());
rtbl.put("$$PRODUCTNOTE$$$", product.getNote());
rtbl.put("$$SYSADDRESS$$", viewConfig.getSys_address());
rtbl.put("$$SYSNAME$$", viewConfig.getSys_name());
rtbl.put("$$SYSEMAIL$$", viewConfig.getSys_email());
rtbl.put("$$SYSLOCALNAME$$", viewConfig.getSys_localname());
rtbl.put("$$SYSLOCALIP$$", viewConfig.getSys_localip());
rtbl.put("$$LINKINFO$$", viewConfig.getLink_info());
rtbl.put("$$LOGIMAGE$$", viewConfig.getLog_image());
rtbl.put("$$SYSMSN$$", viewConfig.getSys_msn());
rtbl.put("$$SYSTEL$$", viewConfig.getSys_tel());
rtbl.put("$$SYSQQ$$", viewConfig.getSys_qq());
rtbl.put("$$VERSIONINFO$$", viewConfig.getVersion_info());
try
{
String mailSubject = sender + mailconfig.getProduct_command_mail_subject();
String mailContent = FileIO.repalceStr(contentModel, rtbl);
String serverAddress = mailconfig.getSmtp_host();
String userName = mailconfig.getSmtp_user();
String pwd = mailconfig.getSmtp_password();
String from = sender + "<" + senderEmail + ">";
String receiver = reciever1 + "<" + reemail + ">";
MailHelper.sendMail(serverAddress, userName, pwd, from, receiver, mailSubject, mailContent);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -