前言介绍
在社会快速发展的影响下,使校园二手交易系统的管理和运营比过去十年更加理性化。依照这一现实为基础,设计一个快捷而又方便的网上校园二手交易系统是一项十分重要并且有价值的事情。对于传统的管理控制模型来说,网上校园二手交易系统具有许多不可比拟的优势,首先是快速更新校园二手交易系统的信息,其次是大量信息的管理,最后是高度安全,以及使用简单等特性,这使得校园二手交易系统的管理和运营非常方便。进入21世纪,因为科技和经济的迅速发展,人民群众对非物质层面的精神需求正变得越来越多元化。本系统是为了实现这些目标而提出来的。
本论文系统地描绘了整个网上校园二手交易系统的设计与实现,主要实现的功能有以下几点:
(1)管理员;个人中心、学号管理、卖家管理、二手商品管理、求购信息管理、商品分类管理、用户警告管理、卖家警告管理、信誉评价管理、卖家沟通管理、用户沟通管理、交流论坛、系统管理;
(2)学生;个人中心、求购信息管理、用户警告管理、信誉评价管理、卖家沟通管理、用户沟通管理;
(3)卖家;个人中心、二手商品管理、求购信息管理、卖家警告管理、信誉评价管理、卖家沟通管理、用户沟通管理、订单管理;
(4)前台;首页、二手商品、求购信息、交流论坛、公告信息、个人中心、后台管理、购物车、售后客服等功能,其具有简单的接口,方便的应用,强大的互动,完全基于互联网的特点。
系统需求分析
园二手交易系统需要满足的需求有以下几个:
(1)实现管理系统信息关系的系统化、规范化和自动化;
(2)减少维护人员的工作量以及实现用户对信息的控制和管理。
(3)方便查询信息及管理信息等;
(4)通过网络操作,改善处理问题的效率,提高操作人员利用率;
(5)考虑到用户多样性特点,要求界面简单,操作简便。
系统展示
前台页面
首页
二手商品
求购信息
系统登录注册
管理员功能模块
二手商品管理
卖家功能模块
学生功能模块
部分核心代码
购物车
/**
* 购物车表
* 后端接口
* @author
* @email
* @date 2022-03-27 20:20:44
*/
@RestController
@RequestMapping("/cart")
public class CartController {
@Autowired
private CartService cartService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,CartEntity cart,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
cart.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();
PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,CartEntity cart,
HttpServletRequest request){
EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();
PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( CartEntity cart){
EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();
ew.allEq(MPUtil.allEQMapPre( cart, "cart"));
return R.ok().put("data", cartService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(CartEntity cart){
EntityWrapper< CartEntity> ew = new EntityWrapper< CartEntity>();
ew.allEq(MPUtil.allEQMapPre( cart, "cart"));
CartView cartView = cartService.selectView(ew);
return R.ok("查询购物车表成功").put("data", cartView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
CartEntity cart = cartService.selectById(id);
return R.ok().put("data", cart);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
CartEntity cart = cartService.selectById(id);
return R.ok().put("data", cart);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody CartEntity cart, HttpServletRequest request){
cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(cart);
cart.setUserid((Long)request.getSession().getAttribute("userId"));
cartService.insert(cart);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody CartEntity cart, HttpServletRequest request){
cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(cart);
cartService.insert(cart);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody CartEntity cart, HttpServletRequest request){
//ValidatorUtils.validateEntity(cart);
cartService.updateById(cart);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
cartService.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<CartEntity> wrapper = new EntityWrapper<CartEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));
}
int count = cartService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
二手商品
/**
* 二手商品
* 后端接口
* @author
* @email
* @date 2022-03-27 20:20:43
*/
@RestController
@RequestMapping("/ershoushangpin")
public class ErshoushangpinController {
@Autowired
private ErshoushangpinService ershoushangpinService;
@Autowired
private StoreupService storeupService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ErshoushangpinEntity ershoushangpin,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("maijia")) {
ershoushangpin.setMaijiazhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<ErshoushangpinEntity> ew = new EntityWrapper<ErshoushangpinEntity>();
PageUtils page = ershoushangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ershoushangpin), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ErshoushangpinEntity ershoushangpin,
HttpServletRequest request){
EntityWrapper<ErshoushangpinEntity> ew = new EntityWrapper<ErshoushangpinEntity>();
PageUtils page = ershoushangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ershoushangpin), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ErshoushangpinEntity ershoushangpin){
EntityWrapper<ErshoushangpinEntity> ew = new EntityWrapper<ErshoushangpinEntity>();
ew.allEq(MPUtil.allEQMapPre( ershoushangpin, "ershoushangpin"));
return R.ok().put("data", ershoushangpinService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ErshoushangpinEntity ershoushangpin){
EntityWrapper< ErshoushangpinEntity> ew = new EntityWrapper< ErshoushangpinEntity>();
ew.allEq(MPUtil.allEQMapPre( ershoushangpin, "ershoushangpin"));
ErshoushangpinView ershoushangpinView = ershoushangpinService.selectView(ew);
return R.ok("查询二手商品成功").put("data", ershoushangpinView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ErshoushangpinEntity ershoushangpin = ershoushangpinService.selectById(id);
ershoushangpin.setClicknum(ershoushangpin.getClicknum()+1);
ershoushangpin.setClicktime(new Date());
ershoushangpinService.updateById(ershoushangpin);
return R.ok().put("data", ershoushangpin);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ErshoushangpinEntity ershoushangpin = ershoushangpinService.selectById(id);
ershoushangpin.setClicknum(ershoushangpin.getClicknum()+1);
ershoushangpin.setClicktime(new Date());
ershoushangpinService.updateById(ershoushangpin);
return R.ok().put("data", ershoushangpin);
}
/**
* 赞或踩
*/
@RequestMapping("/thumbsup/{id}")
public R vote(@PathVariable("id") String id,String type){
ErshoushangpinEntity ershoushangpin = ershoushangpinService.selectById(id);
if(type.equals("1")) {
ershoushangpin.setThumbsupnum(ershoushangpin.getThumbsupnum()+1);
} else {
ershoushangpin.setCrazilynum(ershoushangpin.getCrazilynum()+1);
}
ershoushangpinService.updateById(ershoushangpin);
return R.ok("投票成功");
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ErshoushangpinEntity ershoushangpin, HttpServletRequest request){
ershoushangpin.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(ershoushangpin);
ershoushangpinService.insert(ershoushangpin);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ErshoushangpinEntity ershoushangpin, HttpServletRequest request){
ershoushangpin.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(ershoushangpin);
ershoushangpinService.insert(ershoushangpin);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ErshoushangpinEntity ershoushangpin, HttpServletRequest request){
//ValidatorUtils.validateEntity(ershoushangpin);
ershoushangpinService.updateById(ershoushangpin);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
ershoushangpinService.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<ErshoushangpinEntity> wrapper = new EntityWrapper<ErshoushangpinEntity>();
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("maijia")) {
wrapper.eq("maijiazhanghao", (String)request.getSession().getAttribute("username"));
}
int count = ershoushangpinService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,ErshoushangpinEntity ershoushangpin, HttpServletRequest request,String pre){
EntityWrapper<ErshoushangpinEntity> ew = new EntityWrapper<ErshoushangpinEntity>();
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 = ershoushangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ershoushangpin), params), params));
return R.ok().put("data", page);
}
}
此源码非开源,若需要此源码可扫码添加微信或者qq:2214904953进行咨询!
2600多套项目欢迎咨询