Java毕业设计-基于SSM框架的乡镇自来水收费系统项目实战(附源码+论文)

大家好!我是程序猿老A,感谢您阅读本文,欢迎一键三连哦。

💞当前专栏:Java毕业设计

精彩专栏推荐👇🏻👇🏻👇🏻

🎀 Python毕业设计
🌎微信小程序毕业设计

开发环境

开发语言:Java
框架:ssm
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7
数据库工具:Navicat12
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器

源码下载地址:

https://download.csdn.net/download/2301_76953549/89088173

论文目录

【如需全文请按文末获取联系】
在这里插入图片描述
在这里插入图片描述

一、项目简介

系统可以提供信息显示和相应服务,其管理员管理水表,审核用户更换水表的请求,管理用户水费,包括抄表以及水费缴费,管理公告,管理留言和用户信息。用户可以申请更换水表,可以完成水费缴费,公告查看,留言发布以及个人信息更改等操作。

二、系统设计

2.1软件功能模块设计

在前面分析的管理员功能的基础上,进行接下来的设计工作,最终展示设计的管理员结构图(见下图)。管理员管理水表,审核用户更换水表的请求,管理用户水费,包括抄表以及水费缴费,管理公告,管理留言和用户信息。
在这里插入图片描述
在前面分析的用户功能的基础上,进行接下来的设计工作,最终展示设计的用户结构图(见下图)。用户可以申请更换水表,可以完成水费缴费,公告查看,留言发布以及个人信息更改等操作。
在这里插入图片描述

2.2数据库设计

(1)下图是水费实体和其具备的属性。
在这里插入图片描述
(3)下图是用户实体和其具备的属性。
在这里插入图片描述
(5)下图为上述各实体间相互之间的关系。
在这里插入图片描述

三、系统项目部分截图

3.1管理员功能实现

水费管理
管理员进入指定功能操作区之后可以管理水费信息。其页面见下图。管理员可以查看各个用户的水费信息,完成用户水表抄表,完成用户水费的线上缴费操作。
在这里插入图片描述
水表信息
管理员进入指定功能操作区之后可以处理水表信息。其页面见下图。管理员添加水表,批量删除或针对性删除水表信息,修改水表信息。
在这里插入图片描述
用户管理
管理员进入指定功能操作区之后可以管理用户。其页面见下图。本功能就是为了方便管理员增加用户,修改用户,批量删除用户而设置的。
在这里插入图片描述

3.2用户功能实现

在线留言
用户进入指定功能操作区之后可以发布留言。其页面见下图。用户直接提交留言即可,管理员会及时接收到用户的留言。
在这里插入图片描述在线缴费
用户进入指定功能操作区之后可以查看水费并缴费。其页面见下图。用户点击缴费即可完成对应水费的缴费操作。
在这里插入图片描述
更换水表
用户进入指定功能操作区之后可以更换水表。其页面见下图。当用户提交了水表更换信息之后,在管理员未审核前,用户可以自行取消更换水表的请求。
在这里插入图片描述

四、部分核心代码

package com.controller;

import java.util.*;
import javax.servlet.http.HttpServletRequest;

import com.entity.ShuibiaoxinxiEntity;
import com.entity.YonghuxinxiEntity;
import com.service.ShuibiaoxinxiService;
import com.service.YonghuxinxiService;
import com.util.Common;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

import com.entity.ShuifeixinxiEntity;

import com.service.ShuifeixinxiService;
import com.utils.PageUtils;
import com.utils.R;

/**
 * 
 * 后端接口
 * @author
 * @email
 * @date 2021-01-30
*/
@RestController
@Controller
@RequestMapping("/shuifeixinxi")
public class ShuifeixinxiController {
    private static final Logger logger = LoggerFactory.getLogger(ShuifeixinxiController.class);

    @Autowired
    private ShuifeixinxiService shuifeixinxiService;

    @Autowired
    private YonghuxinxiService yonghuxinxiService;

