大家好!我是职场程序猿,感谢您阅读本文,欢迎一键三连哦。
💞当前专栏:微信小程序毕业设计
精彩专栏推荐👇🏻👇🏻👇🏻
开发运行环境
①前端:微信小程序开发工具
② 后端:Java
- 框架:ssm
- JDK版本:JDK1.8
- 服务器:tomcat7
- 数据库:mysql 5.7
- 数据库工具:Navicat12
- 开发软件:eclipse/myeclipse/idea
- Maven包:Maven3.3.9
- 浏览器:谷歌浏览器
源码下载地址:
https://download.csdn.net/download/m0_46388260/89223508
论文目录
【如需全文请按文末获取联系】
目录
一、项目简介
本基于微信小程序民宿短租系统采用Java语言进行开发,数据库采用MySQL,小型轻便,使系统中的数据更为安全,技术采用微信小程序。本系统实现了民宿信息的网上宣传,用户可以随时浏览和预订。管理员可以管理民宿信息和订单信息。房主可以管理自己的民宿和订单。本系统提高了用户预订民宿的效率,同时也帮助房主更快的找到租客。
二、系统设计
2.1软件功能模块设计
本系统的结构分为管理员、用户、房主三部分。本系统的功能结构图如下图4.1所示:
2.2数据库设计
(1)管理员信息为管理员身份的资料,包括编号和密码、账号。管理员信息ER图如下图4.2所示:
(2)用户信息为用户身份的资料。用户身份的资料有账号、密码、电话、住址等。用户信息ER图如下图4.3所示:
(4)预订信息也是由用户产生,管理员审核,房主管理。预订信息包括类型、民宿户型、民宿面积等。预订信息ER图如下图4.5所示:
(5)系统全局ER图如下图4.6所示:
三、系统项目部分截图
3.1注册登陆功能
用户登录功能模块的实现界面
本系统需要登录才可以使用相关功能。用户登录功能的操作步骤为,用户点击用户登录功能,可以跳转到用户登录的窗口界面里,在用户登录的窗口界面里输入账号和密码,然后点击登录按钮。用户登录窗口的界面实现如下图5.1所示:
3.2民宿详情的功能实现界面
在民宿详情界面里可以看到详细的民宿信息,包括类型、户型、面积、价格等。民宿详情里有联系方式,用户可以实现在线预订。民宿详情的实现界面如下图5.9所示:
在线预订功能模块的实现界面
用户在预订民宿时需要填写入住日期、入住天数和订单备注。在线预订信息的实现界面如下图5.10所示:
民宿预订管理功能界面的实现
用户预订成功后可以管理预订信息。民宿预订管理功能的实现界面如下图5.11所示:
3.3房主注册功能的实现界面
房主也可以通过注册实现系统的使用。实现界面如下图5.12所示:
房主功能界面的实现
本界面分为图片、文字、标题、按键、列表等。房主可以发布民宿和管理预订信息以及个人信息。房主界面的实现效果如下图5.13所示:
管理员功能的实现界面
管理员的功能为用户管理、房主管理、民宿管理、房间类型管理、预订管理和系统管理等。实现界面如下图5.14所示:
四、部分核心代码
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 java.io.IOException;
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.MinsuxinxiEntity;
import com.entity.view.MinsuxinxiView;
import com.service.MinsuxinxiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import com.service.StoreupService;
import com.entity.StoreupEntity;
/**
* 民宿信息
* 后端接口
* @author
* @email
* @date 2022-04-16 16:55:50
*/
@RestController
@RequestMapping("/minsuxinxi")
public class MinsuxinxiController {
@Autowired
private MinsuxinxiService minsuxinxiService;
@Autowired
private StoreupService storeupService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,MinsuxinxiEntity minsuxinxi,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("fangzhu")) {
minsuxinxi.setFangzhuzhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<MinsuxinxiEntity> ew = new EntityWrapper<MinsuxinxiEntity>();
PageUtils page = minsuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, minsuxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,MinsuxinxiEntity minsuxinxi,
HttpServletRequest request){
EntityWrapper<MinsuxinxiEntity> ew = new EntityWrapper<MinsuxinxiEntity>();
PageUtils page = minsuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, minsuxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( MinsuxinxiEntity minsuxinxi){
EntityWrapper<MinsuxinxiEntity> ew = new EntityWrapper<MinsuxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( minsuxinxi, "minsuxinxi"));
return R.ok().put("data", minsuxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(MinsuxinxiEntity minsuxinxi){
EntityWrapper< MinsuxinxiEntity> ew = new EntityWrapper< MinsuxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( minsuxinxi, "minsuxinxi"));
MinsuxinxiView minsuxinxiView = minsuxinxiService.selectView(ew);
return R.ok("查询民宿信息成功").put("data", minsuxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
MinsuxinxiEntity minsuxinxi = minsuxinxiService.selectById(id);
minsuxinxi.setClicknum(minsuxinxi.getClicknum()+1);
minsuxinxi.setClicktime(new Date());
minsuxinxiService.updateById(minsuxinxi);
return R.ok().put("data", minsuxinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
MinsuxinxiEntity minsuxinxi = minsuxinxiService.selectById(id);
minsuxinxi.setClicknum(minsuxinxi.getClicknum()+1);
minsuxinxi.setClicktime(new Date());
minsuxinxiService.updateById(minsuxinxi);
return R.ok().put("data", minsuxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody MinsuxinxiEntity minsuxinxi, HttpServletRequest request){
minsuxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(minsuxinxi);
minsuxinxiService.insert(minsuxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody MinsuxinxiEntity minsuxinxi, HttpServletRequest request){
minsuxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(minsuxinxi);
minsuxinxiService.insert(minsuxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody MinsuxinxiEntity minsuxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(minsuxinxi);
minsuxinxiService.updateById(minsuxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
minsuxinxiService.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<MinsuxinxiEntity> wrapper = new EntityWrapper<MinsuxinxiEntity>();
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("fangzhu")) {
wrapper.eq("fangzhuzhanghao", (String)request.getSession().getAttribute("username"));
}
int count = minsuxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,MinsuxinxiEntity minsuxinxi, HttpServletRequest request,String pre){
EntityWrapper<MinsuxinxiEntity> ew = new EntityWrapper<MinsuxinxiEntity>();
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 = minsuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, minsuxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 协同算法(按收藏推荐)
*/
@RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params,MinsuxinxiEntity minsuxinxi, HttpServletRequest request){
String userId = request.getSession().getAttribute("userId").toString();
String inteltypeColumn = "fangjianleixing";
List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "minsuxinxi").orderBy("addtime", false));
List<String> inteltypes = new ArrayList<String>();
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
List<MinsuxinxiEntity> minsuxinxiList = new ArrayList<MinsuxinxiEntity>();
//去重
if(storeups!=null && storeups.size()>0) {
for(StoreupEntity s : storeups) {
minsuxinxiList.addAll(minsuxinxiService.selectList(new EntityWrapper<MinsuxinxiEntity>().eq(inteltypeColumn, s.getInteltype())));
}
}
EntityWrapper<MinsuxinxiEntity> ew = new EntityWrapper<MinsuxinxiEntity>();
params.put("sort", "id");
params.put("order", "desc");
PageUtils page = minsuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, minsuxinxi), params), params));
List<MinsuxinxiEntity> pageList = (List<MinsuxinxiEntity>)page.getList();
if(minsuxinxiList.size()<limit) {
int toAddNum = (limit-minsuxinxiList.size())<=pageList.size()?(limit-minsuxinxiList.size()):pageList.size();
for(MinsuxinxiEntity o1 : pageList) {
boolean addFlag = true;
for(MinsuxinxiEntity o2 : minsuxinxiList) {
if(o1.getId().intValue()==o2.getId().intValue()) {
addFlag = false;
break;
}
}
if(addFlag) {
minsuxinxiList.add(o1);
if(--toAddNum==0) break;
}
}
} else if(minsuxinxiList.size()>limit) {
minsuxinxiList = minsuxinxiList.subList(0, limit);
}
page.setList(minsuxinxiList);
return R.ok().put("data", page);
}
}
获取源码或论文
如需对应的论文或源码,以及其他定制需求,也可以下方微信联系我。