基于javaweb+mysql的springboot小区物业管理系统(java+springboot+ssm+mysql+maven+jsp)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot小区物业管理系统(java+springboot+ssm+mysql+maven+jsp)
一、项目简述(+PPT演示文档)
本系统功能包括: 实现了资源管理、收费管理、支出管理、三表管理、投诉 建议、装修管理、车位管理、招商管理、物料管理、设备 管理、人事考勤、安保消防、报事报修、绿化管理、保洁 管理、权限管理等一些功能,还有一些细节功能没有实现需 要大家一起完善,提供给大家学习参考使用。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + Mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +SpringBoot + MyBatis + Json+ Css + JavaScript + JQuery + Ajax + PageHelper+ Maven等等。
mess.setStatus("未阅读");
Date date=new Date();
String time=cx.format(date);
mess.setMesstime(time);
messService.insert(mess);
return oid;
}
@RequestMapping("/sendmess")
public @ResponseBody List<String> sendmess(HttpServletRequest request,String message,Integer oid){
//System.out.println(oid);
//System.out.println(message);
String oname=ownerService.findById(oid).getOname();
Date date=new Date();
String timeString=cx.format(date);
Message mess=new Message();
mess.setMessinfo(message);
mess.setOid(oid);
mess.setStatus("未阅读");
mess.setMesstime(timeString);
messService.insert(mess);
List<String> list=new ArrayList<>();
list.add(oname);
return list;
}
}
/**
* @category 职员控制器
String a= "我的通知"+list.size();
String b="未读"+list.size();
List<String> list2=new ArrayList<>();
list2.add(a);
list2.add(b);
return list2;
}
/**
* @category 通知一键已读控制器
* @param request
* @param model
* @return
*/
@RequestMapping("/allread.action")
public String allread(HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
Owner owner=(Owner)session.getAttribute("currentOwnerr");
messService.updateByOid(owner.getOid());
model.addAttribute("nomess", "暂无通知");
model.addAttribute("readlist", null);
return "messinfo";
}
/**
* @category 给业主发送催款通知
* @param oid
* @return
*/
@RequestMapping("/cuikuan.action")
public @ResponseBody int cuikuan(int oid) {
Message mess=new Message();
mess.setMessinfo("请您及时缴纳相关费用,详情请到我的账单查看");
mess.setOid(oid);
mess.setStatus("未阅读");
Date date=new Date();
String time=cx.format(date);
mess.setMesstime(time);
messService.insert(mess);
return oid;
}
@RequestMapping("/sendmess")
public @ResponseBody List<String> sendmess(HttpServletRequest request,String message,Integer oid){
//System.out.println(oid);
//System.out.println(message);
String oname=ownerService.findById(oid).getOname();
Date date=new Date();
double listnum = list1.size();
int totalnum = (int) Math.ceil(listnum / pageSize);
List<Owner> list = FyResult.getOwnerList(pageSize, pageNum, list1, type);
if (type.equals("z")) {
++pageNum;
if (pageNum > totalnum) {
pageNum = totalnum;
}
}
if (type.equals("j")) {
--pageNum;
if (pageNum < 1) {
pageNum = 1;
}
}
if(type.equals("f")) {
if(pageNum<1) {
pageNum=1;
}
if(pageNum>totalnum) {
pageNum = totalnum;
}
}
model.addAttribute("list", list);
session.setAttribute("stop", stop);
session.setAttribute("start", start);
session.setAttribute("pageSize", pageSize);
session.setAttribute("pageNum", pageNum);
model.addAttribute("totalnum", totalnum);
return "unpay";
}
}
/**
* @category 未缴费账单控制器
*
*/
@Controller
public class BillController {
@Autowired
private BillService billService;
@Autowired
private BillitemsService bitemService;
@Autowired
private OwnerService oService;
private SimpleDateFormat cx = new SimpleDateFormat("yyyy-MM-dd");
/**
* @category 跳转至业主未缴费展示页面
* @param model
* @return
*/
@RequestMapping("/unpay")
public String unpay(Model model) {
// SimpleDateFormat cx = new SimpleDateFormat("yyyy-MM-dd");
String stop = cx.format(new Date());
List<Owner> list = billService.findByOwner();
model.addAttribute("list", list);
model.addAttribute("start", start);
model.addAttribute("stop", stop);
model.addAttribute("inputname", "请输入姓名");
return "unpay";
}
/**
* @category 通过给定时间范围展示和业主模糊姓名联合查询缴费信息
System.out.println("jinru:"+pageNum1);
List<Carport> list = carportService.findAll(1,pageNum1);
return list;
}
@RequestMapping("/findcarbystate")
public String findCarByState(Model model,String state) {
List<Carport> list = carportService.findCarByState(state);
model.addAttribute("carportlist", list);
return "carport";
}
@RequestMapping("/updatetime")
public void updatetime() {
boolean flag = carportService.updatetime();
System.out.println("flag:"+flag);
}
/**
* 购买车个更改状态
*/
@RequestMapping("/suresellcar")
public @ResponseBody boolean suresellcar(int uid,HttpSession session) {
int owneruid = (int) session.getAttribute("owneruid");
System.out.println("suresellcar:"+uid);
Carport carport = new Carport();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Date date = new Date();
String d = format.format(date);
String state = "<span style=\"color:red;font-weight: 700\">占用</span>";
carport.setDate(d);
carport.setUid(owneruid);
carport.setCid(uid);
carport.setState(state);
boolean flag = carportService.suresellcar(carport);
return flag;
}
@RequestMapping(value="/startsellcar",method=RequestMethod.POST)
public @ResponseBody boolean startsellcar(String time) {
boolean flag =false;
List<Carport> list = carportService.findAll(-1, 0);
for (Carport c : list) {
if(c.getDuration().equals(time)) {
flag = false;
return flag;
}else {
return "house";
}
else if(type.equals("y")) {
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getStatus().equals("已出售")) {
list1.add(list.get(i));
}
}
model.addAttribute("can", "y");
model.addAttribute("list", list1);
return "house";
}
return "mian";
}
/**
* @category 跳转到更新房屋信息页面
* @param model
* @param homeid
* @return
*/
@RequestMapping("/updatehouse")
public String updatehouse(Model model,@RequestParam ("homeid") int homeid) {
Housenumber house=hService.selectByPrimaryKey(homeid);
model.addAttribute("house", house);
return "updatehouse";
}
/**
* @category 跟新房屋信息
* @param model
* @param house
* @return
*/
@RequestMapping("/updatehouse1")
public String updatehouse1(Model model, Housenumber house) {
String type=house.getStatus();
if(type.equals("闲置")) {
type="x";
}else if(type.equals("已出售")) {
type="y";
}
System.out.println(house.getStatus());
hService.updateByPrimaryKeySelective(house);
model.addAttribute("house", house);
return "redirect:showhouse.action?type="+type;
}
/**
* @category 添加新的闲置房屋
* @param model
--pageNum;
}
session.setAttribute("pageSize", pageSize);
PageRequest pageQuery = new PageRequest();
pageQuery.setPageNum(pageNum);
pageQuery.setPageSize(pageSize);
PageResult pageResult = ownerService.findPage(pageQuery);
model.addAttribute("pageResult", pageResult);
return "customer";
}
/**
* 分类查询住户集合
*/
@RequestMapping("list2")
public String ownerlist2(Model model,int towernum) {
List<Owner> list=ownerService.findownerlist(towernum);
model.addAttribute("list", list);
return "list2";
}
@RequestMapping("/findpages2")
public String findPage1(int pageSize, Model model, HttpSession session) {
System.out.println("进来了");
System.out.println(pageSize);
PageRequest pageQuery = new PageRequest();
pageQuery.setPageNum(1);
pageQuery.setPageSize(pageSize);
session.setAttribute("pageSize", pageSize);
PageResult pageResult = ownerService.findPage(pageQuery);
model.addAttribute("pageResult", pageResult);
return "customer";
}
/**
* 根据id 完成时间 提交时间 模糊查询
* @param model
* @param md
* @return
*/
@RequestMapping("/findMain2")
public String findMain(Model model,String mds) {
System.out.println("+++++++++++++");
System.out.println(mds);
List<Owner>list3 = ownerService.findMain(mds);
model.addAttribute("list", list3);
return "list2";
}
}
System.out.println("jinru:"+pageNum1);
List<Carport> list = carportService.findAll(1,pageNum1);
return list;
}
@RequestMapping("/findcarbystate")
public String findCarByState(Model model,String state) {
List<Carport> list = carportService.findCarByState(state);
model.addAttribute("carportlist", list);
return "carport";
}
@RequestMapping("/updatetime")
public void updatetime() {
boolean flag = carportService.updatetime();
System.out.println("flag:"+flag);
}
/**
* 购买车个更改状态
*/
@RequestMapping("/suresellcar")
public @ResponseBody boolean suresellcar(int uid,HttpSession session) {
int owneruid = (int) session.getAttribute("owneruid");
System.out.println("suresellcar:"+uid);
Carport carport = new Carport();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Date date = new Date();
String d = format.format(date);
String state = "<span style=\"color:red;font-weight: 700\">占用</span>";
carport.setDate(d);
carport.setUid(owneruid);
carport.setCid(uid);
carport.setState(state);
boolean flag = carportService.suresellcar(carport);
return flag;
}
@RequestMapping(value="/startsellcar",method=RequestMethod.POST)
public @ResponseBody boolean startsellcar(String time) {
boolean flag =false;
List<Carport> list = carportService.findAll(-1, 0);
for (Carport c : list) {
if(c.getDuration().equals(time)) {
flag = false;
return flag;
}else {
flag = true;
}
}
if(flag) {
flag = carportService.sellCar(time);
}
return flag;
list1 = carportService.findCarByArea("D");
model.addAttribute("D", list1);
model.addAttribute("count", count);
System.out.println("mycarseat:"+uid);
List<Carport> list = carportService.findMyCarSeat(uid);
model.addAttribute("carport1", list);
for (Carport c : list) {
System.out.println(c.getDate());
}
return "mycarseat";
}
/**
* 展示用户
*/
@RequestMapping("/showoerme")
public String showownerme(Model model,HttpSession session){
System.out.println("============");
int oid1 = (int) session.getAttribute("owneruid");
System.out.println(oid1);
if(oid1!=0) {
Owner onwer=ownerService.findById(oid1);
model.addAttribute("onwer", onwer);
return "showoerme";
}else {
return "login";
}
}
/**
* owner页面首页
*/
@RequestMapping("/mymianmessage")
public String mymianmessage(){
return "mymianmessage";
}
/**
* 个人信息更改
*/
@RequestMapping("/updateowenerss")
public String updateowenerss(Model model, @RequestParam(value = "oid", defaultValue = "0") int oid,HttpSession session) {
int oid1 = (int) session.getAttribute("owneruid");
Owner owner=ownerService.findById(oid1);
System.out.println("+++++++++++++>>>>>>>>");
System.out.println("onwe.id: "+owner.getOid());
model.addAttribute("owner",owner );
carport.setUid(owneruid);
carport.setCid(uid);
carport.setState(state);
boolean flag = carportService.suresellcar(carport);
return flag;
}
@RequestMapping(value="/startsellcar",method=RequestMethod.POST)
public @ResponseBody boolean startsellcar(String time) {
boolean flag =false;
List<Carport> list = carportService.findAll(-1, 0);
for (Carport c : list) {
if(c.getDuration().equals(time)) {
flag = false;
return flag;
}else {
flag = true;
}
}
if(flag) {
flag = carportService.sellCar(time);
}
return flag;
}
@RequestMapping("/sellcar")
public String sellcar(Model model) {
List<Carport> list = carportService.findCarByState("未使用");
int count = list.size();
List<Carport> list1 = new ArrayList<Carport>();
list1 = carportService.findCarByArea("A");
model.addAttribute("A", list1);
list1 = carportService.findCarByArea("B");
model.addAttribute("B", list1);
list1 = carportService.findCarByArea("C");
model.addAttribute("C", list1);
list1 = carportService.findCarByArea("D");
model.addAttribute("D", list1);
model.addAttribute("count", count);
return "sellcar";
}
}
}
}
@RequestMapping("/checktel")
public @ResponseBody String checkname(HttpServletRequest request) {
String otel =request.getParameter("name");
System.out.println(ownerService.findByTel(otel));
return ownerService.findByTel(otel);
}
/**
* 退出控制器
*/
@RequestMapping("/exit")
public String exit(HttpSession session, HttpServletRequest request, Model model) {
System.out.println("exit");
// 获取当前的session
HttpSession session1 = request.getSession();
// 销毁session
session1.invalidate();
return "redirect:home.action";
}
/**
* 查询所有的业主信息
*/
@RequestMapping("/ownerlist")
public String ownerlist(Model model) {
List<Owner> list=ownerService.selectByExample();
model.addAttribute("list", list);
System.out.println(list.size());
return "customer";
}
/**
* 客户修改控制器
*/
@RequestMapping("/updateuser")
public String updateuser(Model model, @RequestParam(value = "oid", defaultValue = "0") int oid) {
Owner owner = ownerService.findById(oid);
model.addAttribute("owner", owner);
return "updateuser";
}
/**
* 更新保存
* @return
*/
@RequestMapping("/save")
public String save(Owner owner, Model model) {
ownerService.updatesave(owner);
return "redirect:findpagess.action?pageSize=5&pageNum=1&str=n";
public class CaptchaController {
@RequestMapping("/captcha")
public void getCaptcha(HttpServletResponse response,HttpSession session) {
try {
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");
response.setContentType("image/jpeg");
OutputStream os = response.getOutputStream();
// 返回验证码和图片的map
Map<String, Object> map = Captcha.getImageCode(86, 37, os);
String simpleCaptcha = "simpleCaptcha";
session.setAttribute(simpleCaptcha, map.get("strEnsure").toString().toLowerCase());
session.setAttribute("codeTime", new Date().getTime());
ImageIO.write((BufferedImage) map.get("image"), "jpg", os);
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* @category 装修控制器
*
*/
@Controller
public class AdornController {
@Autowired
AdornService adornService;
/**
@Controller
@RequestMapping(value = "/Alipay")
public class AlipayController {
@Autowired
private BillService billService;
@RequestMapping("/PayPage")
public void payController(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("---------------------------------------------------");
// 获取初始化的AlipayClient
AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id,
AlipayConfig.APP_PRIVATE_KEY, "json", AlipayConfig.charset, AlipayConfig.alipay_public_key,
AlipayConfig.sign_type);
// 设置请求参数
AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();
alipayRequest.setReturnUrl(AlipayConfig.return_url);
alipayRequest.setNotifyUrl(AlipayConfig.notify_url);
// 商户订单号,商户网站订单系统中唯一订单号,必填
// String out_trade_no = request.getParameter("Order");
// 付款金额,必填 ShopName
// String total_amount = request.getParameter("Money");
// 订单名称,必填
// String subject = request.getParameter("Name");
// 商品描述,可空
// String body = "ssssss";
String out_trade_no = new String(request.getParameter("Order").getBytes("ISO-8859-1"), "UTF-8");
// 付款金额,必填
String total_amount = new String(request.getParameter("Money").getBytes("ISO-8859-1"), "UTF-8");
// 订单名称,必填
String subject =request.getParameter("Name");
// 商品描述,可空
String body = request.getParameter("body");
System.out.println(subject);
// 该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。
// 该参数数值不接受小数点, 如 1.5h,可转换为 90m。
alipayRequest.setBizContent("{\"out_trade_no\":\"" + out_trade_no + "\"," + "\"total_amount\":\"" + total_amount
+ "\"," + "\"subject\":\"" + subject + "\"," + "\"body\":\"" + body + "\","
+ "\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}");
}
model.addAttribute("can", "x");
model.addAttribute("list", list1);
return "house";
}
else if(type.equals("y")) {
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getStatus().equals("已出售")) {
list1.add(list.get(i));
}
}
model.addAttribute("can", "y");
model.addAttribute("list", list1);
return "house";
}
return "mian";
}
/**
* @category 跳转到更新房屋信息页面
* @param model
* @param homeid
* @return
*/
@RequestMapping("/updatehouse")
public String updatehouse(Model model,@RequestParam ("homeid") int homeid) {
Housenumber house=hService.selectByPrimaryKey(homeid);
model.addAttribute("house", house);
return "updatehouse";
}
/**
* @category 跟新房屋信息
* @param model
* @param house
* @return
*/
@RequestMapping("/updatehouse1")
public String updatehouse1(Model model, Housenumber house) {
String type=house.getStatus();
if(type.equals("闲置")) {
type="x";
}else if(type.equals("已出售")) {
type="y";
}
System.out.println(house.getStatus());
hService.updateByPrimaryKeySelective(house);
model.addAttribute("house", house);
return "redirect:showhouse.action?type="+type;
public String FacilityUpdate(int facilityid, Model model) {
System.out.println(facilityid + "我进来了!!!!!!");
Facility facility = facilityService.find(facilityid);
model.addAttribute("facility", facility);
return "updatefacility";
}
// 更新页面提交数据返回查找控制器
@RequestMapping("/facilityupdatesave")
public String ClerkUpdate(Facility facility) {
boolean flag = facilityService.update(facility);
return "redirect:facilityselectall.action";
}
}
@Controller
public class ComplainController {
@Autowired
ComplainService complainService;
ComplainExample complainExample = new ComplainExample() ;
@RequestMapping("/main")
public String test() {
return "main";
}
/**
* 全部投诉信息
*/
@RequestMapping("/complain")
public String complain(Model model) {
List<Complain> list =complainService.findAll();
model.addAttribute("complainlist", list);
return "complain";
}
return "myjingbiao";
}
@RequestMapping("/savejingbianman")
public String savejingbianman(int bid, Tender tender, Model model, HttpSession session) {
biddingService.updateOne(bid);
try {
Thread.sleep(1000);
tenderService.addOne(tender);
} catch (InterruptedException e) {
e.printStackTrace();
}
session.setAttribute("userTel", tender.getTel());
return "redirect:jingbiao.action";
}
@RequestMapping("/jingbiao")
public String jingbiao(Model model) {
List<Bidding> list = biddingService.findAll();
model.addAttribute("biddinglist", list);
return "jingbiao";
}
@RequestMapping("/deletemyjingbiao")
public String deletemyjingbiao(int tid) {
System.out.println("deletemyjingbiao:" + tid);
tenderService.deleteTenderOne(tid);
return "redirect:jingbiao.action";
}
/**
* 通过audit字段查找list
*/
@RequestMapping("/auditingbyaudit")
public String auditingbyaudit(Model model, String audit) {
List<Tender> list = tenderService.findByAudit(audit);
model.addAttribute("adornShowList", list);
return "audit";
}
@RequestMapping("/auditingbyliftstate")
public String auditingbyliftstate(Model model, int liftstate) {
List<Tender> list = tenderService.findByLiftstate(liftstate);
model.addAttribute("adornShowList", list);
return "audit";
}
/**
* 拒绝竞标控制
*/
@RequestMapping("/refuse")
// 模糊查询
@RequestMapping("/facilityselectlike")
public String FacilitySelectLike(String like, Model model) {
List<Facility> list = facilityService.findLike(like);
model.addAttribute("FacilitySelectAll", list);
return "facilitylist";
}
// 进入添加页面
@RequestMapping("/facilityAdd")
public String FacilityAdd() {
return "facilityadd";
}
// 添加设备
@RequestMapping("/facilityAddSave")
public String FacilityAddSave(Facility facility) {
boolean flag = facilityService.insert(facility);
return "redirect:facilityselectall.action";
}
// 删除设备
@RequestMapping("/facilityDelete")
public String facilityDelete(int[] facilityids) {
boolean flag = facilityService.delete(facilityids);
return "redirect:facilityselectall.action";
}
// 进入更新职员页面
@RequestMapping("/facilityupdate")
public String FacilityUpdate(int facilityid, Model model) {
System.out.println(facilityid + "我进来了!!!!!!");
Facility facility = facilityService.find(facilityid);
model.addAttribute("facility", facility);
return "updatefacility";
}
// 更新页面提交数据返回查找控制器
@RequestMapping("/facilityupdatesave")
public String ClerkUpdate(Facility facility) {
boolean flag = facilityService.update(facility);
return "redirect:facilityselectall.action";
}
}