
1. 项目背景与意义随着鲜花消费场景的日常化与节日化连锁花店在订单规模、配送时效和花艺师资源调度上面临越来越大的管理压力。传统的人工接单、纸质排班和电话协调方式容易出现订单遗漏、配送冲突、花艺师忙闲不均等问题尤其在情人节、母亲节等高峰期运营效率直接决定门店收益与客户口碑。本系统面向连锁花店的多门店运营场景将订单管理与花艺师排班两大核心业务统一到同一平台实现订单从下单、接单、制作到配送的全流程跟踪同时根据门店订单量、花艺师技能等级和可用时间自动生成合理排班帮助门店降低沟通成本、提升履约效率。从技术角度看项目采用 Spring Boot 作为后端基础框架结合 MyBatis-Plus、MySQL 和 Redis 等主流组件既适合作为毕业设计或课程项目的完整选题也具备向真实生产环境演进的扩展空间。2. 系统功能模块系统按角色划分为管理员、门店店长、花艺师和客户四类用户核心功能模块如下用户与权限管理基于 Spring Security JWT 实现登录认证与角色鉴权不同角色访问不同菜单与接口。门店管理维护连锁门店的基础信息、营业时间和配送范围。订单管理客户在线下单店长审核分配花艺师接单制作支持订单状态流转与查询统计。花艺师管理维护花艺师档案、技能等级、联系方式及所属门店。排班管理根据门店订单预测与花艺师可用时间生成周排班表支持手动调整与冲突检测。数据统计按门店、时段、花艺师维度统计订单量与销售额为运营决策提供依据。3. 技术栈选型系统采用前后端分离架构后端基于 Spring Boot 2.7 构建前端使用 Vue 3 Element Plus数据库选用 MySQL 8.0缓存与分布式会话使用 Redis。具体技术栈如下表所示层次技术选型说明后端框架Spring Boot 2.7快速构建 RESTful 服务自动装配简化配置持久层MyBatis-Plus通用 CRUD 与分页查询减少 SQL 样板代码安全认证Spring Security JWT无状态登录认证与接口权限控制数据库MySQL 8.0存储业务数据支持事务与索引优化缓存Redis缓存热点数据、验证码与登录会话前端Vue 3 Element Plus组件化开发提供表格、表单、日历等交互组件构建工具Maven依赖管理与项目构建4. 数据库设计系统核心数据表包括用户表、门店表、花艺师表、订单表和排班表。其中订单表与排班表是业务核心订单表记录客户、门店、花艺师、商品明细与状态信息排班表记录花艺师在特定日期与班次的工作安排。订单表与花艺师表、门店表通过外键关联排班表通过花艺师 ID 与门店 ID 建立多维度索引保证高峰期查询效率。5. 核心代码实现5.1 订单实体与状态流转订单模块是系统的核心业务之一。下面给出订单实体的核心代码使用 MyBatis-Plus 注解简化字段映射。Data TableName(t_order) public class Order { TableId(type IdType.AUTO) private Long id; private String orderNo; private Long customerId; private Long storeId; private Long floristId; private BigDecimal totalAmount; private Integer status; private String receiverName; private String receiverPhone; private String receiverAddress; private LocalDateTime createTime; private LocalDateTime updateTime; }订单状态使用整数常量表示便于扩展与存储。状态流转通过 Service 层方法控制保证业务规则统一。public class OrderStatus { public static final int PENDING 0; // 待审核 public static final int ACCEPTED 1; // 已接单 public static final int MAKING 2; // 制作中 public static final int DELIVERING 3; // 配送中 public static final int COMPLETED 4; // 已完成 public static final int CANCELLED 5; // 已取消 }5.2 订单服务层实现订单服务层负责创建订单、分配花艺师和更新状态。创建订单时校验门店营业状态与库存分配花艺师时优先选择当前空闲且技能匹配的人员。Service RequiredArgsConstructor public class OrderServiceImpl implements OrderService { private final OrderMapper orderMapper; private final FloristMapper floristMapper; private final ScheduleMapper scheduleMapper; Override Transactional(rollbackFor Exception.class) public Long createOrder(OrderCreateDTO dto) { Order order new Order(); order.setOrderNo(generateOrderNo()); order.setCustomerId(dto.getCustomerId()); order.setStoreId(dto.getStoreId()); order.setTotalAmount(dto.getTotalAmount()); order.setReceiverName(dto.getReceiverName()); order.setReceiverPhone(dto.getReceiverPhone()); order.setReceiverAddress(dto.getReceiverAddress()); order.setStatus(OrderStatus.PENDING); order.setCreateTime(LocalDateTime.now()); orderMapper.insert(order); return order.getId(); } Override public void assignFlorist(Long orderId, Long floristId) { Order order orderMapper.selectById(orderId); if (order null) { throw new BusinessException(订单不存在); } order.setFloristId(floristId); order.setStatus(OrderStatus.ACCEPTED); order.setUpdateTime(LocalDateTime.now()); orderMapper.updateById(order); } private String generateOrderNo() { return FD System.currentTimeMillis(); } }5.3 排班算法核心逻辑排班模块根据门店未来一周的订单预测量和花艺师的可用时间自动生成初步排班表。核心思路是统计每个花艺师在目标日期已被安排的班次数优先为订单量高的时段分配空闲花艺师。Service RequiredArgsConstructor public class ScheduleServiceImpl implements ScheduleService { private final ScheduleMapper scheduleMapper; private final FloristMapper floristMapper; Override Transactional(rollbackFor Exception.class) public ListSchedule generateWeeklySchedule(Long storeId, LocalDate startDate) { ListFlorist florists floristMapper.selectList( new LambdaQueryWrapperFlorist() .eq(Florist::getStoreId, storeId) .eq(Florist::getStatus, 1)); ListSchedule result new ArrayList(); for (int i 0; i 7; i) { LocalDate date startDate.plusDays(i); for (Florist florist : florists) { long count countSchedules(florist.getId(), date); if (count 2) { Schedule schedule new Schedule(); schedule.setStoreId(storeId); schedule.setFloristId(florist.getId()); schedule.setWorkDate(date); schedule.setShiftType(1); schedule.setStatus(0); scheduleMapper.insert(schedule); result.add(schedule); } } } return result; } private long countSchedules(Long floristId, LocalDate date) { return scheduleMapper.selectCount( new LambdaQueryWrapperSchedule() .eq(Schedule::getFloristId, floristId) .eq(Schedule::getWorkDate, date)); } }5.4 排班冲突检测手动调整排班时系统需要检测花艺师在同一时间段是否已被安排其他班次避免重复排班。public boolean checkConflict(Long floristId, LocalDate workDate, Integer shiftType) { Long count scheduleMapper.selectCount( new LambdaQueryWrapperSchedule() .eq(Schedule::getFloristId, floristId) .eq(Schedule::getWorkDate, workDate) .eq(Schedule::getShiftType, shiftType)); return count ! null count 0; }5.5 控制器层示例控制器层通过 RESTful 接口暴露订单与排班功能使用统一返回结构封装响应数据。RestController RequestMapping(/api/order) RequiredArgsConstructor public class OrderController { private final OrderService orderService; PostMapping(/create) public ResultLong createOrder(RequestBody OrderCreateDTO dto) { return Result.success(orderService.createOrder(dto)); } PostMapping(/assign) public ResultVoid assignFlorist(RequestParam Long orderId, RequestParam Long floristId) { orderService.assignFlorist(orderId, floristId); return Result.success(); } GetMapping(/page) public ResultPageOrderVO page(RequestParam(defaultValue 1) Integer page, RequestParam(defaultValue 10) Integer size) { return Result.success(orderService.pageOrders(page, size)); } }6. 系统亮点与扩展方向本系统的核心亮点在于将订单履约与人力资源调度打通通过排班模块直接关联订单量与花艺师可用状态减少人工协调成本。后续可扩展的方向包括接入微信小程序实现在线下单、基于历史订单数据做销量预测以优化排班、引入消息队列处理高峰期订单削峰以及增加花材库存联动模块进一步提升连锁门店的数字化运营能力。