資源簡介
在線購物已經成了一種時尚,它為人們提供了網絡購物的方便性,使顧客可以足不出戶就可以購買商品,因其具有方便、安全、友好的交互等特性,顧客群體也逐漸龐大,尤其是網絡時代中成長的年輕人。現在流行的電子商務有B2B,B2C,C2C,G2C等類型。欣想電子商城采用的是B2B類型,它可以使顧客通過網絡購物、瀏覽商品、查詢訂單、查看公告和銷售排行等。通過對一些典型電子商城網站的考察、分析,并結合企業要求以及實際的市場調查,要求本系統具有以下功能:
美觀友好的操作界面,能保證系統的易用性。
規范、完善的基礎信息設置。
商品分類詳盡,可按不同類別查看商品信息。
按商品大類及商品名稱進行模糊查詢。
實現網上購物。
新品及特價商品展示。
商品銷售排行。
操作注意事項:
用戶注冊登錄后,可進行商品購買、商品信息查看以及訂單查詢操作。
進入后臺用戶名:mr;密碼:mrsoft
代碼片段和文件信息
package?com.lzw;
import?java.util.Date;
import?java.util.List;
import?java.util.Set;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?javax.servlet.http.HttpSession;
import?org.springframework.validation.BindException;
import?org.springframework.web.servlet.ModelAndView;
import?org.springframework.web.servlet.mvc.SimpleFormController;
import?org.springframework.web.servlet.view.RedirectView;
import?com.lzw.collect.GoodsElement;
import?com.lzw.dao.Dao;
import?com.lzw.form.CartCheckoutForm;
import?com.lzw.model.TbGoods;
import?com.lzw.model.TbMember;
import?com.lzw.model.TbOrder;
import?com.lzw.model.TbOrderDetail;
public?class?CartCheckoutController?extends?SimpleFormController?{
private?Dao?dao;
public?CartCheckoutController()?{
setCommandClass(CartCheckoutForm.class);
}
protected?ModelAndView?onsubmit(HttpServletRequest?request
HttpServletResponse?response?object?command?BindException?errors)
throws?Exception?{
HttpSession?session?=?request.getSession();
CartCheckoutForm?form?=?(CartCheckoutForm)?command;
TbMember?user?=?dao.getUser(form.getUsername()?null);
if?(user?==?null)?{
session.invalidate();
return?new?ModelAndView(getFormView());
}
float?rebate?=?dao.getUserRebate(form.getUsername());
List?cart?=?(List)?session
.getAttribute(“cart“);
int?number?=?0;
double?nowprice?=?(float)?0.0;
double?sum?=?(float)?0;
double?Totalsum?=?(float)?0;
long?ID?=?-1;
//?插入訂單主表數據
short?bnumber?=?0;
if?(cart?!=?null)?{
bnumber?=?(short)?cart.size();
}
TbOrder?order?=?new?TbOrder();
order.setAddress(form.getAddress());
order.setBnumber(bnumber);
order.setBz(form.getBz());
order.setCarry(form.getCarry());
order.setPay(form.getPay());
order.setPostcode(form.getPostcode());
order.setRebate(rebate);
order.setTel(form.getTel());
order.setTruename(form.getTruename());
order.setUsername(form.getUsername());
order.setOrderDate(new?Date());
order.setEnforce(0);
Set?tbOrderDetails?=?order.getTbOrderDetails();
//?插入訂單明細表數據
for?(int?i?=?0;?i? GoodsElement?myGoodsElement?=?cart.get(i);
ID?=?myGoodsElement.getID();
nowprice?=?myGoodsElement.getNowPrice()?*?rebate;
number?=?myGoodsElement.number;
sum?=?nowprice?*?number;
TbOrderDetail?details?=?new?TbOrderDetail();
details.setNumber(number);
details.setPrice(nowprice);
details.setTbOrder(order);
TbGoods?goods?=?dao.getGoods(ID);
details.setTbGoods(goods);
tbOrderDetails.add(details);
Totalsum?=?Totalsum?+?sum;
}
//?更新會員信息和會員等級
user.setAmount(user.getAmount()?==?null???Totalsum?:?user.getAmount()
+?Totalsum);
int?userGrade?=?dao.getGrade(user.getAmount());
if?(user.getGrade()?==?null?||?userGrade?>?user.getGrade())
user.setGrade(userGrade);
dao.insertobject(user?order);//?在事物中完成訂單保存
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\
?????文件????????4777??2011-01-30?14:51??第8章??明日電子商城\.classpath
?????文件????????2093??2011-02-25?08:51??第8章??明日電子商城\.project
?????文件?????????490??2011-01-30?08:36??第8章??明日電子商城\.springBeans
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\Databa
?????文件?????2031616??2011-05-11?14:49??第8章??明日電子商城\Databa
?????文件?????3932160??2011-05-11?14:49??第8章??明日電子商城\Databa
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\WebRoot\
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\WebRoot\CSS\
?????文件????????2174??2011-01-30?08:36??第8章??明日電子商城\WebRoot\CSS\st
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\WebRoot\JS\
?????文件????????3411??2011-01-30?08:36??第8章??明日電子商城\WebRoot\JS\check.jsp
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\WebRoot\me
?????文件??????????39??2011-01-30?08:36??第8章??明日電子商城\WebRoot\me
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\WebRoot\WEB-INF\
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\WebRoot\WEB-INF\classes\
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\WebRoot\WEB-INF\config\
?????文件????????4528??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\config\controller-config.xm
?????文件????????1917??2011-02-14?14:39??第8章??明日電子商城\WebRoot\WEB-INF\config\dao-config.xm
?????文件????????4981??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\config\managerController-config.xm
?????文件????????2700??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\config\tiles-defs.xm
?????文件?????????577??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\config\tiles-manageTemplate.xm
?????文件????????3567??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\config\tiles-managerDefs.xm
?????文件????????2619??2011-02-24?10:49??第8章??明日電子商城\WebRoot\WEB-INF\config\tiles-template.xm
?????文件????????2986??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\config\view-config.xm
?????目錄???????????0??2013-01-09?10:37??第8章??明日電子商城\WebRoot\WEB-INF\jsp\
?????文件????????1619??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\jsp\NewGoods.jsp
?????文件????????3700??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\jsp\cart_checkout.jsp
?????文件????????6880??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\jsp\cart_see.jsp
?????文件?????????462??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\jsp\footer.jsp
?????文件????????1396??2011-01-30?08:36??第8章??明日電子商城\WebRoot\WEB-INF\jsp\goods_details.jsp
............此處省略266個文件信息
- 上一篇:R語言實戰中文完整版+R語言與統計分析-湯銀才
- 下一篇:光電子學課件非常好的資源
評論
共有 條評論