SpringBoot+Vue+Element-UI实现家具商城系统

文末获取源码

开发语言:Java

框架:springboot

JDK版本:JDK1.8

服务器:tomcat7

数据库:mysql 5.7/8.0

数据库工具:Navicat11

开发软件:eclipse/myeclipse/idea

Maven包:Maven3.3.9

浏览器:谷歌浏览器

前言介绍 

社会的发展和科学技术的进步,互联网技术越来越受欢迎。网络计算机的交易方式逐渐受到广大人民群众的喜爱,也逐渐进入了每个用户的使用。互联网具有便利性,速度快,效率高,成本低等优点。 因此,构建符合自己要求的操作系统是非常有意义的。

本文从管理员、用户的功能要求出发,家具商城系统中的功能模块主要是实现管理员;首页、个人中心、用户管理、家具类型管理、家具信息管理、系统管理、订单管理,用户:首页、个人中心。前台首页:首页、家具信息、公告信息、个人中心、后台管理、购物车。

经过认真细致的研究,精心准备和规划,最后测试成功,系统可以正常使用。分析功能调整与家具商城系统实现的实际需求相结合,讨论了Java开发家具商城系统的使用。

系统功能设计

软件的用户界面是最直接接触的对象,包括是否允许用户使用简单方便,请求的响应时间,主图像的整体质量,整体布局的质量。

家具销售电商平台的设计基于现有的网络平台,可以实现用户管理及数据信息管理,方便管理员对后台进行管理有详细的了解及统计分析,随时查看信息状态。 

系统功能设计是在系统开发和设计思想的总体任务的基础上完成的。该系统的主要任务是实现家具销售电商平台管理,使用户可以通过指令完成整个家具销售电商平台的操作。

从上面的描述中可以基本可以实现软件的功能:

1、开发实现家具销售电商平台的整个系统程序; 

2、管理员;首页、个人中心、用户管理、家具类型管理、家具信息管理、系统管理、订单管理等。

3、用户:首页、个人中心。

4、前台首页:首页、家具信息、公告信息、个人中心、后台管理、购物车等相应操作;

5、基础数据管理:实现系统基本信息的添加、修改及删除等操作,并且根据需求进行交流信息的查看及回复相应操作。

系统展示 

首页

家具信息

个人中心

购物车

管理员页面 

用户管理

家具类型管理

家具信息管理

系统管理

部分核心代码

家具信息

@RestController
@RequestMapping("/jiajuxinxi")
public class JiajuxinxiController {
    @Autowired
    private JiajuxinxiService jiajuxinxiService;

    @Autowired
    private StoreupService storeupService;

