• Spring+SpringMVC+Jsp实现校园二手交易系统


    文末获取源码 

    开发语言:Java

    框架:SSM

    技术:Jsp

    JDK版本:JDK1.8

    服务器:tomcat7

    数据库:mysql 5.7/8.0

    数据库工具:Navicat11

    开发软件:eclipse/myeclipse/idea

    Maven包:Maven3.3.9

    浏览器:谷歌浏览器

    前言介绍 

    在社会快速发展的影响下,使校园二手交易系统的管理和运营比过去十年更加理性化。依照这一现实为基础,设计一个快捷而又方便的网上校园二手交易系统是一项十分重要并且有价值的事情。对于传统的管理控制模型来说,网上校园二手交易系统具有许多不可比拟的优势,首先是快速更新校园二手交易系统的信息,其次是大量信息的管理,最后是高度安全,以及使用简单等特性,这使得校园二手交易系统的管理和运营非常方便。进入21世纪,因为科技和经济的迅速发展,人民群众对非物质层面的精神需求正变得越来越多元化。本系统是为了实现这些目标而提出来的。

    本论文系统地描绘了整个网上校园二手交易系统的设计与实现,主要实现的功能有以下几点:

    (1)管理员;个人中心、学号管理、卖家管理、二手商品管理、求购信息管理、商品分类管理、用户警告管理、卖家警告管理、信誉评价管理、卖家沟通管理、用户沟通管理、交流论坛、系统管理;

    (2)学生;个人中心、求购信息管理、用户警告管理、信誉评价管理、卖家沟通管理、用户沟通管理;

    (3)卖家;个人中心、二手商品管理、求购信息管理、卖家警告管理、信誉评价管理、卖家沟通管理、用户沟通管理、订单管理;

    (4)前台;首页、二手商品、求购信息、交流论坛、公告信息、个人中心、后台管理、购物车、售后客服等功能,其具有简单的接口,方便的应用,强大的互动,完全基于互联网的特点。

    系统需求分析

    园二手交易系统需要满足的需求有以下几个:

    (1)实现管理系统信息关系的系统化、规范化和自动化;

    (2)减少维护人员的工作量以及实现用户对信息的控制和管理。

    (3)方便查询信息及管理信息等;

    (4)通过网络操作,改善处理问题的效率,提高操作人员利用率;

    (5)考虑到用户多样性特点,要求界面简单,操作简便。 

    系统展示 

    前台页面

    首页

    二手商品

    求购信息

    系统登录注册

    管理员功能模块

    二手商品管理

    卖家功能模块

    学生功能模块

    部分核心代码

    购物车

    1. /**
    2. * 购物车表
    3. * 后端接口
    4. * @author
    5. * @email
    6. * @date 2022-03-27 20:20:44
    7. */
    8. @RestController
    9. @RequestMapping("/cart")
    10. public class CartController {
    11. @Autowired
    12. private CartService cartService;
    13. /**
    14. * 后端列表
    15. */
    16. @RequestMapping("/page")
    17. public R page(@RequestParam Map<String, Object> params,CartEntity cart,
    18. HttpServletRequest request){
    19. if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    20. cart.setUserid((Long)request.getSession().getAttribute("userId"));
    21. }
    22. EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();
    23. PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params));
    24. request.setAttribute("data", page);
    25. return R.ok().put("data", page);
    26. }
    27. /**
    28. * 前端列表
    29. */
    30. @IgnoreAuth
    31. @RequestMapping("/list")
    32. public R list(@RequestParam Map<String, Object> params,CartEntity cart,
    33. HttpServletRequest request){
    34. EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();
    35. PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params));
    36. request.setAttribute("data", page);
    37. return R.ok().put("data", page);
    38. }
    39. /**
    40. * 列表
    41. */
    42. @RequestMapping("/lists")
    43. public R list( CartEntity cart){
    44. EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();
    45. ew.allEq(MPUtil.allEQMapPre( cart, "cart"));
    46. return R.ok().put("data", cartService.selectListView(ew));
    47. }
    48. /**
    49. * 查询
    50. */
    51. @RequestMapping("/query")
    52. public R query(CartEntity cart){
    53. EntityWrapper< CartEntity> ew = new EntityWrapper< CartEntity>();
    54. ew.allEq(MPUtil.allEQMapPre( cart, "cart"));
    55. CartView cartView = cartService.selectView(ew);
    56. return R.ok("查询购物车表成功").put("data", cartView);
    57. }
    58. /**
    59. * 后端详情
    60. */
    61. @RequestMapping("/info/{id}")
    62. public R info(@PathVariable("id") Long id){
    63. CartEntity cart = cartService.selectById(id);
    64. return R.ok().put("data", cart);
    65. }
    66. /**
    67. * 前端详情
    68. */
    69. @IgnoreAuth
    70. @RequestMapping("/detail/{id}")
    71. public R detail(@PathVariable("id") Long id){
    72. CartEntity cart = cartService.selectById(id);
    73. return R.ok().put("data", cart);
    74. }
    75. /**
    76. * 后端保存
    77. */
    78. @RequestMapping("/save")
    79. public R save(@RequestBody CartEntity cart, HttpServletRequest request){
    80. cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    81. //ValidatorUtils.validateEntity(cart);
    82. cart.setUserid((Long)request.getSession().getAttribute("userId"));
    83. cartService.insert(cart);
    84. return R.ok();
    85. }
    86. /**
    87. * 前端保存
    88. */
    89. @RequestMapping("/add")
    90. public R add(@RequestBody CartEntity cart, HttpServletRequest request){
    91. cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    92. //ValidatorUtils.validateEntity(cart);
    93. cartService.insert(cart);
    94. return R.ok();
    95. }
    96. /**
    97. * 修改
    98. */
    99. @RequestMapping("/update")
    100. public R update(@RequestBody CartEntity cart, HttpServletRequest request){
    101. //ValidatorUtils.validateEntity(cart);
    102. cartService.updateById(cart);//全部更新
    103. return R.ok();
    104. }
    105. /**
    106. * 删除
    107. */
    108. @RequestMapping("/delete")
    109. public R delete(@RequestBody Long[] ids){
    110. cartService.deleteBatchIds(Arrays.asList(ids));
    111. return R.ok();
    112. }
    113. /**
    114. * 提醒接口
    115. */
    116. @RequestMapping("/remind/{columnName}/{type}")
    117. public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
    118. @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
    119. map.put("column", columnName);
    120. map.put("type", type);
    121. if(type.equals("2")) {
    122. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    123. Calendar c = Calendar.getInstance();
    124. Date remindStartDate = null;
    125. Date remindEndDate = null;
    126. if(map.get("remindstart")!=null) {
    127. Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
    128. c.setTime(new Date());
    129. c.add(Calendar.DAY_OF_MONTH,remindStart);
    130. remindStartDate = c.getTime();
    131. map.put("remindstart", sdf.format(remindStartDate));
    132. }
    133. if(map.get("remindend")!=null) {
    134. Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
    135. c.setTime(new Date());
    136. c.add(Calendar.DAY_OF_MONTH,remindEnd);
    137. remindEndDate = c.getTime();
    138. map.put("remindend", sdf.format(remindEndDate));
    139. }
    140. }
    141. Wrapper<CartEntity> wrapper = new EntityWrapper<CartEntity>();
    142. if(map.get("remindstart")!=null) {
    143. wrapper.ge(columnName, map.get("remindstart"));
    144. }
    145. if(map.get("remindend")!=null) {
    146. wrapper.le(columnName, map.get("remindend"));
    147. }
    148. if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
    149. wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));
    150. }
    151. int count = cartService.selectCount(wrapper);
    152. return R.ok().put("count", count);
    153. }
    154. }

    二手商品

    1. /**
    2. * 二手商品
    3. * 后端接口
    4. * @author
    5. * @email
    6. * @date 2022-03-27 20:20:43
    7. */
    8. @RestController
    9. @RequestMapping("/ershoushangpin")
    10. public class ErshoushangpinController {
    11. @Autowired
    12. private ErshoushangpinService ershoushangpinService;
    13. @Autowired
    14. private StoreupService storeupService;
    15. /**
    16. * 后端列表
    17. */
    18. @RequestMapping("/page")
    19. public R page(@RequestParam Map<String, Object> params,ErshoushangpinEntity ershoushangpin,
    20. HttpServletRequest request){
    21. String tableName = request.getSession().getAttribute("tableName").toString();
    22. if(tableName.equals("maijia")) {
    23. ershoushangpin.setMaijiazhanghao((String)request.getSession().getAttribute("username"));
    24. }
    25. EntityWrapper<ErshoushangpinEntity> ew = new EntityWrapper<ErshoushangpinEntity>();
    26. PageUtils page = ershoushangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ershoushangpin), params), params));
    27. request.setAttribute("data", page);
    28. return R.ok().put("data", page);
    29. }
    30. /**
    31. * 前端列表
    32. */
    33. @IgnoreAuth
    34. @RequestMapping("/list")
    35. public R list(@RequestParam Map<String, Object> params,ErshoushangpinEntity ershoushangpin,
    36. HttpServletRequest request){
    37. EntityWrapper<ErshoushangpinEntity> ew = new EntityWrapper<ErshoushangpinEntity>();
    38. PageUtils page = ershoushangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ershoushangpin), params), params));
    39. request.setAttribute("data", page);
    40. return R.ok().put("data", page);
    41. }
    42. /**
    43. * 列表
    44. */
    45. @RequestMapping("/lists")
    46. public R list( ErshoushangpinEntity ershoushangpin){
    47. EntityWrapper<ErshoushangpinEntity> ew = new EntityWrapper<ErshoushangpinEntity>();
    48. ew.allEq(MPUtil.allEQMapPre( ershoushangpin, "ershoushangpin"));
    49. return R.ok().put("data", ershoushangpinService.selectListView(ew));
    50. }
    51. /**
    52. * 查询
    53. */
    54. @RequestMapping("/query")
    55. public R query(ErshoushangpinEntity ershoushangpin){
    56. EntityWrapper< ErshoushangpinEntity> ew = new EntityWrapper< ErshoushangpinEntity>();
    57. ew.allEq(MPUtil.allEQMapPre( ershoushangpin, "ershoushangpin"));
    58. ErshoushangpinView ershoushangpinView = ershoushangpinService.selectView(ew);
    59. return R.ok("查询二手商品成功").put("data", ershoushangpinView);
    60. }
    61. /**
    62. * 后端详情
    63. */
    64. @RequestMapping("/info/{id}")
    65. public R info(@PathVariable("id") Long id){
    66. ErshoushangpinEntity ershoushangpin = ershoushangpinService.selectById(id);
    67. ershoushangpin.setClicknum(ershoushangpin.getClicknum()+1);
    68. ershoushangpin.setClicktime(new Date());
    69. ershoushangpinService.updateById(ershoushangpin);
    70. return R.ok().put("data", ershoushangpin);
    71. }
    72. /**
    73. * 前端详情
    74. */
    75. @IgnoreAuth
    76. @RequestMapping("/detail/{id}")
    77. public R detail(@PathVariable("id") Long id){
    78. ErshoushangpinEntity ershoushangpin = ershoushangpinService.selectById(id);
    79. ershoushangpin.setClicknum(ershoushangpin.getClicknum()+1);
    80. ershoushangpin.setClicktime(new Date());
    81. ershoushangpinService.updateById(ershoushangpin);
    82. return R.ok().put("data", ershoushangpin);
    83. }
    84. /**
    85. * 赞或踩
    86. */
    87. @RequestMapping("/thumbsup/{id}")
    88. public R vote(@PathVariable("id") String id,String type){
    89. ErshoushangpinEntity ershoushangpin = ershoushangpinService.selectById(id);
    90. if(type.equals("1")) {
    91. ershoushangpin.setThumbsupnum(ershoushangpin.getThumbsupnum()+1);
    92. } else {
    93. ershoushangpin.setCrazilynum(ershoushangpin.getCrazilynum()+1);
    94. }
    95. ershoushangpinService.updateById(ershoushangpin);
    96. return R.ok("投票成功");
    97. }
    98. /**
    99. * 后端保存
    100. */
    101. @RequestMapping("/save")
    102. public R save(@RequestBody ErshoushangpinEntity ershoushangpin, HttpServletRequest request){
    103. ershoushangpin.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    104. //ValidatorUtils.validateEntity(ershoushangpin);
    105. ershoushangpinService.insert(ershoushangpin);
    106. return R.ok();
    107. }
    108. /**
    109. * 前端保存
    110. */
    111. @RequestMapping("/add")
    112. public R add(@RequestBody ErshoushangpinEntity ershoushangpin, HttpServletRequest request){
    113. ershoushangpin.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    114. //ValidatorUtils.validateEntity(ershoushangpin);
    115. ershoushangpinService.insert(ershoushangpin);
    116. return R.ok();
    117. }
    118. /**
    119. * 修改
    120. */
    121. @RequestMapping("/update")
    122. public R update(@RequestBody ErshoushangpinEntity ershoushangpin, HttpServletRequest request){
    123. //ValidatorUtils.validateEntity(ershoushangpin);
    124. ershoushangpinService.updateById(ershoushangpin);//全部更新
    125. return R.ok();
    126. }
    127. /**
    128. * 删除
    129. */
    130. @RequestMapping("/delete")
    131. public R delete(@RequestBody Long[] ids){
    132. ershoushangpinService.deleteBatchIds(Arrays.asList(ids));
    133. return R.ok();
    134. }
    135. /**
    136. * 提醒接口
    137. */
    138. @RequestMapping("/remind/{columnName}/{type}")
    139. public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
    140. @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
    141. map.put("column", columnName);
    142. map.put("type", type);
    143. if(type.equals("2")) {
    144. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    145. Calendar c = Calendar.getInstance();
    146. Date remindStartDate = null;
    147. Date remindEndDate = null;
    148. if(map.get("remindstart")!=null) {
    149. Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
    150. c.setTime(new Date());
    151. c.add(Calendar.DAY_OF_MONTH,remindStart);
    152. remindStartDate = c.getTime();
    153. map.put("remindstart", sdf.format(remindStartDate));
    154. }
    155. if(map.get("remindend")!=null) {
    156. Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
    157. c.setTime(new Date());
    158. c.add(Calendar.DAY_OF_MONTH,remindEnd);
    159. remindEndDate = c.getTime();
    160. map.put("remindend", sdf.format(remindEndDate));
    161. }
    162. }
    163. Wrapper<ErshoushangpinEntity> wrapper = new EntityWrapper<ErshoushangpinEntity>();
    164. if(map.get("remindstart")!=null) {
    165. wrapper.ge(columnName, map.get("remindstart"));
    166. }
    167. if(map.get("remindend")!=null) {
    168. wrapper.le(columnName, map.get("remindend"));
    169. }
    170. String tableName = request.getSession().getAttribute("tableName").toString();
    171. if(tableName.equals("maijia")) {
    172. wrapper.eq("maijiazhanghao", (String)request.getSession().getAttribute("username"));
    173. }
    174. int count = ershoushangpinService.selectCount(wrapper);
    175. return R.ok().put("count", count);
    176. }
    177. /**
    178. * 前端智能排序
    179. */
    180. @IgnoreAuth
    181. @RequestMapping("/autoSort")
    182. public R autoSort(@RequestParam Map<String, Object> params,ErshoushangpinEntity ershoushangpin, HttpServletRequest request,String pre){
    183. EntityWrapper<ErshoushangpinEntity> ew = new EntityWrapper<ErshoushangpinEntity>();
    184. Map<String, Object> newMap = new HashMap<String, Object>();
    185. Map<String, Object> param = new HashMap<String, Object>();
    186. Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
    187. while (it.hasNext()) {
    188. Map.Entry<String, Object> entry = it.next();
    189. String key = entry.getKey();
    190. String newKey = entry.getKey();
    191. if (pre.endsWith(".")) {
    192. newMap.put(pre + newKey, entry.getValue());
    193. } else if (StringUtils.isEmpty(pre)) {
    194. newMap.put(newKey, entry.getValue());
    195. } else {
    196. newMap.put(pre + "." + newKey, entry.getValue());
    197. }
    198. }
    199. params.put("sort", "clicknum");
    200. params.put("order", "desc");
    201. PageUtils page = ershoushangpinService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ershoushangpin), params), params));
    202. return R.ok().put("data", page);
    203. }
    204. }

  • 相关阅读:
    leetcode(力扣) 134. 加油站 (贪心 & 两种情况,老司机逻辑题)
    SSM(Spring+SpringMVC+MyBatis)框架集成
    WPF Material Design UI框架
    linux安装Samba
    LeetCode——Weekly Contest 319
    SNMP报文与MIB Browser软件讲解
    英伟达Jetson Nano的初步了解
    uboot源码——汇编阶段的start.S文件
    从火山引擎新品发布会,看字节的数据飞轮如何转起来?
    SAW的LC振荡器(转自www.dwenzhao.cn)
  • 原文地址:https://blog.csdn.net/m0_49113107/article/details/126538380