基于微信小程序的校园二手数码交易平台+ssm后端源码和论文113
近年来,随着经济的发展,科技的进步,消费的升级,第三方数据挖掘及市场研究机构日前发布的《2019年第1季度中国在线二手闲置物品交易市场研究报告》显示,居民收入和消费支出稳步增长,物质财富极大丰富;消费主力年轻化,消费观念和消费方式发生转变。2019Q1闲置物品交易规模环比增长5.5%。
几乎人人都有闲置物品,而超过一半的用户倾向于让闲置物品放在一边不作处理。导致这种局面的原因,是因为大部分用户没有闲余时间及精力再去倒卖闲置物品,而小部分用户则是不知道倒卖二手商品的渠道。一些平台推出二手交易APP,迎合了很多买家变“闲”为“现”的想法,也响应了社会低碳生活的号召。
表1列出了市面上比较流行的二手交易平台:
平台名称 | 介绍 |
转转 | 买卖二手手机,转转优品专业验机。有质保,放心买;帮验机,卖得快。买卖家具家电,专业服务更省心。能维修,才靠谱;帮运输,超方便。 |
闲鱼 | 闲鱼的基本功能包括:商品发布,一键转卖,商品分类,商品关键字浏览搜索,商品购买等。能够满足用户在多种情景之下的各种交易需求,闲鱼以产品目标为导向而设计和建立起来的基本功能体系能够满足用户需求。 |
小白有品 | 小白有品APP是全品类精品二手自营平台,旧手机在这也可好价回收,商城主营9成新以上原装正品二手手机、笔记本平板电脑、潮流服饰、玩具美妆、钟表奢侈等产品。 |
校内淘 | 校园二手交易平台,为广大高校学生提供安全快捷、更懂你的校园二手交易平台服务。可以将自己的闲置宝贝(服务)信息进行公开,有需要的同学可以联系到你;同时还可以发布求购服务信息,让有资源的同学帮助你买到合适宝贝,为你提供更加全面贴心的校园二手交易用户体验。 |
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.ErshoushangpinEntity;
import com.entity.view.ErshoushangpinView;
import com.service.ErshoushangpinService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 二手商品
* 后端接口
* @author
* @email
* @date 2021-04-06 18:09:59
*/
@RestController
@RequestMapping("/ershoushangpin")
public class ErshoushangpinController {
@Autowired
private ErshoushangpinService ershoushangpinService;
/**
* 后端列表
*/
@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));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@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));
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);
}
/**
* 前端详情
*/
@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 thumbsup(@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);
}
}
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.YonghutongzhiEntity;
import com.entity.view.YonghutongzhiView;
import com.service.YonghutongzhiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 用户通知
* 后端接口
* @author
* @email
* @date 2021-04-06 18:09:59
*/
@RestController
@RequestMapping("/yonghutongzhi")
public class YonghutongzhiController {
@Autowired
private YonghutongzhiService yonghutongzhiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YonghutongzhiEntity yonghutongzhi,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
yonghutongzhi.setZhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<YonghutongzhiEntity> ew = new EntityWrapper<YonghutongzhiEntity>();
PageUtils page = yonghutongzhiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghutongzhi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YonghutongzhiEntity yonghutongzhi, HttpServletRequest request){
EntityWrapper<YonghutongzhiEntity> ew = new EntityWrapper<YonghutongzhiEntity>();
PageUtils page = yonghutongzhiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghutongzhi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YonghutongzhiEntity yonghutongzhi){
EntityWrapper<YonghutongzhiEntity> ew = new EntityWrapper<YonghutongzhiEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghutongzhi, "yonghutongzhi"));
return R.ok().put("data", yonghutongzhiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YonghutongzhiEntity yonghutongzhi){
EntityWrapper< YonghutongzhiEntity> ew = new EntityWrapper< YonghutongzhiEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghutongzhi, "yonghutongzhi"));
YonghutongzhiView yonghutongzhiView = yonghutongzhiService.selectView(ew);
return R.ok("查询用户通知成功").put("data", yonghutongzhiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
YonghutongzhiEntity yonghutongzhi = yonghutongzhiService.selectById(id);
return R.ok().put("data", yonghutongzhi);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
YonghutongzhiEntity yonghutongzhi = yonghutongzhiService.selectById(id);
return R.ok().put("data", yonghutongzhi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YonghutongzhiEntity yonghutongzhi, HttpServletRequest request){
yonghutongzhi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghutongzhi);
yonghutongzhiService.insert(yonghutongzhi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YonghutongzhiEntity yonghutongzhi, HttpServletRequest request){
yonghutongzhi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghutongzhi);
yonghutongzhiService.insert(yonghutongzhi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody YonghutongzhiEntity yonghutongzhi, HttpServletRequest request){
//ValidatorUtils.validateEntity(yonghutongzhi);
yonghutongzhiService.updateById(yonghutongzhi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yonghutongzhiService.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<YonghutongzhiEntity> wrapper = new EntityWrapper<YonghutongzhiEntity>();
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("yonghu")) {
wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
int count = yonghutongzhiService.selectCount(wrapper);
return R.ok().put("count", count);
}
}