环境:开发工具:idea,数据库:MySQL5.7 jdk1.8
架构:SpringBoot,前端HTML
主要功能
前台商城系统包含首页门户、商品分类、新品上线、首页轮播、商品推荐、商品搜索、商品展示、购物车、订单结算、订单流程、个人订单管理、会员中心、帮助中心等模块。
后台管理系统包含数据面板、轮播图管理、商品管理、订单管理、会员管理、分类管理、设置等模块。
项目图片:
部分代码:
public List<NewBeeMallIndexConfigGoodsVO> recommendGoods(String userId){
List<NewBeeMallIndexConfigGoodsVO> recommendGoods = new ArrayList<>();
//协同过滤算法
CoreMath coreMath = new CoreMath();
//获取商品数据
List<RelateDTO> relateDTOList = getRelateData();
//执行算法,返回推荐商品id
List<Integer> recommendIdLists = coreMath.recommend(Integer.parseInt(userId), relateDTOList);
if(null == recommendIdLists || recommendIdLists.isEmpty()){
recommendGoods = null;
}else {
//获取商品DTO(这里的过滤是防止商品表该id商品已下架或删除)
List<ProductDTO> productDTOList = getProductData().stream().filter(e -> recommendIdLists.contains(e.getProductId())).collect(Collectors.toList());
//获取商品ids
List<Integer> goodIds = productDTOList.stream().map(e -> e.getProductId()).collect(Collectors.toList());
List<Long> goodIds2 = JSONArray.parseArray(goodIds.toString(), Long.class);
//获取所有推荐商品
List<NewBeeMallGoods> newBeeMallGoods = newBeeMallGoodsMapper.selectByGoodIds(goodIds2);
//截取10个
if (newBeeMallGoods.size() > 10) {
newBeeMallGoods = newBeeMallGoods.stream().limit(10).collect(Collectors.toList());
}
//转成VOs
recommendGoods = BeanUtil.copyList(newBeeMallGoods, NewBeeMallIndexConfigGoodsVO.class);
//截取商品名字
for (NewBeeMallIndexConfigGoodsVO newBeeMallIndexConfigGoodsVO : recommendGoods) {
String goodsName = newBeeMallIndexConfigGoodsVO.getGoodsName();
String goodsIntro = newBeeMallIndexConfigGoodsVO.getGoodsIntro();
// 字符串过长导致文字超出的问题
if (goodsName.length() > 30) {
goodsName = goodsName.substring(0, 15) + "...";
newBeeMallIndexConfigGoodsVO.setGoodsName(goodsName);
}
if (goodsIntro.length() > 22) {
goodsIntro = goodsIntro.substring(0, 22) + "...";
newBeeMallIndexConfigGoodsVO.setGoodsIntro(goodsIntro);
}
}
}
return recommendGoods;
}
获取方式:联系下方名片获取