物资捐赠管理系统毕业设计java项目

物资捐赠管理系统

一、项目介绍

基于springboot的爱心捐赠管理系统

开发语言:java

运行环境:idea或eclipse 数据库:mysql

技术:springboot+mybatis+html+layui+echarts

爱心捐赠系统(用户端+管理端)

用户端功能模块:登录+注册+衣物捐赠+捐赠浏览+论坛交流+帖子留言+爱心许愿+个人主页

管理端功能模块:登录+用户管理+捐赠记录管理+论坛管理+留言管理+心愿管理

二、系统部分功能截图

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

三、部分代码展示

package com.lc.controller;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.lc.entity.Article;
import com.lc.entity.User;
import com.lc.service.ArticleService;
import com.lc.utils.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * 文章信息控制层
 */
@RestController
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    ArticleService articleService;


    /**
     * 文章信息数据表格接口
     */
    @RequestMapping(value = "/getTableData", produces = "application/json; charset=utf-8")
    public String getTableData(@RequestBody Article article) {
        Map<String, Object> pageDataMap = new HashMap<>(3);
        //默认分页参数
        if(article.getCurrentPage() == null || article.getLimitCount() == null){
            article.setCurrentPage(1);
            article.setLimitCount(10);
        }
        List<Article> dataList = articleService.selectList(article);
        for(Article a : dataList){
            if(!StrUtil.isBlank(a.getPicStr())){
                a.setCoverImg(a.getPicStr().split(",")[0]);
            }
        }
        Integer totalCount = articleService.selectCount(article);
        pageDataMap.put("code", 0);
        pageDataMap.put("data", dataList);
        pageDataMap.put("count", totalCount);
        return JSON.toJSONString(pageDataMap);
    }

    /**
     * 文章信息保存
     */
    @RequestMapping("/saveArticle")
    public String saveArticle(@RequestBody Article article) {
        return articleService.saveArticle(article);
    }

    /**
     * 文章信息删除(物理删除)
     */
    @RequestMapping("/deleteArticle")
    public String deleteArticle(String id) {
        return articleService.deletePhysical(id);
    }

    /**
     * 我的文章数据获取
     */
    @RequestMapping("/selfArticle")
    public List<Article> selfArticle() {
        User currentUser = UserContext.getCurrentUser();
        List<Article> articleList = articleService.selectByUserId(currentUser.getId());
        return articleList;
    }

    /**
     * 根据id获取
     */
    @RequestMapping("/getById")
    public Article getById(String id) {
        Article article = articleService.selectEntity(id);
        if(!StrUtil.isBlank(article.getPicStr())){
            List<String> picList = new ArrayList<>(Arrays.asList(article.getPicStr().split(",")));
            article.setPicList(picList);
        }
        return article;
    }


}

package com.lc.controller;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.lc.entity.Donation;
import com.lc.entity.User;
import com.lc.service.DonationService;
import com.lc.utils.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;
import java.util.stream.Collectors;

/**
 * 捐赠信息控制层
 */
@RestController
@RequestMapping("/donation")
public class DonationController {

    @Autowired
    DonationService donationService;


    /**
     * 捐赠信息数据表格接口
     */
    @RequestMapping(value="/getTableData", produces="application/json; charset=utf-8")
    public String getTableData(@RequestBody Donation donation) {
        Map<String, Object> map = donationService.selectPage(donation);
        return JSON.toJSONString(map);
    }

    /**
     * 后台捐赠信息保存
     */
    @RequestMapping("/saveDonation")
    public String saveDonation(@RequestBody Donation donation) {
        return donationService.save(donation);
    }

    /**
     * 前台捐赠信息保存
     */
    @RequestMapping("/insertDonationList")
    public String insertDonationList(@RequestBody List<Donation> list) {
        return donationService.insertDonationList(list);
    }

    /**
     * 捐赠信息删除(物理删除)
     */
    @RequestMapping("/deleteDonation")
    public String deleteDonation(String id) {
        return donationService.deletePhysical(id);
    }

    /**
     * 我的捐赠记录数据获取
     */
    @RequestMapping("/selfDonation")
    public List<Map<String, Object>> selfDonation(){
        User currentUser = UserContext.getCurrentUser();
        List<Map<String, Object>> listMap = donationService.countSelfDonation(currentUser.getId());
        return listMap;
    }

    /**
     * 后台修改捐赠记录状态
     */
    @RequestMapping("/updateVerify")
    public String updateVerify(String id, Integer verify){
        return donationService.updateVerifyById(id, verify);
    }


