提示:源码获取:博客首页 " 资源 " 里下载!
文章目录
前言
提示:这里可以添加本文要记录的大概内容:
因为一些导游的自私,为了蝇头小利而使游客处于尴尬境地。所以,想着玩的好,又想着少花钱,追求一个经济实惠的旅游。那么如何选择一个靠谱的导游是一个困难的问题。
提示:以下是本篇文章正文内容,下面案例可供参考
一、背景及意义
1、编写目的
本次项目设计目的是构建一个在线导游预约系统,主要完成游客在出门旅游时对导游的预定和对旅游类型的选择等操作。近年来,随着人们旅游活动日益增加,旅游产业的逐渐扩大,对于导游人员的需求量更是与日递增。旅游也成为了老百姓的所需。导游服务是出门旅游活动中举足轻重的环节,人们外出旅游,是出于不同的动机,但究其本质旅游活动是为了满足人类精神需求,满足人们对自然美,艺术美,生活美的欣赏与享受。编写这样一个系统,符合人们旅游时选择导游所需,把优质的导游,不同类型的导游呈现在游客面前,让人们出行旅游省时省力。
2、项目背景
导游的存在源于为游客提供服务,解决出行问题的。站在一个游客角度来看,首先就得思考在接下来的旅游中,将会遇到什么问题,从而思索导游存在是否能够解决。那么,以以往出行经验来看,游客在旅游时,常遇到的问题包括,去哪玩?去哪吃?去哪住?怎么去?去哪买?基本围绕的就是旅游的这几大要素形成的服务需求。而这六要素需求的解决对于大部分人来说,又是基于价格对比考虑的,即大部分的人面临着钱不多,心不小的尴尬境地。既想着玩的好,又想着少花钱,追求一个经济实惠的旅游。那么如何选择一个靠谱的导游是一个困难的问题,现在导游水平参差不齐,乱收费,强行买卖,人们很难选择到一个优质,安心的导游,做此项目,把导游评分,全部导游,全部透明的显示在游客面前,无二次收费,给游客一次好的导游预约体验。
3、程序描述
该程序段是以在线导游预约系统的登入页面设计,用于区分用户的身份,使用户以自己的身份(游客、导游或管理员)登入进该系统,登入页面不同,所执行的功能也不同。
要求所有用户在使用本系统之前都必须通过自己的用户名和密码登入,才能进行操作,该子系统主要判断用户登入时用户名和密码的正确性。
4、产品功能
(1)游客登陆后可以在导游预约中进行预约导游,对某个导游下订单的功能;
(2)游客可以在订单中心查看订单,但不能进行任何操作。
(3)游客可以查看自己的个人信息及对密码的修改。
(4)管理员可以对导游及游客进行管理
(5)管理员对旅游分类进行管理
(6)管理员可以查看并管理全部预约信息。
(7)管理员可以查看自己个人信息及对密码的修改。
二、总体设计
1、需求规定
每个用户都有自己的用户名和密码,这是区分用户身份的有效凭证,只有 用户编号和密码都输入正确才能登入系统开始使用,并且要完善用户的个人信息要求正确,方便管理员进行管理。管理员离职后,账号将注销,不能使用。
2、运行环境
包括开发软件、硬件环境,运行软件环境、硬件环境
开发软件:idea
硬件环境:基于64位操作系统,windows10及ios系统
运行软件环境:mysql8、tomcat8以上
3、部分运行页面截图展示
登陆模块
管理员模块:
游客模块
三、部分代码展示
@RestController
@RequestMapping("/classification")
@Slf4j
public class ClassificationController {
@Resource
ClassificationService classificationService;
/**
* 添加分类
* @param name
* @return
*/
@PostMapping("/add")
public Result addClassification(@RequestParam("name") String name){
Classification classification = new Classification();
classification.setName(name);
if(classificationService.addClassification(classification)){
return Result.success("创建成功!");
}
return Result.error("创建失败!");
}
/**
* 删除分类
* @param id
* @return
*/
@DeleteMapping("/delete/{id}")
public Result deleteClassification(@PathVariable Integer id){
if(classificationService.deleteClassificationById(id)) {
return Result.success("删除成功!");
}
return Result.error("创建失败!");
}
/**
* 分类分页
* @param current
* @param size
* @return
*/
@GetMapping("/page/{current}/{size}")
public Result classificationPage(@PathVariable Integer current, @PathVariable Integer size){
IPage<Classification> page = classificationService.page(current, size);
return Result.success("返回分页。", page);
}
/**
* 全部分类
* @return
*/
@GetMapping("/all")
public Result allClassification(){
List<Classification> list = classificationService.getAllClassification();
return Result.success("返回全部分类。", list);
}
@Service
@Slf4j
public class TableServiceImpl implements TableService {
@Resource
DiningTableMapper diningTableMapper;
@Resource
OrderMapper orderMapper;
@Resource
ReservationService reservationService;
@Override
public List<DiningTable> listInfo() {
List<DiningTable> tables = listForShow();
for(DiningTable table : tables){
table.setOrder(orderMapper.selectById(table.getOrderId()));
table.setReservationInfoList(reservationService.getReservationByTableId(table.getId()));
}
return tables;
}
@Override
public List<DiningTable> listForShow() {
QueryWrapper<DiningTable> wrapper = new QueryWrapper<>();
wrapper.eq("open", true);
return diningTableMapper.selectList(wrapper);
}
@Override
public List<DiningTable> list() {
return diningTableMapper.selectList(null);
}
@Override
public Boolean createTable(String tableName, Integer capacity, Boolean open) {
DiningTable table = TableBuilder.create().pushTableName(tableName)
.pushCapacity(capacity).pushOpen(open).finish();
return diningTableMapper.insert(table) == 1;
}
@Override
public Boolean updateTable(Integer id, String tableName, Integer capacity, Boolean open) {
DiningTable table = getTableOfThrow(id);
table.setName(tableName);
table.setCapacity(capacity);
table.setOpen(open);
return diningTableMapper.updateById(table) == 1;
}
@Override
public Boolean deleteTable(Integer id) {
DiningTable table = getTableOfThrow(id);
if(table.getUsed()){
throw new UnmessageException("导游正忙!");
}
return diningTableMapper.deleteById(id) == 1;
}
@Override
public boolean tableUsed(Integer tableId, Integer orderId){
DiningTable table = getTableOfThrow(tableId);
log.info("tableId:{} orderId:{} used:{}", tableId, orderId, table.getUsed());
if(!table.getOpen()){
throw new UnmessageException("导游未开放!");
}
if(table.getUsed()){
throw new UnmessageException("导游正忙。");
}
table.setOrderId(orderId);
table.setUsed(true);
return diningTableMapper.updateById(table) == 1;
}
@Override
public boolean tableUnused(Integer tableId, Integer orderId) {
DiningTable table = getTableOfThrow(tableId);
log.info("tableId:{} orderId:{} used:{}", tableId, orderId, table.getUsed());
if(!table.getUsed()){
throw new UnmessageException("导游空闲。");
}
if(!table.getOrderId().equals(orderId)){
throw new UnmessageException("订单号未对应。");
}
table.setOrderId(0);
table.setUsed(false);
return diningTableMapper.updateById(table) == 1;
}
@Override
public DiningTable getTableOfThrow(Integer id) {
DiningTable table = diningTableMapper.selectById(id);
if(table == null){
throw new UnmessageException("导游不存在");
}
return table;
}
}
public interface TableService {
List<DiningTable> listForShow();
List<DiningTable> listInfo();
List<DiningTable> list();
Boolean createTable(String tableName, Integer capacity, Boolean open);
Boolean updateTable(Integer id, String tableName,
Integer capacity, Boolean open);
Boolean deleteTable(Integer id);
/**
* 设置导游正在使用中
* @param tableId
* @param orderId
* @return
*/
boolean tableUsed(Integer tableId, Integer orderId);
/**
* 设置导游空闲
* @param tableId
* @param orderId
* @return
*/
boolean tableUnused(Integer tableId, Integer orderId);
DiningTable getTableOfThrow(Integer id);
}
四、源码获取
提示:源码获取:博客首页 " 资源 " 里下载!