ssm+JSP的乡镇自来水收费系统源码和论文PPT

ssm+JSP的乡镇自来水收费系统源码和论文PPT014

开发工具:idea 

 数据库mysql5.7+(mysql5.7最佳)

 数据库链接工具:navcat,小海豚等

开发技术:java  ssm tomcat8.5

一、课题背景与意义

随着我国经济建设迅速发展,乡镇规模日益扩大,乡镇经济社会活动日益加快和人口的高度集中化,给供水企业的营业抄收和费用管理工作提出了越来越高的要求。乡镇供水系统是城市的重要基础设施之一,由于其具有管网结构复杂、客户分布广泛、地域面积大、信息量及查询量大、保存期长、要求不间断运行使用等特点,传统的营业抄收管理系统已无法适应城市供水建设及维护管理的需求。为了实现自来水公司优质、经济、高效的服务目标,应建立先进的自来水收费管理信息系统,将一流的管理与先进的计算机网络结合在一起,建立客户服务中心系统,形成一个以计算机技术为载体,业务管理为内容的统一体,最终达到用户方便、企业增效、形象良好的对外服务窗口。

      本次设计拟采用JAVA技术,对乡镇自来水收费系统的功能需求进行了全面分析,从模块功能定义、前后端交互技术、数据库及编程语言的选择、系统调试及测试、功能完善和改进等方面进行设计,解决了从用户新装、抄表、计费、收费、复查、换表、发票管理、欠费追缴、业务受理、资料归档等多种业务,并最终为用户提供一套管理严谨、业务全面、运行稳定、扩展性强,且具有强大数据分析能力的管理系统,使系统数据得以最大化利用,可以灵活应对各种规模水司的应用。系统功能涵盖面广,可以根据用户的实际管理情况,快速获得相应的管理功能以适应企业管理的需要,最终从管理角度为用户带来便捷和收益。

二、国内外研究现状

目前,美国、欧洲、日本等发达国家的自来水收费进入智能化和网络化的时代,其内容由传统的抄(表)、核(算)、收(费)、计量业务,转变为以客户为中心、以促销为目的、以服务为主要业务的新的工作体系。在技术手段上,计算机网络化程度很高,各部门之间联系通道畅通,工作高效,客户的请求能快速得到响应。在客户服务方面,重视标准化客户服务,这些标准分为确保标准和综合标准。从总体上来看,先进的国外自来水企业在自来水市场放松管制后,更加注重智能技术和设备的采用,提高供水可靠性和质量,更加注重为客户服务的能力,充分利用自动抄表、智能水表、网络技术、呼叫中心技术、Web技术,使得响应更快、服务更好。

在国内,各级自来水企业已经完成基本的信息化建设,包括计算机局域网建设,各专业系统建设,但由于建设的标准不统一,客户的管理方式不同,加上软件开发企业水平不等,导致信息系统应用水平和技术有较大差异。自来水实时收费系统还没有被足够重视,多数企业的收费功能少,收费方式单一。对收费的研究还处在比较初级的阶段。

package com.controller;

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

import com.annotation.IgnoreAuth;
import com.entity.UserEntity;
import com.entity.YonghuxinxiEntity;
import com.service.TokenService;
import org.apache.commons.lang3.StringUtils;
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.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