    /**
     * 前台页面第一个饼状图数据接口
     */
    @RequestMapping("/echartsDataOne")
    public List<Map<String, String>> echartsDataOne(){
        List<Donation> allList = donationService.selectAllList();
        Map<String, List<Donation>> allMap = allList.stream().peek(o -> {
            if(o.getKind() == 0){
                o.setKindName("上衣");
            }else if(o.getKind() == 1){
                o.setKindName("裤子");
            }else if(o.getKind() == 2){
                o.setKindName("袜子");
            }else if(o.getKind() == 3){
                o.setKindName("手套");
            }else if(o.getKind() == 4){
                o.setKindName("帽子");
            }else if(o.getKind() == 5){
                o.setKindName("其他");
            }
        }).collect(Collectors.groupingBy(Donation::getKindName));
        List<Map<String, String>> listMap = new ArrayList<>();
        for(Map.Entry<String, List<Donation>> map : allMap.entrySet()){
            Double sum = map.getValue().stream().mapToDouble(Donation::getNumber).sum();
            Map<String, String> itemMap = new HashMap<String, String>();
            itemMap.put("value", String.valueOf(sum));
            itemMap.put("name", map.getKey());
            listMap.add(itemMap);
        }
        return listMap;
    }

    /**
     * 前台页面第二个柱状图数据接口
     */
    @RequestMapping("/echartsDataTwo")
    public Map<String, List<String>> echartsDataTwo(){
        Map<String, List<String>> resultMap = new HashMap<>();
        //获取最近七天的时间段(往前找3天+往后找三天+今天一天)
        List<String> dateList = new ArrayList<>();
        String today= DateUtil.today();
        Date date = DateUtil.parse(today);
        for(int i=0; i<7; i++){
            String d = DateUtil.format(DateUtil.offset(date, DateField.DAY_OF_MONTH, -6 + i), "yyyy-MM-dd");
            dateList.add(d);
        }
        //根据日期获取数据
        List<String> dataList = new ArrayList<>();
        List<Donation> allList = donationService.selectAllList();
        for(String currentDate : dateList){
            List<Donation> list = allList.stream().filter(o -> currentDate.equals(o.getCreateDate().split(" ")[0])).collect(Collectors.toList());
            if(list.isEmpty()){
                dataList.add(String.valueOf(0));
            }else{
                dataList.add(String.valueOf(list.stream().mapToDouble(Donation::getNumber).sum()));
            }
        }
        resultMap.put("dateList", dateList);
        resultMap.put("dataList", dataList);
        return resultMap;
    }

    /**
     * 前台页面第三个折现图数据接口
     */
    @RequestMapping("/echartsDataThree")
    public Map<String, List<String>> echartsDataThree(){
        Map<String, List<String>> resultMap = new HashMap<>();
        //获取最近七天的时间段(往前找6天+今天一天)
        List<String> dateList = new ArrayList<>();
        String today= DateUtil.today();
        Date date = DateUtil.parse(today);
        for(int i=0; i<7; i++){
            String d = DateUtil.format(DateUtil.offset(date, DateField.DAY_OF_MONTH, -6 + i), "yyyy-MM-dd");
            dateList.add(d);
        }
        //根据日期获取数据
        List<Donation> allList = donationService.selectAllList();
        List<String> agreeList = new ArrayList<>();
        List<String> refuseList = new ArrayList<>();
        List<String> waitList = new ArrayList<>();
        for(String currentDate : dateList){
            List<Donation> list = allList.stream().filter(o -> currentDate.equals(o.getCreateDate().split(" ")[0])).collect(Collectors.toList());
            agreeList.add(String.valueOf(list.stream().filter(o -> o.getVerify() == 1).count()));
            refuseList.add(String.valueOf(list.stream().filter(o -> o.getVerify() == 2).count()));
            waitList.add(String.valueOf(list.stream().filter(o -> o.getVerify() == 0).count()));
        }
        resultMap.put("dateList", dateList);
        resultMap.put("agreeList", agreeList);
        resultMap.put("refuseList", refuseList);
        resultMap.put("waitList", waitList);
        return resultMap;

    }




}

package com.lc.controller;

import com.alibaba.fastjson.JSON;
import com.lc.entity.Article;
import com.lc.entity.Message;
import com.lc.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 留言信息控制层
 */
@RestController
@RequestMapping("/message")
public class MessageController {

    @Autowired
    MessageService messageService;


    /**
     * 留言信息数据表格接口
     */
    @RequestMapping(value = "/getTableData", produces = "application/json; charset=utf-8")
    public String getTableData(@RequestBody Message message) {
        Map<String, Object> map = messageService.selectPage(message);
        return JSON.toJSONString(map);
    }

    /**
     * 留言信息保存
     */
    @RequestMapping("/saveMessage")
    public String saveMessage(@RequestBody Message message) {
        return messageService.saveMessage(message);
    }

    /**
     * 留言信息删除(物理删除)
     */
    @RequestMapping("/deleteMessage")
    public String deleteMessage(String id) {
        return messageService.deletePhysical(id);
    }

    /**
     * 根据文章id获取留言
     */
    @RequestMapping("/getByArticleId")
    public List<Message> getByArticleId(String articleId) {
        List<Message> messageList = messageService.selectByArticleId(articleId);
        return messageList;
    }


}

四、底部获取项目

链接:https://pan.baidu.com/s/1qfxy0oiz1vHu74THhGApWw?pwd=h1et 
提取码:h1et 
--来自百度网盘超级会员V6的分享
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值