Java项目:推荐算法商城系统(java+SSM+JSP+JS+JQUERY+Layui+Mysql)

源码获取:俺的博客首页 "资源" 里下载! 

项目介绍

角色:管理员、用户

用户登陆后,主要模块包括主页、个人中心、评论、购物车、我的收藏等功能。

管理员登陆后,主要模块包括主页、个人中心、用户管理、商品分类管理、商品信息管理、系统管理、订单管理等功能


环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目;
6.数据库:MySql 5.7/8.0等版本均可;


技术栈

后端:SSM(Spring+SpringMVC+Mybatis)

前端:JSP+CSS+JS+JQUERY+Layui


使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;

 

 

 

 

购物车管理控制层: 

@Controller
@RequestMapping("/car")
public class CarController {
    @Autowired
    private CarService carService;
    @Autowired
    private ItemService itemService;

    /**
     * 加入购物车
     *
     * @param request
     * @param car
     * @return
     */
    @RequestMapping("/addcar")
    @ResponseBody
    public String addcar(HttpServletRequest request, Car car) {
        JSONObject json = new JSONObject();
        Object userId = request.getSession().getAttribute("userId");
        //如果未登录,返回0,提示先登录
        if (userId == null) {
            json.put(Consts.RES, 0);
            return json.toJSONString();
        }
        //保存到购物车
        Item item = itemService.getById(car.getItemId());
        car.setUserId(Integer.valueOf(userId.toString()));
        String price = item.getPrice();
        Double value = Double.valueOf(price);
        car.setPrice(value);
        // BigDecimal bigDecimal = new BigDecimal(value).setScale(2,BigDecimal.ROUND_UP);
        if (item.getZk() != null) {
            value = value * item.getZk() / 10;
            BigDecimal bigDecimal = new BigDecimal(value).setScale(2, RoundingMode.UP);
            car.setPrice(bigDecimal.doubleValue());
        }
        Integer num = car.getNum();
        Double t = value * num;
        BigDecimal bigDecimal = new BigDecimal(t).setScale(2, RoundingMode.UP);
        Double tDouble = bigDecimal.doubleValue();
        car.setTotal(tDouble + "");
        carService.insert(car);
        json.put(Consts.RES, 1);
        return json.toJSONString();
    }

    /**
     * 跳转到购物车页面
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("/findBySql")
    public String findBySql(Model model, HttpServletRequest request) {
         Object userId = request.getSession().getAttribute("userId");
         if(userId==null){
             return "redirect:/login/uLogin";

         }
         Integer id = Integer.valueOf(userId.toString());
         String sql = "select * from car where user_id="+id+" order by id";
        List<Car> carList = carService.listBySqlReturnEntity(sql);
        model.addAttribute("list",carList);
        return "/car/carview";
    }

    /**
     * 删除购物车
     * @param id
     * @return
     */
    @RequestMapping("/delete")
    @ResponseBody
    public String delete(Integer id){
        carService.deleteById(id);
        return "success";
    }
}

 订单详情控制层:

@Controller
@RequestMapping("/orderDetail")
public class OrderDetailController {
    @Autowired
    private OrderDetailService orderDetailService;

    /**
     * 获取订单详情列表
     * @param model
     * @param orderDetail
     * @return
     */
    @RequestMapping("/findbysql")
    public String OrderDetailList(Model model,OrderDetail orderDetail){
        String sql = "select * from order_detail where status = 0 and order_id = "+orderDetail.getOrderId();
        Pager<OrderDetail> pagers = orderDetailService.findBySqlRerturnEntity(sql);
        model.addAttribute("pagers",pagers);
        model.addAttribute("obj",orderDetail);
        return "/orderDetail/orderDetailList";
    }
}

品类管理控制层: 

@Controller
@RequestMapping("/itemCategory")
public class ItemCategoryController extends BaseController {

    @Autowired
    private ItemCategoryService itemCategoryService;

    /**
     * 分页查询类目列表
     */
    @RequestMapping("/findBySql")
    public String findBySql(Model model,ItemCategory itemCategory){
        String sql = "select * from item_category where isDelete = 0 and pid is null order by id";
        Pager<ItemCategory> pagers = itemCategoryService.findBySqlRerturnEntity(sql);
        model.addAttribute("pagers",pagers);
        model.addAttribute("obj",itemCategory);
        return "itemCategory/itemCategory";
    }

    /**
     *转向添加一级分类页面
     * @return
     */
    @RequestMapping("/add")
    public String addItemCategory(){

        return "/itemCategory/add";
    }
    /**
     *转向添加二级分类页面
     * @return
     */
    @RequestMapping("/add2")
    public String addItemCategory2(Model model,Integer pid){
        model.addAttribute("pid",pid);
        return "/itemCategory/add2";
    }