    @Autowired
    private OrdersService ordersService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,JiajuxinxiEntity jiajuxinxi,
		HttpServletRequest request){
        EntityWrapper<JiajuxinxiEntity> ew = new EntityWrapper<JiajuxinxiEntity>();
		PageUtils page = jiajuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiajuxinxi), params), params));

        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,JiajuxinxiEntity jiajuxinxi, 
		HttpServletRequest request){
        EntityWrapper<JiajuxinxiEntity> ew = new EntityWrapper<JiajuxinxiEntity>();
		PageUtils page = jiajuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiajuxinxi), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( JiajuxinxiEntity jiajuxinxi){
       	EntityWrapper<JiajuxinxiEntity> ew = new EntityWrapper<JiajuxinxiEntity>();
      	ew.allEq(MPUtil.allEQMapPre( jiajuxinxi, "jiajuxinxi")); 
        return R.ok().put("data", jiajuxinxiService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(JiajuxinxiEntity jiajuxinxi){
        EntityWrapper< JiajuxinxiEntity> ew = new EntityWrapper< JiajuxinxiEntity>();
 		ew.allEq(MPUtil.allEQMapPre( jiajuxinxi, "jiajuxinxi")); 
		JiajuxinxiView jiajuxinxiView =  jiajuxinxiService.selectView(ew);
		return R.ok("查询家具信息成功").put("data", jiajuxinxiView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        JiajuxinxiEntity jiajuxinxi = jiajuxinxiService.selectById(id);
		jiajuxinxi.setClicknum(jiajuxinxi.getClicknum()+1);
		jiajuxinxi.setClicktime(new Date());
		jiajuxinxiService.updateById(jiajuxinxi);
        return R.ok().put("data", jiajuxinxi);
    }

    /**
     * 前端详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        JiajuxinxiEntity jiajuxinxi = jiajuxinxiService.selectById(id);
		jiajuxinxi.setClicknum(jiajuxinxi.getClicknum()+1);
		jiajuxinxi.setClicktime(new Date());
		jiajuxinxiService.updateById(jiajuxinxi);
        return R.ok().put("data", jiajuxinxi);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody JiajuxinxiEntity jiajuxinxi, HttpServletRequest request){
    	jiajuxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(jiajuxinxi);
        jiajuxinxiService.insert(jiajuxinxi);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody JiajuxinxiEntity jiajuxinxi, HttpServletRequest request){
    	jiajuxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(jiajuxinxi);
        jiajuxinxiService.insert(jiajuxinxi);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody JiajuxinxiEntity jiajuxinxi, HttpServletRequest request){
        //ValidatorUtils.validateEntity(jiajuxinxi);
        jiajuxinxiService.updateById(jiajuxinxi);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        jiajuxinxiService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    /**
     * 提醒接口
     */
	@RequestMapping("/remind/{columnName}/{type}")
	public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		Wrapper<JiajuxinxiEntity> wrapper = new EntityWrapper<JiajuxinxiEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}


		int count = jiajuxinxiService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	
	/**
     * 前端智能排序
     */
	@IgnoreAuth
    @RequestMapping("/autoSort")
    public R autoSort(@RequestParam Map<String, Object> params,JiajuxinxiEntity jiajuxinxi, HttpServletRequest request,String pre){
        EntityWrapper<JiajuxinxiEntity> ew = new EntityWrapper<JiajuxinxiEntity>();
        Map<String, Object> newMap = new HashMap<String, Object>();
        Map<String, Object> param = new HashMap<String, Object>();
		Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry<String, Object> entry = it.next();
			String key = entry.getKey();
			String newKey = entry.getKey();
			if (pre.endsWith(".")) {
				newMap.put(pre + newKey, entry.getValue());
			} else if (StringUtils.isEmpty(pre)) {
				newMap.put(newKey, entry.getValue());
			} else {
				newMap.put(pre + "." + newKey, entry.getValue());
			}
		}
		params.put("sort", "clicknum");
        params.put("order", "desc");
		PageUtils page = jiajuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiajuxinxi), params), params));
        return R.ok().put("data", page);
    }


        /**
     * 协同算法(按用户购买推荐)
     */
    @RequestMapping("/autoSort2")
    public R autoSort2(@RequestParam Map<String, Object> params,JiajuxinxiEntity jiajuxinxi, HttpServletRequest request){
        String userId = request.getSession().getAttribute("userId").toString();
        String goodtypeColumn = "jiajuleixing";
        List<OrdersEntity> orders = ordersService.selectList(new EntityWrapper<OrdersEntity>().eq("userid", userId).eq("tablename", "jiajuxinxi").orderBy("addtime", false));
        List<String> goodtypes = new ArrayList<String>();
        Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
        List<JiajuxinxiEntity> jiajuxinxiList = new ArrayList<JiajuxinxiEntity>();
	//去重
    	List<OrdersEntity> ordersDist = new ArrayList<OrdersEntity>();
    	for(OrdersEntity o1 : orders) {
    		boolean addFlag = true;
    		for(OrdersEntity o2 : ordersDist) {
    			if(o1.getGoodid()==o2.getGoodid() || o1.getGoodtype().equals(o2.getGoodtype())) {
    				addFlag = false;
    				break;
    			}
    		}
    		if(addFlag) ordersDist.add(o1);
    	}
        if(ordersDist!=null && ordersDist.size()>0) {
                for(OrdersEntity o : ordersDist) {
                        jiajuxinxiList.addAll(jiajuxinxiService.selectList(new EntityWrapper<JiajuxinxiEntity>().eq(goodtypeColumn, o.getGoodtype())));
                }
        }
        EntityWrapper<JiajuxinxiEntity> ew = new EntityWrapper<JiajuxinxiEntity>();
        params.put("sort", "id");
        params.put("order", "desc");
        PageUtils page = jiajuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiajuxinxi), params), params));
        List<JiajuxinxiEntity> pageList = (List<JiajuxinxiEntity>)page.getList();
        if(jiajuxinxiList.size()<limit) {
                int toAddNum = (limit-jiajuxinxiList.size())<=pageList.size()?(limit-jiajuxinxiList.size()):pageList.size();
                for(JiajuxinxiEntity o1 : pageList) {
                    boolean addFlag = true;
                    for(JiajuxinxiEntity o2 : jiajuxinxiList) {
                        if(o1.getId().intValue()==o2.getId().intValue()) {
                            addFlag = false;
                            break;
                        }
                    }
                    if(addFlag) {
                        jiajuxinxiList.add(o1);
                        if(--toAddNum==0) break;
                    }   
                }
        }
        page.setList(jiajuxinxiList);
        return R.ok().put("data", page);
    }





}

