本基于javaSpringboot的协同过滤推荐算法的商品推荐系统,系统主要采用java,springboot,动态图表echarts,vue,mysql,mybatisplus,商品数据分析,协同过滤推荐算法,实现协同过滤推荐算法的商品推荐系统,系统提供商品购物前台网站,商品后台管理系统等功能。
前台购物网站平台主要包含:用户登录,用户注册,商品分类,商品列表,商品推荐,用户购物车,个人中心等模块
商品管理后台主要包含:用户管理,商品管理,热门商品管理,订单管理,推荐配置,分类管理,系统管理等等。
本基于javaSpringboot的协同过滤推荐算法的商品推荐系统,主要内容涉及:
主要功能模块:用户登录,用户注册,商品分类,商品列表,商品推荐,用户购物车,个人中心,用户管理,商品管理,热门商品管理,订单管理,推荐配置,分类管理,系统管理等模块
主要包含技术:java,vue,协同过滤推荐,前后端开发,数据处理,数据分析,mybatis,echarts,springboot,mysql,javascript等
基于javaSpringboot的协同过滤推荐算法的商品推荐系统主要采用前后端模式,针对商品游客数据查询封装成JSON格式,完成数据下发至系统界面端渲染,系统界面端针对JSON解析后采用javascript完成页面展示。其中系统首页商品分析逻辑如下:
@GetMapping({"/index", "/", "/index.html"})
public String indexPage(HttpServletRequest request, HttpSession httpSession) {
List<NewBeeMallIndexCategoryVO> categories = newBeeMallCategoryService.getCategoriesForIndex();
if (CollectionUtils.isEmpty(categories)) {
NewBeeMallException.fail("分类数据不完善");
}
List<NewBeeMallIndexCarouselVO> carousels = newBeeMallCarouselService.getCarouselsForIndex(Constants.INDEX_CAROUSEL_NUMBER);
List<NewBeeMallIndexConfigGoodsVO> hotGoodses = newBeeMallIndexConfigService.getConfigGoodsesForIndex(IndexConfigTypeEnum.INDEX_GOODS_HOT.getType(), Constants.INDEX_GOODS_HOT_NUMBER);
List<NewBeeMallIndexConfigGoodsVO> newGoodses = newBeeMallIndexConfigService.getConfigGoodsesForIndex(IndexConfigTypeEnum.INDEX_GOODS_NEW.getType(), Constants.INDEX_GOODS_NEW_NUMBER);
List<NewBeeMallIndexConfigGoodsVO> recommendGoodses = newBeeMallIndexConfigService.getConfigGoodsesForIndex(IndexConfigTypeEnum.INDEX_GOODS_RECOMMOND.getType(), Constants.INDEX_GOODS_RECOMMOND_NUMBER);
if (!CollectionUtils.isEmpty(recommendGoodses)) {
NewBeeMallUserVO user = (NewBeeMallUserVO) httpSession.getAttribute(Constants.MALL_USER_SESSION_KEY);
if (null != user) {
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT k.goods_name `name`,m.goods_category_id fenlei,count(1) `value` from tb_newbee_mall_order t \n" +
"LEFT JOIN tb_newbee_mall_user p ON t.user_id=p.user_id \n" +
"LEFT JOIN tb_newbee_mall_order_item k ON t.order_id=k.order_id\n" +
"LEFT JOIN tb_newbee_mall_goods_info m ON m.goods_id = k.goods_id\n" +
"WHERE t.user_id=? AND !ISNULL(k.goods_name) GROUP BY k.goods_name ORDER BY `value` DESC LIMIT 1", user.getUserId());
if (!CollectionUtils.isEmpty(maps)) {
List<Map<String, Object>> records = jdbcTemplate.queryForList("SELECT p.nick_name `type`,GROUP_CONCAT(k.goods_name, '|') `name`, GROUP_CONCAT(DISTINCT k.goods_category_id) fenlei FROM tb_newbee_mall_order t \n" +
"LEFT JOIN tb_newbee_mall_user p ON t.user_id=p.user_id\n" +
"LEFT JOIN tb_newbee_mall_order_item l ON t.order_id=l.order_id\n" +
"LEFT JOIN tb_newbee_mall_goods_info k ON k.goods_id = l.goods_id GROUP BY p.nick_name");
List<TuijianPair<String, List<String>>> userInfos = new ArrayList<>();
if (!CollectionUtils.isEmpty(records)) {
for (Map<String, Object> record : records) {
String cname = String.valueOf(record.get("name"));
List<String> goods = Arrays.asList(cname.split("\\|"));
userInfos.add(new TuijianPair<>(String.valueOf(record.get("type")), goods));
}
}
List<TuijianPair<String, Double>> gPairs = TuijianCollFilter.xietongguolvMovietuijian(userInfos, user.getNickName());
System.out.println(gPairs);
if (!CollectionUtils.isEmpty(gPairs)) {
List<TuijianPair<String, Double>> collect = gPairs.stream().filter(m -> m.getValue() > 0).collect(Collectors.toList());
collect.sort(new Comparator<TuijianPair<String, Double>>() {
@Override
public int compare(TuijianPair<String, Double> o1, TuijianPair<String, Double> o2) {
return (int) (o1.getValue() - o2.getValue());
}
});
Map<String, Object> params = new HashMap<>();
params.put("limit", 10);
params.put("page", 1);
String key = collect.get(0).getKey();
params.put("keyword", key.startsWith(",") ? key.substring(1) : key);
Map<String, Object> cmap = maps.get(0);
params.put("goodsCategoryId", cmap.get("fenlei"));
PageQueryUtil pageUtil = new PageQueryUtil(params);
PageResult pageResult = newBeeMallGoodsService.tuijianSearchMallGoodsList(pageUtil);
List<NewBeeMallSearchGoodsVO> list1 = (List<NewBeeMallSearchGoodsVO>) pageResult.getList();
List<NewBeeMallIndexConfigGoodsVO> rmgoods = new ArrayList<>();
if (!CollectionUtils.isEmpty(list1)) {
for (int i = 0; i < list1.size(); i++) {
NewBeeMallIndexConfigGoodsVO v = new NewBeeMallIndexConfigGoodsVO();
NewBeeMallSearchGoodsVO goodsVO = list1.get(i);
v.setGoodsId(goodsVO.getGoodsId());
v.setGoodsIntro(goodsVO.getGoodsIntro());
v.setGoodsCoverImg(goodsVO.getGoodsCoverImg());
v.setGoodsName(goodsVO.getGoodsName());
v.setSellingPrice(goodsVO.getSellingPrice());
rmgoods.add(v);
}
}
if (!CollectionUtils.isEmpty(rmgoods)) {
if (rmgoods.size() >= 10) {
recommendGoodses = rmgoods;
} else {
List<NewBeeMallIndexConfigGoodsVO> hbgoods = recommendGoodses.subList(0, 10 - rmgoods.size());
rmgoods.addAll(hbgoods);
recommendGoodses = rmgoods;
}
}
}
}
} else {
Collections.shuffle(recommendGoodses);
}
}
request.setAttribute("categories", categories);//分类数据
request.setAttribute("carousels", carousels);//轮播图
request.setAttribute("hotGoodses", hotGoodses);//热销商品
request.setAttribute("newGoodses", newGoodses);//新品
request.setAttribute("recommendGoodses", recommendGoodses);//推荐商品
return "mall/index";
}
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。