SSM+Vue+Element-UI实现校园短期闲置资源置换平台

文末获取源码

开发语言:Java
框架:SSM
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7/8.0
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器

一、前言介绍 

校园短期闲置资源置换平台是校园短期闲置资源置换必不可少的一个部分。在校园短期闲置资源置换的整个过程中,校园短期闲置资源置换平台担负着最重要的角色。为满足如今日益复杂的管理需求,各类校园短期闲置资源置换管理程序也在不断改进。本课题所设计的校园短期闲置资源置换平台,使用java技术进行开发,它的优点代码不能从浏览器查看,保密性非常好,比其他的系统更具安全性。java还容易修改和调试,毕竟商家是在不断发展过程中,难免有更多需求,这点很重要。而且,本系统对校园短期闲置资源置换的管理,是为了满足更深层次的需求。除了上述优势外,本系统还具有查询迅速,搜索资料方便,可靠性强等特点。 

二、系统功能分析

考虑到实际生活中校园短期闲置资源置换管理方面的需要以及对该平台认真地分析,将系统权限按管理员,置换账户和用户这三类涉及用户划分。

(a)管理员;管理员使用本系统涉到的功能主要有:首页,个人中心,用户管理,置换账户管理,商品分类管理,置换商品管理,置换订单管理,交流论坛,系统管理等功能。管理员用例图如图 

(b)置换账户;进入系统可以实现首页,个人中心,置换商品管理,置换订单管理等功能。置换账户用例图如图

(c)用户;进入系统可以实现首页,个人中心,置换订单管理等功能。用户用例图如图系统整体功能图 

三、系统展示

首页

校园短期闲置资源转换平台,在平台首页可以查看首页,置换商品,交流论坛,公告信息,个人中心,后台管理,在线客服等内容,并进行详细操作;如图

用户注册

在用户注册页面通过填写用户账号,密码,再次输入密码, 用户姓名,联系方式等信息进行注册操作,如图 

用户登录

置换商品

在置换商品页面可以查看商品名称,商品分类,成色,品牌,置换账号,置换姓名,联系电话,点击次数等内容,并进行申请置换,评论和收藏操作,如图 

交流论坛

在交流论坛页面可以查看帖子标题,发布人,发布时间,帖子内容等信息并进行评论操作,如图 

个人中心

在个人中心页面通过填写用户账号,密码,用户姓名,上传图片,性别,联系方式等内容进行更新信息,还可以根据需要对我的发布,我的收藏进行相对应操作,如图

管理员功能模块

管理员进行登录,进入系统前在登录页面根据要求填写用户名和密码,选择角色等信息,点击登录进行登录操作,如图

管理员登录系统后,可以对首页,个人中心,用户管理,置换账户管理,商品分类管理,置换商品管理,置换订单管理,交流论坛,系统管理等功能进行相应的操作管理,如图 

用户管理

在用户管理页面可以对索引,用户账号,用户姓名,照片,性别,联系方式等内容进行详情,修改和删除等操作,如图 

置换账户管理

在置换账户管理页面可以对索引,置换账号,置换姓名,照片,性别,联系电话等内容进行详情,修改和删除等操作,如图 

商品分类管理

在商品分类管理页面可以对索引, 商品分类等内容进行详情,修改和删除等操作,如图置换商品管理

在置换商品管理页面可以对索引,商品名称,图片,商品分类,成色,品牌,置换账号,置换姓名,联系电话等内容进行详情,修改,查看评论和删除等操作,如图 

置换订单管理

在置换订单管理页面可以对索引,置换编号,商品名称,品牌,置换账号,联系电话,置换物品,物品图片,物品品牌,物品成色,交换地址,用户账号,用户姓名,联系方式,审核回复,审核状态等内容进行详情,修改和删除操作,如图 

交流论坛

在交流论坛页面可以对索引,帖子标题,用户名,状态等内容进行详情,修改,查看评论和删除等操作,如图 

系统管理

