基于javaweb+mysql的springboot电脑商城系统(java+springboot+maven+html+thymeleaf+layui+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot电脑商城系统(java+springboot+maven+html+thymeleaf+layui+mysql)
项目介绍
主要功能包括:
分别是前台用户模块、管理员以及店铺的模块
前台用户模块的功能描述:
(1)个人信息模块:用户可以查看个人信息,修改个人信息,修改个人密码。
(2)收藏管理:添加商品到收藏夹,如果商品已经存在收藏夹中,可以取消商品收藏。
(3)购物车管理:添加商品到购物车中,如果购物车有该商品,则商品数量加1,购物车中可以改变商品数量,可以将商品移出购物车,可以选定哪些商品进行结算或者全选结算,结算之后该商品将会移出购物车。
(4)收货信息管理:用户可以添加自己的收货信息,修改收货信息和删除收货信息,可以增加多条收货信息,并选择一条设置为默认的,在购买时将选取默认的收货地址。
(5)订单管理:用户支付成功之后,将在我的订单页面中看到订单的详情,若卖家发货了,则可以确认收货然后进行商品评价。若订单未进行支付,则可以点待支付可以进行重新支付。
(6)支付功能:用户选择商品和商品数量,进行订单详情页,进行支付,使用支付宝沙箱模拟支付。
(7)商品模块:用户可以浏览商品信息,根据商品的关键字搜索商品信息,用户购买商品,确认收货之后可以对商品进行评价,填写对商品的评价内容和选择星级。
店铺模块的功能描述:
(1)商品管理:卖家可以上架商品,下架商品,对商品信息进行修改,对商品的关键信息进行模糊查询。
(2)订单管理:卖家可以查看所有订单,根据订单的状态搜索订单信息,对已支付的订单进行发货操作。
(3)评论管理:卖家可以查看所有用户的评论信息,。可以按照商品的名称查询改商品的评论内容。
管理员模块的功能描述:
(1)用户管理:可以对用户信息进行增删改查操作。
(2)店铺管理:可以处理店铺的申请信息,可以停用店铺的运营,商城将移出该店铺的所有信息,也可以恢复店铺的运营。
(3)轮播图管理:对轮播图信息增删改查的操作和选用轮播图。
后端:springboot(Spring+SpringMVC+Mybatis)
前端:HTML,jquery,Thymeleaf,Layui
int userId = (int) session.getAttribute("userId");
List<Integer> list = goodsService.selectCartByGoodIdAndPriceAndUserId(id,price,userId);
if(list!=null && list.size()>0){
int i = goodsService.updataCartNums(id, price, userId);
if(i>0){
return "add";
}else{
return "fail";
}
}else {
Cart cart = new Cart();
cart.setCartGoods(id);
cart.setCartNum(1);
cart.setCartPrice(price);
cart.setCartUser(userId);
int k = goodsService.insertCart(cart);
if (k>0){
return "sucess";
}else {
return "fail";
}
}
}
@RequestMapping("/cartGoodsDelete/{CartId}")
@ResponseBody
public String cartGoods(@PathVariable int CartId,Model model, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int rs = goodsService.deleteCartByCartId(CartId);
if (rs>0){
return "success";
}else {
return "fail";
}
}
@RequestMapping("/addCartNums/{cartId}/{goodsId}")
@ResponseBody
public String addCartNums(@PathVariable int cartId,@PathVariable int goodsId){
int rs = goodsService.addCartNums(cartId);
if (rs>0){
return "success";
}else {
return "fail";
}
}
@RequestMapping("/reduceCartNums/{cartId}/{goodsId}")
@ResponseBody
public String reduceCartNums(@PathVariable int cartId,@PathVariable int goodsId){
Cart cart = goodsService.getCartById(cartId);
if (cart.getCartNum()>1){
/*待付款*/
@RequestMapping("/getOrderIdByIdBuy/{OrderId}")
public void getOrderIdByIdBuy(@PathVariable Long OrderId, Model model, HttpServletResponse response,HttpSession session,HttpServletRequest request) {
request.getSession().removeAttribute("orderId3");
String type = "info"; // 类型
OrderDetail orderDetail = orderService.selectGoodsIdByOrderId(OrderId);
Goods goods = goodsService.getGoodsById(orderDetail.getDetailGoods());
BigDecimal price = goods.getGoodsPrice();
int price2 = price.intValue() * orderDetail.getDetailNum();
try {
AlipayClient alipayClient = new DefaultAlipayClient(
alipayConfig.getOpenApiDomain(),
alipayConfig.getAppId(),
alipayConfig.getMerchantPrivateKey(),
alipayConfig.getFormat(),
alipayConfig.getCharset(),
alipayConfig.getAlipayPublicKey(),
alipayConfig.getSignType()); //获得初始化的AlipayClient
AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();//创建API对应的request
alipayRequest.setReturnUrl(alipayConfig.getReturnUrl());
alipayRequest.setNotifyUrl(alipayConfig.getNotifyUrl());//在公共参数中设置回跳和通知地址
if (type.equals("info")){
alipayRequest.setBizContent("{" +
" \"out_trade_no\":\""+OrderId+"\"," +
" \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," +
" \"total_amount\":\""+price2+"\"," +
" \"subject\":\""+goods.getGoodsName()+"\"," +
" \"body\":\""+goods.getGoodsName()+"\"," +
" \"passback_params\":\"merchantBizType%3d3C%26merchantBizNo%3d2016010101111\"," +
" \"extend_params\":{" +
" \"sys_service_provider_id\":\"2088511833207846\"" +
" }"+
" }");//填充业务参数
}else if (type.equals("cart")){
alipayRequest.setBizContent("{" +
" \"out_trade_no\":\""+OrderId+"\"," +
" \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," +
" \"total_amount\":\""+goods.getGoodsPrice()+"\"," +
" \"subject\":\""+goods.getGoodsName()+"\"," +
" \"body\":\""+goods.getGoodsName()+"\"," +
" \"passback_params\":\"merchantBizType%3d3C%26merchantBizNo%3d2016010101111\"," +
" \"extend_params\":{" +
" \"sys_service_provider_id\":\"2088511833207846\"" +
" }"+
" }");//填充业务参数
@Controller
public class cartController {
@Autowired
private GoodsService goodsService;
@Autowired
private EvaluateService evaluateService;
@Autowired
private AddressService addressService;
@Autowired
private GoodsTypeService goodsTypeService;
@RequestMapping("/cartGoods/{id}/{price}")
@ResponseBody
public String cartGoods(@PathVariable int id, @PathVariable BigDecimal price, Model model, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int userId = (int) session.getAttribute("userId");
List<Integer> list = goodsService.selectCartByGoodIdAndPriceAndUserId(id,price,userId);
if(list!=null && list.size()>0){
int i = goodsService.updataCartNums(id, price, userId);
if(i>0){
return "add";
}else{
return "fail";
}
}else {
@RequestMapping("/getAllBrand")
@ResponseBody
public List<Brand> getAllBrand(){
List<Brand> brandList = brandService.getAllBrand();
return brandList;
}
@RequestMapping("/getAllGoodsType")
@ResponseBody
public List<GoodsType> getAllGoodsType(){
List<GoodsType> goodsTypeList = goodsTypeService.getAllGoodsType();
return goodsTypeList;
}
@RequestMapping("/getGoodsByBrand/{brandId}")
public String getGoodsByBrand(@PathVariable int brandId,Model model){
List<Goods> allGoodsList = goodsService.getGoodsByBrand(brandId);
model.addAttribute("allGoodsList", allGoodsList);
return "/goodsList";
}
@RequestMapping("/getGoodsByType/{typeId}")
public String getGoodsByType(@PathVariable int typeId,Model model){
List<Goods> allGoodsList = goodsService.getGoodsByType(typeId);
model.addAttribute("allGoodsList", allGoodsList);
return "/goodsList";
}
@RequestMapping("/toAddGoods")
public String toAddGoods(){
return "/admin/addGoods";
}
@RequestMapping(value = "/upload")
@ResponseBody
public JSONObject upUserImg(@RequestParam(value = "file") MultipartFile file) throws IOException {
if (file.isEmpty()) {
throw new IOException("上传文件不能为空");
}
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
File path = new File(ResourceUtils.getURL("classpath:static").getPath());
if(!path.exists()) {
path = new File("");
}
File upload = new File(path.getAbsolutePath(),"/img/header/goods/");
if(!upload.exists()) {
upload.mkdirs();
}
String fileName = new Date().getTime()+"."+fileExt;
File dest = new File(upload.getAbsolutePath()+"/"+fileName);
file.transferTo(dest);
FileUtils.copyFile(dest, new File(Constants.UPLOAD_IMG_PATH+File.separator+"goods"+File.separator+fileName));
@Override
public int stopOpen(int storeId) {
return storeMapper.stopOpen(storeId);
}
@Override
public int renewOpen(int storeId) {
return storeMapper.renewOpen(storeId);
}
@Override
public Store getByGoodsId(int goodsId) {
return storeMapper.getByGoodsId(goodsId);
}
@Override
public Store getByStoreId(int storeId) {
return storeMapper.selectByPrimaryKey(storeId);
}
}
@Controller
@RequestMapping("admin")
public class AdminController {
@Autowired
if(storenum == null){
int i = storeService.shenqingStore2(storeName,storeDesc,storeStat,userId);
if(i == 1){
return "success";
}
}else {
return "into";
}
return "flag";
}
*/
@RequestMapping("/getStoreByUser")
@ResponseBody
public int getStoreByUser(HttpSession session){
int userId = (int) session.getAttribute("userId");
Store store = storeService.selectByUserId(userId);
return store.getStoreId();
}
@RequestMapping("/getStoreInfo")
@ResponseBody
public Store getStoreInfo(HttpSession session){
int userId = (int) session.getAttribute("userId");
Store store = storeService.selectByUserId(userId);
return store;
}
@RequestMapping("/updateStore/{storeName}/{storeDesc}")
@ResponseBody
public String updateStore(@PathVariable String storeName,@PathVariable String storeDesc,HttpSession httpSession){
int userId = (int) httpSession.getAttribute("userId");
Store store = storeService.selectByUserId(userId);
int rs = storeService.updateStoreById(store.getStoreId(),storeName,storeDesc);
if (rs>0){
return "success";
}else {
return "fail";
}
}
@RequestMapping("/stopOpen/{storeId}")
@ResponseBody
public String stopOpen(@PathVariable int storeId){
List<Goods> goodsList = goodsService.getGoodsStoreId2(storeId);
if (goodsList.isEmpty()||goodsList.size()==0){
int rs = storeService.stopOpen(storeId);
if(rs>0){
return "success";
}else {
return "fail";
}
}else{
int userId = (int) session.getAttribute("userId");
Address address = new Address();
address.setAddrUser(userId);
address.setAddrPhone(phone);
address.setAddrReceiver(name);
address.setAddrProvince(province);
address.setAddrCity(city);
address.setAddrArea(district);
address.setAddrStreet(jiedao);
address.setAddrDetail(detailsAddress);
address.setAddrPostcode(youzheng);
address.setAddrDefault("否");
address.setAddrState(1);
address.setCreateTime(new Date());
address.setUpdateTime(new Date());
int i = addressService.addAddress(address);
if(i == 1){
return "success";
}else {
return "flag";
}
}
}
if (rs > 0) {
return "success";
} else {
return "fail";
}
}
//注销 退出登录
@RequestMapping("/admin_logout")
@ResponseBody
public String logout(HttpServletRequest request) {
HttpSession session = request.getSession();
session.removeAttribute("admin");
return "success";
}
/*通过Id获取admin*/
@RequestMapping("/getAdminById/{adminId}")
public String getById(@PathVariable int adminId, Model model) {
Admin admin = adminService.getAdminById(adminId);
model.addAttribute("admin", admin);
return "/admin/admin_update";
}
//上传头像
@RequestMapping(value = "/upload")
@ResponseBody
public JSONObject upUserImg(@RequestParam(value = "file") MultipartFile file) throws IOException {
if (file.isEmpty()) {
throw new IOException("上传文件不能为空");
}
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
File path = new File(ResourceUtils.getURL("classpath:static").getPath());
if(!path.exists()) {
path = new File("");
}
File upload = new File(path.getAbsolutePath(),"/img/header/admin/");
if(!upload.exists()) {
upload.mkdirs();
}
String fileName = new Date().getTime()+"."+fileExt;
@Override
public int deleteByStoreId(int storeId) {
return storeMapper.deleteByPrimaryKey(storeId);
}
@Override
public int shenheStore(int storeId, int shenheCode) {
return storeMapper.shenheStore(storeId,shenheCode);
}
@Override
public int shenqingStore(String storeName, String storeDesc,int userId) {
Store store = new Store();
store.setStoreName(storeName);
store.setStoreDesc(storeDesc);
store.setStoreState("3");
store.setStoreUser(userId);
return storeMapper.insertSelective(store);
}
@Override
public int shenqingStore2(String storeName, String storeDesc, String storeStat, int userId) {
Store store = new Store();
store.setStoreName(storeName);
store.setStoreDesc(storeDesc);
store.setStoreState(storeStat);
store.setStoreUser(userId);
return storeMapper.insertSelective(store);
}
@Override
public Store selectByUserId(int userId) {
return storeMapper.selectByUserId(userId);
}
@Override
public Store selectByOrderId(int storeId) {
return storeMapper.selectByPrimaryKey(storeId);
}
@Override
public int updateStoreById(int storeId, String storeName, String storeDesc) {
return storeMapper.updateStoreById(storeId,storeName,storeDesc);
}
/*商品页面*/
@RequestMapping("/goods")
public String toGoods() {
return "/admin/goods";
}
/*商品页面*/
@RequestMapping("/orders")
public String toOrders() {
return "/admin/orders";
}
/*评论页面*/
@RequestMapping("/commentary")
public String toCommentary() {
return "/admin/commentary";
}
/*轮播图页面*/
@RequestMapping("/bannerList")
public String toBannerList() {
return "/admin/bannerList";
}
/*轮播图添加页面*/
@RequestMapping("/bannerAdd")
public String toBannerAdd() {
return "/admin/admin_addBanner";
}
/*统计页面*/
@RequestMapping("/store_show")
public String toTest2(){
return "/admin/store_show";
}
/*管理员修改密码页面*/
@RequestMapping("/toUpPwd")
public String toUpPwd() {
return "/admin/admin_upPwd";
}
/*验证密码*/
@RequestMapping("/verifyPwd/{oldPwd}")
@ResponseBody
public String verifyPwd(@PathVariable String oldPwd, HttpServletRequest request) {
HttpSession session = request.getSession();
Admin admin = (Admin) session.getAttribute("admin");
if (MD5Util.PwdMD5(oldPwd).equals(admin.getAdminPwd())) {
return "success";
evaluate.setEvaGoods(orderDetail.getDetailGoods());
evaluate.setEvaContent(text);
evaluate.setEvaLevel(receiving);
evaluate.setEvaDate(new Date());
evaluate.setEvaStore(orderinfo.getOrderStore());
evaluate.setEvaState(1);
int i = evaluateService.insertEvaluate(evaluate);
/*完成订单*/
int j = goodsService.getGoodsByOK(orderId);
if(i == 1 && j == 1){
return "success";
}else {
return "flag";
}
}
@RequestMapping("/getAllEva")
@ResponseBody
public List<Evaluate2> getAllEva(HttpSession httpSession){
int userId = (int) httpSession.getAttribute("userId");
List<Evaluate2> evaluate2List = evaluateService.getAllEva2(userId);
return evaluate2List;
}
@RequestMapping("/getCountWhereO")
@ResponseBody
public int getCountWhereO(HttpSession httpSession){
int userId = (int) httpSession.getAttribute("userId");
Store store = storeService.selectByUserId(userId);
int count = evaluateService.getCountWhereO(store.getStoreId());
return count;
}
@RequestMapping("/getCountWhereF")
@ResponseBody
public int getCountWhereF(HttpSession httpSession){
int userId = (int) httpSession.getAttribute("userId");
Store store = storeService.selectByUserId(userId);
int count = evaluateService.getCountWhereF(store.getStoreId());
return count;
}
}
throw new IOException("上传文件不能为空");
}
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
File path = new File(ResourceUtils.getURL("classpath:static").getPath());
if(!path.exists()) {
path = new File("");
}
File upload = new File(path.getAbsolutePath(),"/img/header/");
if(!upload.exists()) {
upload.mkdirs();
}
String fileName = new Date().getTime()+"."+fileExt;
File dest = new File(upload.getAbsolutePath()+"/"+fileName);
file.transferTo(dest);
FileUtils.copyFile(dest, new File(Constants.UPLOAD_IMG_PATH+File.separator+fileName));
JSONObject jsonObject = new JSONObject();
jsonObject.put("userImg", fileName);
return jsonObject;
}
//添加收货地址
@RequestMapping("/toAddAddress")
public String toUpAddress() {
return "/user/user_address";
}
//注销 退出登录
@RequestMapping("/user_logout")
@ResponseBody
public String logout(HttpServletRequest request) {
HttpSession session = request.getSession();
session.removeAttribute("user");
return "success";
}
/*查询用户全部信息 分页*/
@RequestMapping("/getAllUser")
@ResponseBody
public JSONObject getAllUser(int page, int limit, String keyWord) {
PageBean pageBean = new PageBean();
pageBean.setPage(page);
pageBean.setLimit(limit);
PageBean<User> pBean = userService.getPageBean(pageBean.getPage(), pageBean.getLimit(), keyWord);
JSONObject jsObj = new JSONObject();
jsObj.put("msg", "");
jsObj.put("code", 0);
jsObj.put("count", pBean.getTotalRecs());
jsObj.put("data", pBean.getJsArr());
return jsObj;
}
}
File upload = new File(path.getAbsolutePath(),"/img/header/");
if(!upload.exists()) {
upload.mkdirs();
}
String fileName = new Date().getTime()+"."+fileExt;
File dest = new File(upload.getAbsolutePath()+"/"+fileName);
file.transferTo(dest);
FileUtils.copyFile(dest, new File(Constants.UPLOAD_IMG_PATH+File.separator+fileName));
JSONObject jsonObject = new JSONObject();
jsonObject.put("userImg", fileName);
return jsonObject;
}
//添加收货地址
@RequestMapping("/toAddAddress")
public String toUpAddress() {
return "/user/user_address";
}
//注销 退出登录
@RequestMapping("/user_logout")
@ResponseBody
public String logout(HttpServletRequest request) {
HttpSession session = request.getSession();
session.removeAttribute("user");
return "success";
}
/*查询用户全部信息 分页*/
@RequestMapping("/getAllUser")
@ResponseBody
public JSONObject getAllUser(int page, int limit, String keyWord) {
PageBean pageBean = new PageBean();
pageBean.setPage(page);
pageBean.setLimit(limit);
PageBean<User> pBean = userService.getPageBean(pageBean.getPage(), pageBean.getLimit(), keyWord);
JSONObject jsObj = new JSONObject();
jsObj.put("msg", "");
jsObj.put("code", 0);
jsObj.put("count", pBean.getTotalRecs());
jsObj.put("data", pBean.getJsArr());
return jsObj;
}
/*删除用户*/
@RequestMapping("/deleteUser/{userId}")
@ResponseBody
public String deleUser(@PathVariable int userId) {
int rs = userService.deleteUser(userId);
@Override
public Store selectByUserId(int userId) {
return storeMapper.selectByUserId(userId);
}
@Override
public Store selectByOrderId(int storeId) {
return storeMapper.selectByPrimaryKey(storeId);
}
@Override
public int updateStoreById(int storeId, String storeName, String storeDesc) {
return storeMapper.updateStoreById(storeId,storeName,storeDesc);
}
@Override
public int stopOpen(int storeId) {
return storeMapper.stopOpen(storeId);
}
@Override
public int renewOpen(int storeId) {
return storeMapper.renewOpen(storeId);
}
@Override
public Store getByGoodsId(int goodsId) {
return storeMapper.getByGoodsId(goodsId);
}
@Override
public Store getByStoreId(int storeId) {
return storeMapper.selectByPrimaryKey(storeId);
}
}
}
}
for (Goods goods : goodsList) {
List<OrderDetail> orderDetailList = orderDetailService.getByGoodsId(goods.getGoodsId());
if (orderDetailList.size()>0||!orderDetailList.isEmpty()){
for (OrderDetail orderDetail : orderDetailList) {
orderDetailService.deleteByGoods(goods.getGoodsId());
orderService.deleteByorderId(orderDetail.getDetailOrder());
}
}
}
goodsService.deleteGoodsByStoreId(storeId);
if(rs>0){
return "success";
}else {
return "fail";
}
}
}
@RequestMapping("/renewOpen/{storeId}")
@ResponseBody
public String renewOpen(@PathVariable int storeId){
List<Goods> goodsList = goodsService.getGoodsStoreId2(storeId);
if (goodsList.isEmpty()||goodsList.size()==0){
int rs = storeService.renewOpen(storeId);
if(rs>0){
return "success";
}else {
return "fail";
}
}else{
int rs = storeService.renewOpen(storeId);
int rs2 = goodsService.renewGoodsByStoreId(storeId);
if(rs>0&&rs2>0){
return "success";
}else {
return "fail";
}
}
}
@RequestMapping("/isStop")
@ResponseBody
public String isStop(HttpSession httpSession){
int userId = (int) httpSession.getAttribute("userId");
Store store = storeService.selectByUserId(userId);
String storeState = store.getStoreState();
if (Integer.parseInt(storeState)==1){
return "fail";
}
}else {
Cart cart = new Cart();
cart.setCartGoods(id);
cart.setCartNum(1);
cart.setCartPrice(price);
cart.setCartUser(userId);
int k = goodsService.insertCart(cart);
if (k>0){
return "sucess";
}else {
return "fail";
}
}
}
@RequestMapping("/cartGoodsDelete/{CartId}")
@ResponseBody
public String cartGoods(@PathVariable int CartId,Model model, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int rs = goodsService.deleteCartByCartId(CartId);
if (rs>0){
return "success";
}else {
return "fail";
}
}
@RequestMapping("/addCartNums/{cartId}/{goodsId}")
@ResponseBody
public String addCartNums(@PathVariable int cartId,@PathVariable int goodsId){
int rs = goodsService.addCartNums(cartId);
if (rs>0){
return "success";
}else {
return "fail";
}
}
@RequestMapping("/reduceCartNums/{cartId}/{goodsId}")
@ResponseBody
public String reduceCartNums(@PathVariable int cartId,@PathVariable int goodsId){
Cart cart = goodsService.getCartById(cartId);
if (cart.getCartNum()>1){
int rs = goodsService.reduceCartNums(cartId);
List<Goods> goodsList = new ArrayList<>();
for (int i=0;i<cartList.size();i++){
Goods goods1 = goodsService.getGoodsById(cartList.get(i).getCartGoods());
goodsList.add(goods1);
}
List<GoodsType> goodsTypes = new ArrayList<>();
for (int i=0;i<goodsList.size();i++){
GoodsType goodsType = goodsTypeService.getTypeByTypeId(goodsList.get(i).getGoodsType());
goodsTypes.add(goodsType);
}
List<CartGoods2> cartGoodsList = new ArrayList<>();
for (int i=0;i<cartList.size();i++){
CartGoods2 cartGoods = new CartGoods2();
cartGoods.setCartId(cartList.get(i).getCartId());
cartGoods.setCartGoods(cartList.get(i).getCartGoods());
cartGoods.setCartNum(cartList.get(i).getCartNum());
cartGoods.setCartPrice(cartList.get(i).getCartPrice());
cartGoods.setCartUser(cartList.get(i).getCartUser());
cartGoods.setGoodsId(goodsList.get(i).getGoodsId());
cartGoods.setGoodsName(goodsList.get(i).getGoodsName());
cartGoods.setGoodsNums(goodsList.get(i).getGoodsNums());
cartGoods.setGoodsAttr(goodsList.get(i).getGoodsAttr());
cartGoods.setGoodsImg(goodsList.get(i).getGoodsImg());
cartGoods.setTypeId(goodsTypes.get(i).getTypeId());
cartGoods.setTypeName(goodsTypes.get(i).getTypeName());
BigDecimal num = new BigDecimal( cartList.get(i).getCartNum());
BigDecimal price = cartList.get(i).getCartPrice();
BigDecimal allPrice = price.multiply(num);
cartGoods.setAllcartNum(allPrice);
cartGoodsList.add(cartGoods);
}
model.addAttribute("cartGoodsList",cartGoodsList);
return "/cart";
}
/*获取全部商品信息 分页*/
@RequestMapping("/getAllGoodsByStoreId")
@ResponseBody
public JSONObject getAllGoodsByStoreId(int page, int limit, String keyWord, HttpSession session) {
int userId = (int) session.getAttribute("userId");
PageBean pageBean = new PageBean();
pageBean.setPage(page);
pageBean.setLimit(limit);