基于javaweb+mysql的ssm+maven物业缴费管理系统(java+ssm+js+jsp+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven物业缴费管理系统(java+ssm+js+jsp+mysql)
项目介绍
管理员角色包含以下功能: 管理员登录,管理员管理,住户管理,缴费列表,公告列表管理,用户反馈管理等功能。
用户角色包含以下功能: 用户登录,查看公告,基本信息修改,用户密码修改,反馈问题,查看个人缴费并缴费,账户充值等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
return "notice/notice";
}
/*********************************查询列表【分页】***********************************************/
/**
* 分页查询 返回list对象(通过对象)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(Notice notice, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<Notice> pagers = noticeService.findByEntity(notice);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", notice);
return "notice/notice";
}
/**
* 分页查询 返回list对象(通过对By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Notice notice, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM notice WHERE 1=1 and isDelete = 0 ";
if(!isEmpty(notice.getContent())){
sql += " and content like '%"+notice.getContent()+"%'";
}
if(!isEmpty(notice.getAddTime())){
sql += " and addTime like '%"+notice.getAddTime()+"%'";
}
if(!isEmpty(notice.getIsDelete())){
sql += " and isDelete like '%"+notice.getIsDelete()+"%'";
}
if(!isEmpty(notice.getName())){
sql += " and name like '%"+notice.getName()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Notice> pagers = noticeService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", notice);
return "notice/notice";
*/
@Autowired
private UserService userService;
// --------------------------------------- 华丽分割线 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* 【不分页 => 查询列表 => 无条件】
* @Title: listAll
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAll")
public String listAll(User user, Model model, HttpServletRequest request, HttpServletResponse response){
List<User> listAll = userService.listAll();
model.addAttribute("list", listAll);
return "user/user";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByEntity
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByEntity")
public String listByEntity(User user, Model model, HttpServletRequest request, HttpServletResponse response){
List<User> listAll = userService.listAllByEntity(user);
model.addAttribute("list", listAll);
return "user/user";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
String sql = "SELECT * FROM notice WHERE 1=1 and isDelete = 0 ";
if(!isEmpty(notice.getContent())){
sql += " and content like '%"+notice.getContent()+"%'";
}
if(!isEmpty(notice.getAddTime())){
sql += " and addTime like '%"+notice.getAddTime()+"%'";
}
if(!isEmpty(notice.getIsDelete())){
sql += " and isDelete like '%"+notice.getIsDelete()+"%'";
}
if(!isEmpty(notice.getName())){
sql += " and name like '%"+notice.getName()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Notice> pagers = noticeService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", notice);
return "notice/notice";
}
/**
* 分页查询 返回list对象(通过Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Notice notice, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(notice.getContent())){
params.put("content", notice.getContent());
}
if(!isEmpty(notice.getAddTime())){
params.put("addTime", notice.getAddTime());
}
if(!isEmpty(notice.getIsDelete())){
params.put("isDelete", notice.getIsDelete());
}
if(!isEmpty(notice.getName())){
params.put("name", notice.getName());
}
//分页查询
Pager<Notice> pagers = noticeService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", notice);
return "notice/notice";
Pager<User> pagers = userService.findByEntity(user);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", user);
return "user/user";
}
/**
* 分页查询 返回list对象(通过对By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM user WHERE 1=1 and isDelete = 0 ";
if(!isEmpty(user.getName())){
sql += " and name like '%"+user.getName()+"%'";
}
if(!isEmpty(user.getPassword())){
sql += " and password like '%"+user.getPassword()+"%'";
}
if(!isEmpty(user.getPhone())){
sql += " and phone like '%"+user.getPhone()+"%'";
}
if(!isEmpty(user.getXq())){
sql += " and xq like '%"+user.getXq()+"%'";
}
if(!isEmpty(user.getLh())){
sql += " and lh like '%"+user.getLh()+"%'";
}
if(!isEmpty(user.getDy())){
sql += " and dy like '%"+user.getDy()+"%'";
}
if(!isEmpty(user.getMph())){
sql += " and mph like '%"+user.getMph()+"%'";
}
if(!isEmpty(user.getMoney())){
sql += " and money like '%"+user.getMoney()+"%'";
}
if(!isEmpty(user.getIsDelete())){
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByMap")
public String listByMap(Message message, Model model, HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(message.getUserId())){
params.put("userId", message.getUserId());
}
if(!isEmpty(message.getContent())){
params.put("content", message.getContent());
}
if(!isEmpty(message.getAddTime())){
params.put("addTime", message.getAddTime());
}
if(!isEmpty(message.getIsDelete())){
params.put("isDelete", message.getIsDelete());
}
List<Message> listAll = messageService.listByMap(params);
model.addAttribute("list", listAll);
return "message/message";
}
/*********************************查询列表【分页】***********************************************/
/**
* 分页查询 返回list对象(通过对象)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(Message message, Model model, HttpServletRequest request, HttpServletResponse response) {
model.addAttribute("obj",obj);
return "user/view";
}
/**
* 添加执行
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
user.setIsDelete(0);
user.setPassword("111111");
user.setMoney(new BigDecimal(0));
userService.insert(user);
return "redirect:/user/findBySql.action";
}
/**
* 跳至修改页面
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
User obj = userService.load(id);
model.addAttribute("obj",obj);
return "user/update";
}
/**
* 添加修改
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
userService.updateById(user);
//2.通过主键id修改
//userService.updateById(user);
return "redirect:/user/findBySql.action";
}
/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
User load = userService.load(id);
load.setIsDelete(1);
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByMap")
public String listByMap(Notice notice, Model model, HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(notice.getContent())){
params.put("content", notice.getContent());
}
if(!isEmpty(notice.getAddTime())){
params.put("addTime", notice.getAddTime());
}
if(!isEmpty(notice.getIsDelete())){
params.put("isDelete", notice.getIsDelete());
}
if(!isEmpty(notice.getName())){
params.put("name", notice.getName());
}
List<Notice> listAll = noticeService.listByMap(params);
model.addAttribute("list", listAll);
return "notice/notice";
}
/*********************************查询列表【分页】***********************************************/
/**
* 分页查询 返回list对象(通过对象)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(Notice notice, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<Notice> pagers = noticeService.findByEntity(notice);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", notice);
return "notice/notice";
}
//User load = userService.load(id);
//load.setIsDelete(1);
//userService.updateById(load);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", "删除成功");
return jsonObject.toString();
}
/**
* 单文件上传
* @param file
* @param request
* @param model
* @return
*/
@RequestMapping(value = "/saveFile")
public String saveFile(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, Model model) {
System.out.println("开始");
String path = request.getSession().getServletContext().getRealPath("/upload");
String fileName = file.getOriginalFilename();
System.out.println(path);
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.mkdirs();
}
//保存
try {
file.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
* springMvc多文件上传
* @param files
* @param id
* @return
*/
@RequestMapping(value = "/saveFiles")
public String saveFiles(@RequestParam("file") CommonsMultipartFile[] files,Integer id,HttpServletRequest request){
for(int i = 0;i<files.length;i++){
System.out.println("fileName---------->" + files[i].getOriginalFilename());
if(!files[i].isEmpty()){
int pre = (int) System.currentTimeMillis();
try {
//拿到输出流,同时重命名上传的文件
String filePath = request.getRealPath("/upload");
System.out.println("fileName---------->" + files[i].getOriginalFilename());
if(!files[i].isEmpty()){
int pre = (int) System.currentTimeMillis();
try {
//拿到输出流,同时重命名上传的文件
String filePath = request.getRealPath("/upload");
File f=new File(filePath);
if(!f.exists()){
f.mkdirs();
}
String fileNmae=new Date().getTime() + files[i].getOriginalFilename();
File file=new File(filePath+"/"+pre + files[i].getOriginalFilename());
if(!file.exists()){
file.createNewFile();
}
files[i].transferTo(file);
} catch (Exception e) {
e.printStackTrace();
System.out.println("上传出错");
}
}
}
return "";
}
// --------------------------------------- 华丽分割线 ------------------------------
}
* 依赖注入 start dao/service/===
*/
@Autowired
private UserService userService;
// --------------------------------------- 华丽分割线 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* 【不分页 => 查询列表 => 无条件】
* @Title: listAll
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAll")
public String listAll(User user, Model model, HttpServletRequest request, HttpServletResponse response){
List<User> listAll = userService.listAll();
model.addAttribute("list", listAll);
return "user/user";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByEntity
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByEntity")
public String listByEntity(User user, Model model, HttpServletRequest request, HttpServletResponse response){
List<User> listAll = userService.listAllByEntity(user);
model.addAttribute("list", listAll);
return "user/user";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
//存储查询条件
model.addAttribute("obj", message);
return "message/message2";
}
/**
* 分页查询 返回list对象(通过Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Message message, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(message.getUserId())){
params.put("userId", message.getUserId());
}
if(!isEmpty(message.getContent())){
params.put("content", message.getContent());
}
if(!isEmpty(message.getAddTime())){
params.put("addTime", message.getAddTime());
}
if(!isEmpty(message.getIsDelete())){
params.put("isDelete", message.getIsDelete());
}
//分页查询
Pager<Message> pagers = messageService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", message);
return "message/message";
}
/**********************************【增删改】******************************************************/
/**
* 跳至添加页面
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "message/add";
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAll")
public String listAll(ItemOrder itemOrder, Model model, HttpServletRequest request, HttpServletResponse response){
List<ItemOrder> listAll = itemOrderService.listAll();
model.addAttribute("list", listAll);
return "itemOrder/itemOrder";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByEntity
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByEntity")
public String listByEntity(ItemOrder itemOrder, Model model, HttpServletRequest request, HttpServletResponse response){
List<ItemOrder> listAll = itemOrderService.listAllByEntity(itemOrder);
model.addAttribute("list", listAll);
return "itemOrder/itemOrder";
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByMap")
public String listByMap(ItemOrder itemOrder, Model model, HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(itemOrder.getUserId())){
params.put("userId", itemOrder.getUserId());
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(ItemOrder itemOrder, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
User load = userService.load(itemOrder.getUserId());
itemOrder.setUserName(load.getName());
itemOrderService.updateById(itemOrder);
//2.通过主键id修改
//itemOrderService.updateById(itemOrder);
return "redirect:/itemOrder/findBySql.action";
}
/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
ItemOrder load = itemOrderService.load(id);
load.setIsDelete(1);
itemOrderService.updateById(load);
return "redirect:/itemOrder/findBySql.action";
}
// --------------------------------------- 华丽分割线 ------------------------------
// --------------------------------------- 【下面是ajax操作的方法。】 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* 【不分页 => 查询列表 => 无条件】
* @Title: listAll
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listAllJson", method = RequestMethod.POST)
@ResponseBody
public String listAllJson(ItemOrder itemOrder, HttpServletRequest request, HttpServletResponse response){
List<ItemOrder> listAll = itemOrderService.listAll();
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", itemOrder);
return jsonObject.toString();
if (attribute == null){
return "login/uLogin";
}
Integer valueOf = Integer.valueOf(attribute.toString());
User byId = userService.getById(valueOf);
byId.setPhone(user.getPhone());
byId.setName(user.getName());
byId.setXq(user.getXq());
byId.setLh(user.getLh());
byId.setDy(user.getDy());
byId.setMph(user.getMph());
userService.updateById(byId);
return "redirect:/login/info";
}
@RequestMapping("/mup")
public String mpass(){
return "login/mup";
}
@RequestMapping("/mpass")
@ResponseBody
public String mpass(String newpass , String yuan,String que,HttpServletRequest request,HttpServletResponse response){
Object attribute = request.getSession().getAttribute("userId");
JSONObject jsonObject = new JSONObject();
if (attribute == null){
jsonObject.put("res", -1);
jsonObject.put("msg", "登录失效请重新登录!");
return jsonObject.toString();
}
Integer loginId = Integer.valueOf(attribute.toString());
User byId = userService.getById(loginId);
if (!newpass.equals(que)){
jsonObject.put("res", 0);
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", user);
return jsonObject.toString();
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByEntity
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByEntityJson", method = RequestMethod.POST)
@ResponseBody
public String listByEntityJson(User user, HttpServletRequest request, HttpServletResponse response){
List<User> listAll = userService.listAllByEntity(user);
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", user);
return jsonObject.toString();
}
/**
* 【不分页=》查询列表=>有条件】
* @Title: listByMap
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
@RequestMapping(value = "/listByMapJson", method = RequestMethod.POST)
@ResponseBody
public String listByMapJson(User user,HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(user.getName())){
params.put("name", user.getName());
}
if(!isEmpty(user.getPassword())){
params.put("password", user.getPassword());
}
if(!isEmpty(user.getPhone())){
params.put("phone", user.getPhone());
}
if(!isEmpty(user.getXq())){
params.put("xq", user.getXq());
}
if(!isEmpty(user.getLh())){
}
@Controller
@RequestMapping("/login")
public class LoginController extends BaseController{
@Autowired
private ManageService manageService;
@Autowired
private UserService userService;
/**
* 跳转登陆
* @return
*/
@RequestMapping("/login")
public String login(){
return "login/login";
}
@RequestMapping("/uLogin")
public String uLogin(){
return "login/uLogin";
}
@RequestMapping("/index")
public String index(){
// //通过map查询
// Map<String,Object> params = new HashMap<String,Object>();
//
// if(!isEmpty(user.getName())){
// params.put("name", user.getName());
// }
//
// if(!isEmpty(user.getPassword())){
// params.put("password", user.getPassword());
// }
//
// if(!isEmpty(user.getPhone())){
// params.put("phone", user.getPhone());
// }
//
// if(!isEmpty(user.getXq())){
// params.put("xq", user.getXq());
// }
//
// if(!isEmpty(user.getLh())){
// params.put("lh", user.getLh());
// }
//
// if(!isEmpty(user.getDy())){
// params.put("dy", user.getDy());
// }
//
// if(!isEmpty(user.getMph())){
// params.put("mph", user.getMph());
// }
//
// if(!isEmpty(user.getMoney())){
// params.put("money", user.getMoney());
// }
//
// if(!isEmpty(user.getIsDelete())){
// params.put("isDelete", user.getIsDelete());
// }
//
// userService.deleteByMap(params);
// //4.状态删除
// User load = userService.getById(user.getId())
// load.setIsDelete(1);
// userService.updateById(load);
//5.状态删除
//User load = userService.load(id);
//load.setIsDelete(1);
//userService.updateById(load);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", "删除成功");