在公告信息页面可以对索引,标题,图片等内容进行详情,修改和删除操作,还可以对在线客服,轮播图管理进行详细操作,如图 

用户功能模块

用户登录进入校园短期闲置资源转换平台可以对首页,个人中心,置换订单管理等功能进行相应操作,如图 

置换订单管理

在置换订单管理页面可以对索引,置换编号,商品名称,品牌,置换账号,联系电话,置换物品,物品图片,物品品牌,物品成色,交换地址,用户账号,用户姓名,联系方式,审核回复,审核状态等内容进行详情和删除操作,如图 

置换账户功能模块

置换账户登录进入校园短期闲置资源转换平台可以对首页,个人中心,置换商品管理,置换订单管理等功能进行相应操作,如图 

置换商品管理

在置换商品管理页面可以对索引,商品名称,图片,商品分类,成色,品牌,置换账号,置换姓名,联系电话等内容进行详情,修改,查看评论和删除等操作,如图 

置换订单管理

在置换订单管理页面可以对索引,置换编号,商品名称,品牌,置换账号,联系电话,置换物品,物品图片,物品品牌,物品成色,交换地址,用户账号,用户姓名,联系方式,审核回复,审核状态,审核等内容进行详情和删除操作,如图 

部分核心代码

用户登录

/**
	 * 登录
	 */
	@IgnoreAuth
	@RequestMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
		if(user==null || !user.getMima().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(), username,"yonghu",  "用户" );
		return R.ok().put("token", token);
	}

用户注册

/**
     * 注册
     */
	@IgnoreAuth
    @RequestMapping("/register")
    public R register(@RequestBody YonghuEntity yonghu){
    	//ValidatorUtils.validateEntity(yonghu);
    	YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
		if(user!=null) {
			return R.error("注册用户已存在");
		}
		Long uId = new Date().getTime();
		yonghu.setId(uId);
        yonghuService.insert(yonghu);
        return R.ok();
    }

上传文件

/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName);
		file.transferTo(dest);
		/**
 		 * 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开
  		 * 请将以下的"D:\\ssmpiv99\\src\\main\\webapp\\upload"替换成你本地项目的upload路径,
 		 * 并且项目路径不能存在中文、空格等特殊字符
 		 */
//		FileUtils.copyFile(dest, new File("D:\\ssmpiv99\\src\\main\\webapp\\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);
	}

置换商品

/**
 * 置换商品
 * 后端接口
 * @author 
 * @email 
 * @date 2022-04-25 17:05:25
 */
@RestController
@RequestMapping("/zhihuanshangpin")
public class ZhihuanshangpinController {
    @Autowired
    private ZhihuanshangpinService zhihuanshangpinService;


