【小程序毕设】宠物走失信息管理小程序 uni-app|微信小程序|安卓 计算机毕业设计项目 微信小程序开发工具部署 附源码+文档+讲解

69 阅读4分钟

前言

一.开发工具简介

  • 后端开发语言:Java
  • 后端框架:Spring Boot(Spring+SpringMVC+Mybatis)
  • 前端:微信小程序
  • 数据库:MySQL
  • 系统架构:C/S
  • 开发工具:微信小程序开发工具

二.系统内容简介

《宠物走失信息管理小程序》是一款基于微信小程序平台开发的宠物寻找与信息管理系统,采用Java语言结合Spring Boot框架构建后端服务,通过MySQL数据库实现数据持久化存储。系统围绕宠物走失这一社会现象,构建了完整的信息管理体系,包含用户注册认证、宠物品种分类、走失信息发布、寻宠广场展示、认领信息匹配、违规举报处理、用户留言互动、交流论坛讨论等核心功能模块。通过微信小程序的便民特性,用户可以随时随地发布走失宠物信息、浏览寻宠广场、参与认领活动,同时系统提供论坛交流平台供宠物爱好者分享经验心得。整个系统采用C/S架构模式,前端通过微信小程序开发工具实现用户界面设计,后端运用SpringMVC处理业务逻辑,MyBatis框架负责数据库操作,形成了一套功能完善、操作便捷的宠物走失信息管理解决方案。

三.系统功能演示

宠物走失信息管理小程序

四.系统界面展示

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述

五.系统源码展示


import org.apache.spark.sql.SparkSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;

@Service
public class PetLossService {
    @Autowired
    private PetLossMapper petLossMapper;
    private SparkSession spark = SparkSession.builder().appName("PetLossAnalysis").master("local[*]").getOrCreate();
    
    public Result publishLostPet(PetLossInfo petInfo) {
        if (petInfo.getPetName() == null || petInfo.getPetName().trim().isEmpty()) {
            return Result.error("宠物名称不能为空");
        }
        if (petInfo.getLostTime() == null) {
            return Result.error("走失时间不能为空");
        }
        if (petInfo.getLostLocation() == null || petInfo.getLostLocation().trim().isEmpty()) {
            return Result.error("走失地点不能为空");
        }
        if (petInfo.getContactPhone() == null || !isValidPhone(petInfo.getContactPhone())) {
            return Result.error("请输入正确的联系电话");
        }
        petInfo.setPublishTime(new Date());
        petInfo.setStatus("LOST");
        petInfo.setViewCount(0);
        String petId = UUID.randomUUID().toString();
        petInfo.setPetId(petId);
        try {
            petLossMapper.insertPetLoss(petInfo);
            sendNotificationToNearbyUsers(petInfo);
            return Result.success("发布走失信息成功", petId);
        } catch (Exception e) {
            return Result.error("发布失败,请重试");
        }
    }
    
    public Result processClaimRequest(ClaimRequest claimRequest) {
        if (claimRequest.getPetId() == null || claimRequest.getPetId().trim().isEmpty()) {
            return Result.error("宠物信息不存在");
        }
        if (claimRequest.getClaimerPhone() == null || !isValidPhone(claimRequest.getClaimerPhone())) {
            return Result.error("请输入正确的联系电话");
        }
        if (claimRequest.getClaimDescription() == null || claimRequest.getClaimDescription().length() < 10) {
            return Result.error("认领描述至少需要10个字符");
        }
        PetLossInfo petInfo = petLossMapper.selectByPetId(claimRequest.getPetId());
        if (petInfo == null) {
            return Result.error("该宠物信息不存在或已被删除");
        }
        if (!"LOST".equals(petInfo.getStatus())) {
            return Result.error("该宠物已被认领或信息已关闭");
        }
        claimRequest.setClaimId(UUID.randomUUID().toString());
        claimRequest.setClaimTime(new Date());
        claimRequest.setStatus("PENDING");
        claimRequest.setVerifyStatus("WAITING");
        try {
            petLossMapper.insertClaimRequest(claimRequest);
            petLossMapper.updatePetStatus(claimRequest.getPetId(), "CLAIMED");
            notifyOwnerOfClaim(petInfo, claimRequest);
            return Result.success("认领申请提交成功,请等待宠物主人联系");
        } catch (Exception e) {
            return Result.error("认领申请提交失败,请重试");
        }
    }
    
    public Result handleReportRecord(ReportRecord reportRecord) {
        if (reportRecord.getReportType() == null || reportRecord.getReportType().trim().isEmpty()) {
            return Result.error("请选择举报类型");
        }
        if (reportRecord.getTargetId() == null || reportRecord.getTargetId().trim().isEmpty()) {
            return Result.error("举报目标不能为空");
        }
        if (reportRecord.getReportReason() == null || reportRecord.getReportReason().length() < 5) {
            return Result.error("举报理由至少需要5个字符");
        }
        List<ReportRecord> existingReports = petLossMapper.selectReportsByUserAndTarget(
            reportRecord.getReporterId(), reportRecord.getTargetId());
        if (existingReports.size() >= 3) {
            return Result.error("您对该内容的举报次数已达上限");
        }
        reportRecord.setReportId(UUID.randomUUID().toString());
        reportRecord.setReportTime(new Date());
        reportRecord.setProcessStatus("PENDING");
        reportRecord.setAdminId(null);
        try {
            petLossMapper.insertReportRecord(reportRecord);
            int reportCount = petLossMapper.countReportsByTarget(reportRecord.getTargetId());
            if (reportCount >= 5) {
                autoProcessHighReportContent(reportRecord.getTargetId(), reportRecord.getReportType());
            }
            return Result.success("举报提交成功,我们会及时处理");
        } catch (Exception e) {
            return Result.error("举报提交失败,请重试");
        }
    }
    
    private boolean isValidPhone(String phone) {
        return phone != null && phone.matches("^1[3-9]\\d{9}$");
    }
    
    private void sendNotificationToNearbyUsers(PetLossInfo petInfo) {
        List<User> nearbyUsers = petLossMapper.selectUsersByLocation(petInfo.getLostLocation(), 5.0);
        for (User user : nearbyUsers) {
            NotificationMessage message = new NotificationMessage();
            message.setUserId(user.getUserId());
            message.setTitle("附近有宠物走失");
            message.setContent("您附近有宠物走失,请留意帮助寻找");
            message.setSendTime(new Date());
            petLossMapper.insertNotification(message);
        }
    }
    
    private void notifyOwnerOfClaim(PetLossInfo petInfo, ClaimRequest claimRequest) {
        NotificationMessage message = new NotificationMessage();
        message.setUserId(petInfo.getOwnerId());
        message.setTitle("有人认领您的宠物");
        message.setContent("有用户申请认领您发布的宠物信息,请及时联系确认");
        message.setSendTime(new Date());
        petLossMapper.insertNotification(message);
    }
    
    private void autoProcessHighReportContent(String targetId, String reportType) {
        if ("PET_INFO".equals(reportType)) {
            petLossMapper.updatePetStatus(targetId, "HIDDEN");
        } else if ("FORUM_POST".equals(reportType)) {
            petLossMapper.updatePostStatus(targetId, "HIDDEN");
        }
        petLossMapper.updateReportStatus(targetId, "AUTO_PROCESSED");
    }
}

六.系统文档展示

在这里插入图片描述

结束

💕💕文末获取源码联系 计算机程序员小杨