一、个人简介
💖💖作者:计算机编程果茶熊
💙💙个人简介:曾长期从事计算机专业培训教学,担任过编程老师,同时本人也热爱上课教学,擅长Java、微信小程序、Python、Golang、安卓Android等多个IT方向。会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我!
💛💛想说的话:感谢大家的关注与支持!
💜💜
网站实战项目
安卓/小程序实战项目
💕💕文末获取源码联系计算机编程果茶熊
二、系统介绍
后端开发语言:Java+Python(两个版本都支持)
后端框架:Spring Boot(Spring+SpringMVC+Mybatis)+Django(两个版本都支持)
前端:uni-app+微信小程序+安卓
数据库:MySQL
系统架构:B/S
本校园二手平台系统采用B/S架构设计,提供了完整的二手物品交易解决方案,满足校园内师生便捷交易的需求。系统后端支持Java与Python双语言开发,分别基于Spring Boot(Spring+SpringMVC+Mybatis)和Django框架实现核心业务逻辑;前端采用uni-app技术栈,同时兼容微信小程序和安卓平台,确保用户在多终端的流畅体验;数据持久层使用MySQL数据库进行数据存储与管理。功能模块全面覆盖用户交易场景,包括首页信息展示、个人中心管理、用户权限控制、卖家资质审核、商品分类管理、商品信息发布与维护、订单全流程管理、退款处理机制、投诉处理流程、留言互动功能、收藏管理以及系统后台管理等十二大核心模块,为校园二手交易提供了安全、高效、便捷的平台支持,有效解决了传统校园二手交易信息不对称、交易不便捷、缺乏监管等痛点问题,极大促进了校园资源的循环利用和可持续发展。
三、校园二手平台系统-视频解说
不懂如何整合前后端?校园二手平台的设计与实现教你用uni-app+Spring Boot打造完整系统
四、校园二手平台系统-功能展示
五、校园二手平台系统-代码展示
// 核心功能1: 商品信息管理
@Service
public class ProductServiceImpl implements ProductService {
@Autowired
private ProductMapper productMapper;
@Autowired
private CategoryMapper categoryMapper;
@Autowired
private UserMapper userMapper;
@Override
@Transactional
public ResponseResult addProduct(ProductDTO productDTO) {
// 参数校验
if (productDTO == null || StringUtils.isEmpty(productDTO.getTitle())
|| productDTO.getCategoryId() == null || productDTO.getPrice() == null) {
return ResponseResult.error("商品信息不完整");
}
// 检查分类是否存在
Category category = categoryMapper.selectById(productDTO.getCategoryId());
if (category == null) {
return ResponseResult.error("商品分类不存在");
}
// 检查用户是否存在且有权限发布
User seller = userMapper.selectById(productDTO.getSellerId());
if (seller == null) {
return ResponseResult.error("卖家信息不存在");
}
if (seller.getStatus() != UserStatus.NORMAL.getCode()) {
return ResponseResult.error("账户状态异常,无法发布商品");
}
// 构建商品实体并保存
Product product = new Product();
BeanUtils.copyProperties(productDTO, product);
product.setCreateTime(new Date());
product.setUpdateTime(new Date());
product.setStatus(ProductStatus.PENDING.getCode());
product.setViewCount(0);
product.setLikeCount(0);
// 处理商品图片
List<String> images = productDTO.getImages();
if (images != null && !images.isEmpty()) {
product.setMainImage(images.get(0));
product.setImages(String.join(",", images));
}
// 保存商品信息
productMapper.insert(product);
// 记录商品发布日志
logProductAction(product.getId(), product.getSellerId(), "发布商品",
"发布商品: " + product.getTitle());
return ResponseResult.success("商品发布成功,等待审核", product.getId());
}
}
// 核心功能2: 订单管理
@Service
public class OrderServiceImpl implements OrderService {
@Autowired
private OrderMapper orderMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private TransactionTemplate transactionTemplate;
@Override
public ResponseResult createOrder(OrderCreateDTO orderDTO) {
return transactionTemplate.execute(status -> {
try {
// 检查商品是否存在且可购买
Product product = productMapper.selectById(orderDTO.getProductId());
if (product == null) {
return ResponseResult.error("商品不存在");
}
if (product.getStatus() != ProductStatus.ON_SALE.getCode()) {
return ResponseResult.error("商品当前不可购买");
}
// 检查买家信息
User buyer = userMapper.selectById(orderDTO.getBuyerId());
if (buyer == null) {
return ResponseResult.error("买家信息不存在");
}
// 检查是否是自己购买自己的商品
if (product.getSellerId().equals(buyer.getId())) {
return ResponseResult.error("不能购买自己发布的商品");
}
// 创建订单
Order order = new Order();
order.setOrderNo(generateOrderNo());
order.setProductId(product.getId());
order.setProductTitle(product.getTitle());
order.setProductImage(product.getMainImage());
order.setBuyerId(buyer.getId());
order.setSellerId(product.getSellerId());
order.setAmount(product.getPrice());
order.setStatus(OrderStatus.CREATED.getCode());
order.setCreateTime(new Date());
order.setPaymentType(orderDTO.getPaymentType());
order.setContactInfo(orderDTO.getContactInfo());
order.setRemark(orderDTO.getRemark());
// 保存订单
orderMapper.insert(order);
// 更新商品状态为已预订
product.setStatus(ProductStatus.RESERVED.getCode());
productMapper.updateById(product);
// 发送订单通知给卖家
sendOrderNotification(product.getSellerId(), "您有新的订单",
"您的商品「" + product.getTitle() + "」有新订单,请及时处理");
return ResponseResult.success("订单创建成功", order);
} catch (Exception e) {
status.setRollbackOnly();
return ResponseResult.error("订单创建失败: " + e.getMessage());
}
});
}
private String generateOrderNo() {
return "ORD" + System.currentTimeMillis() + new Random().nextInt(1000);
}
}
// 核心功能3: 投诉处理管理
@Service
public class ComplaintServiceImpl implements ComplaintService {
@Autowired
private ComplaintMapper complaintMapper;
@Autowired
private OrderMapper orderMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private ProductMapper productMapper;
@Autowired
private AdminNotificationService notificationService;
@Override
@Transactional
public ResponseResult processComplaint(Long complaintId, ComplaintProcessDTO processDTO) {
// 获取投诉信息
Complaint complaint = complaintMapper.selectById(complaintId);
if (complaint == null) {
return ResponseResult.error("投诉信息不存在");
}
// 检查投诉状态
if (complaint.getStatus() != ComplaintStatus.PENDING.getCode()) {
return ResponseResult.error("只能处理待处理状态的投诉");
}
// 获取相关订单信息
Order order = null;
if (complaint.getOrderId() != null) {
order = orderMapper.selectById(complaint.getOrderId());
}
// 获取相关商品信息
Product product = null;
if (complaint.getProductId() != null) {
product = productMapper.selectById(complaint.getProductId());
}
// 获取投诉人信息
User complainant = userMapper.selectById(complaint.getUserId());
if (complainant == null) {
return ResponseResult.error("投诉人信息不存在");
}
// 根据处理结果进行不同操作
switch (processDTO.getResult()) {
case ComplaintResult.VALID:
// 投诉成立,进行相应处理
complaint.setStatus(ComplaintStatus.PROCESSED.getCode());
complaint.setResult(ComplaintResult.VALID.getCode());
complaint.setHandleTime(new Date());
complaint.setHandleNote(processDTO.getNote());
complaint.setHandleAdminId(processDTO.getAdminId());
// 如果涉及订单,可能需要取消订单
if (order != null && processDTO.isCancelOrder()) {
order.setStatus(OrderStatus.CANCELLED.getCode());
order.setCancelReason("投诉处理结果:" + processDTO.getNote());
orderMapper.updateById(order);
}
// 如果涉及商品,可能需要下架商品
if (product != null && processDTO.isRemoveProduct()) {
product.setStatus(ProductStatus.REMOVED.getCode());
product.setUpdateTime(new Date());
product.setUpdateNote("因投诉被下架:" + processDTO.getNote());
productMapper.updateById(product);
}
// 如果需要对卖家进行处罚
if (processDTO.isPenalizeSeller() && product != null) {
User seller = userMapper.selectById(product.getSellerId());
if (seller != null) {
// 记录违规并根据情况处理
seller.setViolationCount(seller.getViolationCount() + 1);
if (seller.getViolationCount() >= 3) {
seller.setStatus(UserStatus.RESTRICTED.getCode());
}
userMapper.updateById(seller);
}
}
// 通知投诉人
sendComplaintNotification(complainant.getId(), "投诉处理结果",
"您的投诉已被处理,结果:" + processDTO.getNote());
break;
case ComplaintResult.INVALID:
// 投诉不成立
complaint.setStatus(ComplaintStatus.PROCESSED.getCode());
complaint.setResult(ComplaintResult.INVALID.getCode());
complaint.setHandleTime(new Date());
complaint.setHandleNote(processDTO.getNote());
complaint.setHandleAdminId(processDTO.getAdminId());
// 通知投诉人
sendComplaintNotification(complainant.getId(), "投诉处理结果",
"您的投诉已被处理,但未被支持。原因:" + processDTO.getNote());
break;
case ComplaintResult.NEED_MORE_INFO:
// 需要更多信息
complaint.setStatus(ComplaintStatus.PENDING_MORE_INFO.getCode());
complaint.setHandleNote(processDTO.getNote());
// 通知投诉人提供更多信息
sendComplaintNotification(complainant.getId(), "投诉需要补充信息",
"您的投诉需要补充更多信息:" + processDTO.getNote());
break;
}
// 更新投诉记录
complaintMapper.updateById(complaint);
// 记录处理日志
logComplaintProcess(complaint.getId(), processDTO.getAdminId(),
"处理投诉", processDTO.getNote());
return ResponseResult.success("投诉处理成功");
}
private void sendComplaintNotification(Long userId, String title, String content) {
// 实现发送通知的逻辑
}
private void logComplaintProcess(Long complaintId, Long adminId, String action, String note) {
// 实现记录日志的逻辑
}
}
六、校园二手平台系统-文档展示
七、END
💕💕文末获取源码联系计算机编程果茶熊