    @Autowired
    private ShuibiaoxinxiService shuibiaoxinxiService;


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",page方法");
        Object role = request.getSession().getAttribute("role");
        PageUtils page = null;
        if(role.equals("用户")){
            params.put("yh",request.getSession().getAttribute("userId"));
            page = shuifeixinxiService.queryPage(params);
        }else{
            page = shuifeixinxiService.queryPage(params);
        }
        return R.ok().put("data", page);
    }
    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        logger.debug("Controller:"+this.getClass().getName()+",info方法");
        ShuifeixinxiEntity shuifeixinxi = shuifeixinxiService.selectById(id);
        if(shuifeixinxi!=null){
            return R.ok().put("data", shuifeixinxi);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody ShuifeixinxiEntity shuifeixinxi, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",save");
        Wrapper<ShuifeixinxiEntity> queryWrapper = new EntityWrapper<ShuifeixinxiEntity>()
            .eq("yh_types", shuifeixinxi.getYhTypes())
            .eq("sb_types", shuifeixinxi.getSbTypes());
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ShuifeixinxiEntity shuifeixinxiEntity = shuifeixinxiService.selectOne(queryWrapper);
        //根据前端选择用户id进行查询数据
        YonghuxinxiEntity yonghuxinxiEntity = yonghuxinxiService.selectOne(new EntityWrapper<YonghuxinxiEntity>().eq("id",shuifeixinxi.getYhTypes()));
        //根据用户id查出来的水表id进行查询数据
        ShuibiaoxinxiEntity shuibiaoxinxiEntity = shuibiaoxinxiService.selectOne(new EntityWrapper<ShuibiaoxinxiEntity>().eq("id",yonghuxinxiEntity.getSbTypes()));
        //将根据用户id查出来的水表id进行赋值到水费信息表中
        shuifeixinxi.setSbTypes(yonghuxinxiEntity.getSbTypes());
        //将水表信息中的水价格赋值到水费信息表中
        shuifeixinxi.setMoney(shuibiaoxinxiEntity.getMoney());
        //判断上月是否有抄表数据
        String s = Common.addDay(shuifeixinxi.getMoneyTime(), -1).substring(0,7);
        Wrapper<ShuifeixinxiEntity> query = new EntityWrapper<ShuifeixinxiEntity>()
                .eq("money_time", s)
                .eq("yh_types", shuifeixinxi.getYhTypes());
        ShuifeixinxiEntity shuifei = shuifeixinxiService.selectOne(query);
        if(shuifei != null){
            if(shuifei.getLastmeter() != null && shuifei.getLastmeter() >= 0){

                shuifeixinxi.setLastmeter(shuifei.getMeterdata());
            }else{
                //没有就赋值为0
                shuifeixinxi.setLastmeter(0);
            }
        }else{
            //没有就赋值为0
            shuifeixinxi.setLastmeter(0);
        }
        //将用户传过来的抄表信息减去上次抄表信息
        if(shuifeixinxi.getMeterdata() > shuifeixinxi.getLastmeter()){
            shuifeixinxi.setUseyield(shuifeixinxi.getMeterdata()-shuifeixinxi.getLastmeter());
        }else{
            return R.error(511,"你抄错表了把");
        }
        //把用水量乘以水费价格
        shuifeixinxi.setMaxmoney(shuifeixinxi.getUseyield()*shuifeixinxi.getMoney());
        //设置缴费时间
        Calendar cd = Calendar.getInstance();
        cd.setTime(new Date());
        cd.add(Calendar.MONTH,1);
        //缴费时间为当前时间加上一个月
        shuifeixinxi.setNoticeTime(cd.getTime());

        if(shuifeixinxiEntity==null){
            shuifeixinxiService.insert(shuifeixinxi);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        logger.debug("Controller:"+this.getClass().getName()+",delete");
        shuifeixinxiService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}


获取源码或论文

如需对应的论文或源码,以及其他定制需求,也可以下方微❤联系。

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值