协同算法(按用户购买推荐)

 @RequestMapping("/autoSort2")
    public R autoSort2(@RequestParam Map<String, Object> params,JiajuxinxiEntity jiajuxinxi, HttpServletRequest request){
        String userId = request.getSession().getAttribute("userId").toString();
        String goodtypeColumn = "jiajuleixing";
        List<OrdersEntity> orders = ordersService.selectList(new EntityWrapper<OrdersEntity>().eq("userid", userId).eq("tablename", "jiajuxinxi").orderBy("addtime", false));
        List<String> goodtypes = new ArrayList<String>();
        Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
        List<JiajuxinxiEntity> jiajuxinxiList = new ArrayList<JiajuxinxiEntity>();
	//去重
    	List<OrdersEntity> ordersDist = new ArrayList<OrdersEntity>();
    	for(OrdersEntity o1 : orders) {
    		boolean addFlag = true;
    		for(OrdersEntity o2 : ordersDist) {
    			if(o1.getGoodid()==o2.getGoodid() || o1.getGoodtype().equals(o2.getGoodtype())) {
    				addFlag = false;
    				break;
    			}
    		}
    		if(addFlag) ordersDist.add(o1);
    	}
        if(ordersDist!=null && ordersDist.size()>0) {
                for(OrdersEntity o : ordersDist) {
                        jiajuxinxiList.addAll(jiajuxinxiService.selectList(new EntityWrapper<JiajuxinxiEntity>().eq(goodtypeColumn, o.getGoodtype())));
                }
        }
        EntityWrapper<JiajuxinxiEntity> ew = new EntityWrapper<JiajuxinxiEntity>();
        params.put("sort", "id");
        params.put("order", "desc");
        PageUtils page = jiajuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiajuxinxi), params), params));
        List<JiajuxinxiEntity> pageList = (List<JiajuxinxiEntity>)page.getList();
        if(jiajuxinxiList.size()<limit) {
                int toAddNum = (limit-jiajuxinxiList.size())<=pageList.size()?(limit-jiajuxinxiList.size()):pageList.size();
                for(JiajuxinxiEntity o1 : pageList) {
                    boolean addFlag = true;
                    for(JiajuxinxiEntity o2 : jiajuxinxiList) {
                        if(o1.getId().intValue()==o2.getId().intValue()) {
                            addFlag = false;
                            break;
                        }
                    }
                    if(addFlag) {
                        jiajuxinxiList.add(o1);
                        if(--toAddNum==0) break;
                    }   
                }
        }
        page.setList(jiajuxinxiList);
        return R.ok().put("data", page);
    }





}

上传文件

@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		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(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		/**
  		 * 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开
   		 * 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径,
 		 * 并且项目路径不能存在中文、空格等特殊字符
 		 */
//		FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\src\\main\\resources\\static\\upload"+"/"+fileName)); /**修改了路径以后请将该行最前面的//注释去掉**/
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

一季春秋

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

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

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

打赏作者

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

抵扣说明:

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

余额充值