    @Autowired
    private StoreupService storeupService;

    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,ZhihuanshangpinEntity zhihuanshangpin, 
		HttpServletRequest request){

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("zhihuanzhanghu")) {
			zhihuanshangpin.setZhihuanzhanghao((String)request.getSession().getAttribute("username"));
		}
        EntityWrapper<ZhihuanshangpinEntity> ew = new EntityWrapper<ZhihuanshangpinEntity>();
		PageUtils page = zhihuanshangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zhihuanshangpin), params), params));
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,ZhihuanshangpinEntity zhihuanshangpin, 
		HttpServletRequest request){
        EntityWrapper<ZhihuanshangpinEntity> ew = new EntityWrapper<ZhihuanshangpinEntity>();
		PageUtils page = zhihuanshangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zhihuanshangpin), params), params));
        return R.ok().put("data", page);
    }

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

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(ZhihuanshangpinEntity zhihuanshangpin){
        EntityWrapper< ZhihuanshangpinEntity> ew = new EntityWrapper< ZhihuanshangpinEntity>();
 		ew.allEq(MPUtil.allEQMapPre( zhihuanshangpin, "zhihuanshangpin")); 
		ZhihuanshangpinView zhihuanshangpinView =  zhihuanshangpinService.selectView(ew);
		return R.ok("查询置换商品成功").put("data", zhihuanshangpinView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        ZhihuanshangpinEntity zhihuanshangpin = zhihuanshangpinService.selectById(id);
		zhihuanshangpin.setClicknum(zhihuanshangpin.getClicknum()+1);
		zhihuanshangpin.setClicktime(new Date());
		zhihuanshangpinService.updateById(zhihuanshangpin);
        return R.ok().put("data", zhihuanshangpin);
    }

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



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ZhihuanshangpinEntity zhihuanshangpin, HttpServletRequest request){
    	zhihuanshangpin.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(zhihuanshangpin);

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

        zhihuanshangpinService.insert(zhihuanshangpin);
        return R.ok();
    }

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

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        zhihuanshangpinService.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<ZhihuanshangpinEntity> wrapper = new EntityWrapper<ZhihuanshangpinEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("zhihuanzhanghu")) {
			wrapper.eq("zhihuanzhanghao", (String)request.getSession().getAttribute("username"));
		}

		int count = zhihuanshangpinService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	
	/**
     * 前端智能排序
     */
	@IgnoreAuth
    @RequestMapping("/autoSort")
    public R autoSort(@RequestParam Map<String, Object> params,ZhihuanshangpinEntity zhihuanshangpin, HttpServletRequest request,String pre){
        EntityWrapper<ZhihuanshangpinEntity> ew = new EntityWrapper<ZhihuanshangpinEntity>();
        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 = zhihuanshangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zhihuanshangpin), params), params));
        return R.ok().put("data", page);
    }

协同算法(按收藏推荐)

  /**
     * 协同算法(按收藏推荐)
     */
    @RequestMapping("/autoSort2")
    public R autoSort2(@RequestParam Map<String, Object> params,ZhihuanshangpinEntity zhihuanshangpin, HttpServletRequest request){
        String userId = request.getSession().getAttribute("userId").toString();
        String inteltypeColumn = "shangpinfenlei";
        List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "zhihuanshangpin").orderBy("addtime", false));
        List<String> inteltypes = new ArrayList<String>();
        Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
        List<ZhihuanshangpinEntity> zhihuanshangpinList = new ArrayList<ZhihuanshangpinEntity>();
        //去重
        if(storeups!=null && storeups.size()>0) {
            for(StoreupEntity s : storeups) {
                zhihuanshangpinList.addAll(zhihuanshangpinService.selectList(new EntityWrapper<ZhihuanshangpinEntity>().eq(inteltypeColumn, s.getInteltype())));
            }
        }
        EntityWrapper<ZhihuanshangpinEntity> ew = new EntityWrapper<ZhihuanshangpinEntity>();
        params.put("sort", "id");
        params.put("order", "desc");
        PageUtils page = zhihuanshangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zhihuanshangpin), params), params));
        List<ZhihuanshangpinEntity> pageList = (List<ZhihuanshangpinEntity>)page.getList();
        if(zhihuanshangpinList.size()<limit) {
            int toAddNum = (limit-zhihuanshangpinList.size())<=pageList.size()?(limit-zhihuanshangpinList.size()):pageList.size();
            for(ZhihuanshangpinEntity o1 : pageList) {
                boolean addFlag = true;
                for(ZhihuanshangpinEntity o2 : zhihuanshangpinList) {
                    if(o1.getId().intValue()==o2.getId().intValue()) {
                        addFlag = false;
                        break;
                    }
                }
                if(addFlag) {
                    zhihuanshangpinList.add(o1);
                    if(--toAddNum==0) break;
                }
            }
        } else if(zhihuanshangpinList.size()>limit) {
            zhihuanshangpinList = zhihuanshangpinList.subList(0, limit);
        }
        page.setList(zhihuanshangpinList);
        return R.ok().put("data", page);
    }





}

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

一季春秋

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

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

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

打赏作者

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

抵扣说明:

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

余额充值