    /**
     * 跳转到修改类目页面
     * @return
     */
    @RequestMapping("/update")
    public String updateItemCategory(Integer id,Model model){
        ItemCategory itemCategory = itemCategoryService.load(id);
        model.addAttribute("item",itemCategory);
        return "/itemCategory/update";
    }
    /**
     * 跳转到修改二级类目页面
     * @return
     */
    @RequestMapping("/updateTwo")
    public String updateTwoItemCategory(Integer id,Model model){
        ItemCategory itemCategory = itemCategoryService.load(id);
        model.addAttribute("item",itemCategory);
        return "/itemCategory/update2";
    }
    /**
     * 添加一级类目
     * @param itemCategory
     * @return
     */
    @RequestMapping("/exadd")
    public String exaddItemCategory(ItemCategory itemCategory){
        itemCategory.setIsDelete(0);
        itemCategoryService.insert(itemCategory);
        return "redirect:/itemCategory/findBySql";
      //  return "itemCategory/itemCategory";
    }
    /**
     * 添加二级类目
     * @param itemCategory
     * @return
     */
    @RequestMapping("/exadd2")
    public String exaddItemCategory2(ItemCategory itemCategory){
        itemCategory.setIsDelete(0);
        Integer pid = itemCategory.getPid();
        itemCategoryService.insert(itemCategory);
        return "redirect:/itemCategory/findBySql2.action?pid="+pid;
        //  return "itemCategory/itemCategory";
    }

    /**
     * 修改一级目录
     * @param itemCategory
     * @return
     */
   @RequestMapping("/exupdate")
    public String exupdateItemCategory(ItemCategory itemCategory){
       itemCategory.setIsDelete(0);
       String i = itemCategory.getName();
        itemCategoryService.updateById(itemCategory);
       return "redirect:/itemCategory/findBySql.action";
   }
    /**
     * 修改二级目录
     * @param itemCategory
     * @return
     */
    @RequestMapping("/exupdate2")
    public String exupdateTwoItemCategory(ItemCategory itemCategory){
        itemCategory.setIsDelete(0);
        String i = itemCategory.getName();
        Integer pid = itemCategory.getPid();
        itemCategoryService.updateById(itemCategory);
        return "redirect:/itemCategory/findBySql2.action?pid="+pid;
     //   return "redirect:/itemCategory/findBySql2.action?pid="+pid;
    }
    /**
     * 删除一个类目
     * @param id
     * @return
     */
   @RequestMapping("/delete")
    public String deleteItemCategory(Integer id){
       //把对应类目的isdelete改为1后更新
       ItemCategory itemCategory = itemCategoryService.load(id);
       itemCategory.setIsDelete(1);
       itemCategoryService.updateById(itemCategory);
       //如果类目下有子类目,把对应类目的isdelete改为1后更新
       String sql = "update item_category set isDelete=1 where pid="+id;
       itemCategoryService.updateBysql(sql);
       return "redirect://itemCategory/findBySql.action";
   }

    /**
     * 删除一个二级类目
     * @param id
     * @return
     */
    @RequestMapping("/deleteTwo")
    public String deleteTwoItemCategory(Integer id){
        //把对应类目的isdelete改为1后更新
        ItemCategory itemCategory = itemCategoryService.load(id);
        itemCategory.setIsDelete(1);
        itemCategoryService.updateById(itemCategory);
        return "redirect://itemCategory/findBySql2.action?pid="+itemCategory.getPid();
    }

    /**
     * 查找二级目录
     * @param pid
     * @param model
     * @return
     */
   @RequestMapping("findBySql2")
    public String findBySql2ItemCategory(Integer pid,Model model){
       //查找pid=id的类目
       String sql = "select * from item_category where isDelete=0 and pid="+pid;
       List<ItemCategory> list = itemCategoryService.listBySqlReturnEntity(sql);
       Pager<ItemCategory> pagers = itemCategoryService.findBySqlRerturnEntity(sql);
       model.addAttribute("pagers",pagers);
       model.addAttribute("ItemCategoryList",list);
       model.addAttribute("pid",pid);
       return "itemCategory/Sdirectory";
   }
}

 

源码获取:俺的博客首页 "资源" 里下载!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
项目完整可用,配合压缩包内数据库可直接运行使用。 eclipse+mysql5.7+jdk1.8 功能:推荐引擎利用特殊的信息过滤(IF,Information Filtering)技术,将不同的内容(例如电影、音乐、书籍、新闻、图片、网页等)推荐给可能感兴趣的用户。通常情况下,推荐引擎的实现是通过将用户的个人喜好与特定的参考特征进行比较,并试图预测用户对一些未评分项目的喜好程度。参考特征的选取可能是从项目本身的信息中提取的,或是基于用户所在的社会或社团环境。 根据如何抽取参考特征,我们可以将推荐引擎分为以下四大类: • 基于内容的推荐引擎:它将计算得到并推荐给用户一些与该用户已选择过的项目相似的内容。例如,当你在网上购书时,你总是购买与历史相关的书籍,那么基于内容的推荐引擎就会给你推荐一些热门的历史方面的书籍。 • 基于协同过滤的推荐引擎:它将推荐给用户一些与该用户品味相似的其他用户喜欢的内容。例如,当你在网上买衣服时,基于协同过滤的推荐引擎会根据你的历史购买记录或是浏览记录,分析出你的穿衣品位,并找到与你品味相似的一些用户,将他们浏览和购买的衣服推荐给你。 • 基于关联规则的推荐引擎:它将推荐给用户一些采用关联规则发现算法计算出的内容。关联规则的发现算法有很多,如 Apriori、AprioriTid、DHP、FP-tree 等。 • 混合推荐引擎:结合以上各种,得到一个更加全面的推荐效果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

beyondwild

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值