import com.entity.YonghuxinxiEntity;

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

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

    @Autowired
    private YonghuxinxiService yonghuxinxiService;

    @Autowired
    private TokenService tokenService;

    /**
     * 登录
     */
    @IgnoreAuth
    @PostMapping(value = "/login")
    public R login(String username, String password, String role, HttpServletRequest request) {
        YonghuxinxiEntity user = yonghuxinxiService.selectOne(new EntityWrapper<YonghuxinxiEntity>().eq("account", username));
        if(user != null){
            if(!user.getRole().equals(role)){
                return R.error("权限不正常");
            }
            if(user==null || !user.getPassword().equals(password)) {
                return R.error("账号或密码不正确");
            }
            String token = tokenService.generateToken(user.getId(),user.getName(), "users", user.getRole());
            return R.ok().put("token", token);
        }else{
            return R.error("账号、密码或权限不正确");
        }
    }

    /**
     * 注册
     */
    @IgnoreAuth
    @PostMapping(value = "/register")
    public R register(@RequestBody YonghuxinxiEntity user){
//    	ValidatorUtils.validateEntity(user);
        if(yonghuxinxiService.selectOne(new EntityWrapper<YonghuxinxiEntity>().eq("account", user.getAccount())) !=null) {
            return R.error("用户已存在");
        }
        yonghuxinxiService.insert(user);
        return R.ok();
    }

    /**
     * 退出
     */
    @GetMapping(value = "logout")
    public R logout(HttpServletRequest request) {
        request.getSession().invalidate();
        return R.ok("退出成功");
    }

    /**
     * 密码重置
     */
    @IgnoreAuth
    @RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
        YonghuxinxiEntity user = yonghuxinxiService.selectOne(new EntityWrapper<YonghuxinxiEntity>().eq("account", username));
        if(user==null) {
            return R.error("账号不存在");
        }
        user.setPassword("123456");
        yonghuxinxiService.update(user,null);
        return R.ok("密码已重置为:123456");
    }

    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
        Integer id = (Integer)request.getSession().getAttribute("userId");
        YonghuxinxiEntity user = yonghuxinxiService.selectById(id);
        return R.ok().put("data", user);
    }


    /**
    * 后端列表
    */
    @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 = yonghuxinxiService.queryPage(params);
        }else{
            page = yonghuxinxiService.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方法");
        YonghuxinxiEntity yonghuxinxi = yonghuxinxiService.selectById(id);
        if(yonghuxinxi!=null){
            return R.ok().put("data", yonghuxinxi);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @IgnoreAuth
    @RequestMapping("/save")
    public R save(@RequestBody YonghuxinxiEntity yonghuxinxi){
        logger.debug("Controller:"+this.getClass().getName()+",save");
        Wrapper<YonghuxinxiEntity> queryWrapper = new EntityWrapper<YonghuxinxiEntity>()
            .eq("name", yonghuxinxi.getName())
            .eq("account", yonghuxinxi.getAccount());
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        YonghuxinxiEntity yonghuxinxiEntity = yonghuxinxiService.selectOne(queryWrapper);
        if("".equals(yonghuxinxi.getImgPhoto()) || "null".equals(yonghuxinxi.getImgPhoto())){
            yonghuxinxi.setImgPhoto(null);
        }
        yonghuxinxi.setRole("用户");
        yonghuxinxi.setSbTypes(1);
        yonghuxinxi.setCredit(0);
        if(yonghuxinxiEntity==null){
            yonghuxinxiService.insert(yonghuxinxi);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody YonghuxinxiEntity yonghuxinxi, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",update");
        //根据字段查询是否有相同数据
        Wrapper<YonghuxinxiEntity> queryWrapper = new EntityWrapper<YonghuxinxiEntity>()
            .notIn("id",yonghuxinxi.getId())
            .eq("name", yonghuxinxi.getName())
            .eq("account", yonghuxinxi.getAccount());
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        YonghuxinxiEntity yonghuxinxiEntity = yonghuxinxiService.selectOne(queryWrapper);
        if("".equals(yonghuxinxi.getImgPhoto()) || "null".equals(yonghuxinxi.getImgPhoto())){
                yonghuxinxi.setImgPhoto(null);
        }
        if(yonghuxinxiEntity==null){
            yonghuxinxiService.updateById(yonghuxinxi);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
     * 缴费
     */
    @RequestMapping("/payment")
    public R payment(@RequestBody Double money, HttpServletRequest request){
        logger.debug("Controller:"+this.getClass().getName()+",delete");
        YonghuxinxiEntity yonghuxinxi = yonghuxinxiService.selectById(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        Double q = yonghuxinxi.getBalance() - money;
        if(q != null && q >= 0){
            yonghuxinxi.setBalance(q);
            yonghuxinxi.setCredit(+1);
            yonghuxinxiService.updateById(yonghuxinxi);
        }else {
            return R.error("余额不足");
        }
        return R.ok();
    }


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值