• Java项目:房屋租赁管理系统(java+SpringBoot+Vue+Maven+Mysql)


    源码获取:俺的博客首页 "资源" 里下载!

    一、项目运行

    环境配置:

    Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

    项目技术:

    Spring + SpringBoot+ mybatis + Maven + Vue 等等组成,B/S模式 + Maven管理等等。
     

     

     

     

     

     

    用户控制器:

    1. /**
    2. * 用户控制器
    3. *
    4. * @author yy
    5. *
    6. */
    7. @Controller
    8. @RequestMapping("/userlistmvc")
    9. public class UserListController {
    10. private static final long serialVersionUID = -884689940866074733L;
    11. @Resource
    12. private UserlistService userlistService;
    13. @Resource
    14. private AdminListService adminListService;
    15. @Resource
    16. private HeadPortraitImgService headPortraitImgService;
    17. @Resource
    18. private CheckoutapplicationService checkoutapplicationService;
    19. /**
    20. * 登录
    21. */
    22. @RequestMapping("/userpwd")
    23. public String userpwd(String username, String pwd, String[] identity, HttpServletRequest request) {
    24. HttpSession session = request.getSession();
    25. if (username.equals("") || pwd.equals("")) {
    26. request.setAttribute("erorr", "输入账号密码不能为空!");
    27. return "login";
    28. }
    29. String tempstr = null;
    30. try {
    31. if (identity[0].equals("user")) {
    32. userlist temp = new userlist();
    33. temp.setUsercall(username);
    34. temp.setUserpwd(pwd);
    35. userlist userlist = userlistService.queryAllUserPwd(temp);
    36. try {
    37. tempstr = userlist.getUsercall();
    38. if (tempstr != null) {
    39. session.setAttribute("user", tempstr);
    40. headportraitimg headportraitimg = headPortraitImgService.selectheadportrait(tempstr);
    41. if (headportraitimg.getHeadportraitimgaddress() != null) {
    42. session.setAttribute("headportraitimg", headportraitimg.getHeadportraitimgaddress());
    43. }
    44. return "official";
    45. }
    46. } catch (NullPointerException e) {
    47. if (tempstr == null) {
    48. request.setAttribute("erorr", "输入账号密码有误!");
    49. return "login";
    50. } else {
    51. return "official";
    52. }
    53. }
    54. }
    55. if (identity[0].equals("admin")) {
    56. adminlist temp = new adminlist();
    57. temp.setAdminname(username);
    58. temp.setAdminpwd(pwd);
    59. adminlist adminlist = adminListService.findAllAdminPwd(temp);
    60. try {
    61. tempstr = adminlist.getAdminname();
    62. if (tempstr != null) {
    63. session.setAttribute("admin", tempstr);
    64. return "BackgroundHome";
    65. }
    66. } catch (NullPointerException e) {
    67. request.setAttribute("erorr", "输入账号密码有误!");
    68. return "login";
    69. }
    70. }
    71. } catch (NullPointerException e) {
    72. request.setAttribute("erorr", "选择登录方式!");
    73. e.printStackTrace();
    74. return "login";
    75. }
    76. return "login";
    77. }
    78. /**
    79. * 注册
    80. */
    81. @RequestMapping("/register")
    82. public String register(String usercall, String userpwd, String userphone, HttpServletRequest request) {
    83. if (usercall.equals("") || userpwd.equals("") || userphone.equals("")) {
    84. request.setAttribute("erorr", "输入账号密码不能为空!");
    85. return "register";
    86. }
    87. userlist user = new userlist();
    88. user.setUsercall(usercall);
    89. user.setUserphone(userphone);
    90. user.setUserpwd(userpwd);
    91. userlistService.insert(user);
    92. headportraitimg userimg = new headportraitimg();
    93. userimg.setHeadportraitimgusername(usercall);
    94. headPortraitImgService.insertuserimg(userimg);
    95. return "login";
    96. }
    97. /**
    98. * 获取手机验证码
    99. **/
    100. @RequestMapping("/getcode")
    101. public void getcode(String userphone, HttpServletResponse response, HttpServletRequest request) {
    102. response.setCharacterEncoding("UTF-8");
    103. try {
    104. HttpSession session = request.getSession();
    105. String code = "123456";
    106. // String code = Code.getNum(userphone);
    107. System.out.println(code);
    108. session.setAttribute("code", code);
    109. } catch (Exception e) {
    110. // TODO Auto-generated catch block
    111. e.printStackTrace();
    112. }
    113. }
    114. /**
    115. * 判断验证码输入后登陆
    116. **/
    117. @RequestMapping("/phonecod")
    118. public String phonecod(String userphone, String code, HttpServletRequest request) {
    119. HttpSession session = request.getSession();
    120. if (userphone.equals("") || code.equals("")) {
    121. request.setAttribute("erorr", "手机号或者验证码为空!");
    122. return "login";
    123. }
    124. System.out.println(code);
    125. if (code.equals(session.getAttribute("code"))) {
    126. userlist user = userlistService.selectUserPhone(userphone);
    127. if (user != null) {
    128. String tempstr = null;
    129. userlist userlist = userlistService.selectUserPhone(userphone);
    130. tempstr = userlist.getUsercall();
    131. if (tempstr != null) {
    132. session.setAttribute("user", tempstr);
    133. headportraitimg headportraitimg = headPortraitImgService.selectheadportrait(tempstr);
    134. if (headportraitimg.getHeadportraitimgaddress() != null) {
    135. session.setAttribute("headportraitimg", headportraitimg.getHeadportraitimgaddress());
    136. }
    137. return "official";
    138. }
    139. } else {
    140. request.setAttribute("erorr", "该手机号未注册!");
    141. return "login";
    142. }
    143. } else {
    144. request.setAttribute("erorr", "验证码错误!");
    145. return "login";
    146. }
    147. return "login";
    148. }
    149. /**
    150. * 修改密码
    151. */
    152. @RequestMapping("/updatepwd")
    153. public String updatepwd(String code, String userphone, String userpwd, HttpServletRequest request) {
    154. if (code.equals("") || userphone.equals("") || userpwd.equals("")) {
    155. request.setAttribute("erorr", "手机号,验证码,新密码不能为空!");
    156. return "updatepwd";
    157. }
    158. HttpSession session = request.getSession();
    159. if (code.equals(session.getAttribute("code"))) {
    160. userlist userlist = userlistService.selectUserPhone(userphone);
    161. userlist.setUserpwd(userpwd);
    162. userlistService.updatepwd(userlist);
    163. return "login";
    164. }
    165. return userpwd;
    166. }
    167. /**
    168. * 注销
    169. */
    170. @RequestMapping("/cancellation")
    171. public String cancellation(HttpServletRequest request) {
    172. HttpSession session = request.getSession();
    173. session.removeAttribute("user");
    174. System.out.println("注销成功");
    175. return "official";
    176. }
    177. /**
    178. * 申请看房
    179. */
    180. @RequestMapping("/apply")
    181. @ResponseBody
    182. public ModelAndView apply(HttpSession session, HttpServletRequest request, String housemoney, String housecall,
    183. String houseaddress,String housesize) {
    184. ModelAndView mav = new ModelAndView("official");
    185. //令牌验证
    186. if(!new Koken().kokenid(request, session)) {
    187. return mav;
    188. }
    189. mav.addObject("news", "official");
    190. if ((String) session.getAttribute("user") == null) {
    191. mav.addObject("apply", "请先登录!");
    192. return mav;
    193. }
    194. // 查询所有数据
    195. userlist user = userlistService.selectUserCall((String) session.getAttribute("user"));
    196. if (user.getUsername() == null) {// 判断真实姓名是否为空
    197. mav.addObject("apply", "请绑定真实姓名后再租赁房屋!");
    198. return mav;
    199. } else {
    200. checkoutapplication coa = new checkoutapplication();
    201. coa.setCoausername(user.getUsername());
    202. coa.setCoauserid(user.getUserid());
    203. coa.setCoauserphone(user.getUserphone());
    204. coa.setCoahouseid(housecall);
    205. coa.setCoahouseaddress(houseaddress);
    206. coa.setCoahouseprice(Double.parseDouble(housemoney));
    207. coa.setCoahousesize(Double.parseDouble(housesize));
    208. coa.setCoastate("看房申请中");
    209. String temp=checkoutapplicationService.insertApply(coa);
    210. mav.addObject("apply", temp);
    211. }
    212. return mav;
    213. }
    214. }

    管理员控制层:

    1. @Controller
    2. @RequestMapping("/admin")
    3. public class Adminfunctioncontroller {
    4. @Resource
    5. private RentwithdrawnService rentwithdrawnService;
    6. @Resource
    7. private LeaseinformationService leaseinformationService;
    8. @Resource
    9. private CheckoutapplicationService checkoutapplicationService;
    10. @Resource
    11. private MydailylifeService mydailylifeService;
    12. @Resource
    13. private RentcollectionService rentcollectionService;
    14. @Resource
    15. private FaultService faultService;
    16. @Resource
    17. private UserlistService userlistService;
    18. @Resource
    19. private LeaseimgService leaseimgService;
    20. @Resource
    21. private HeadPortraitImgService headPortraitImgService;
    22. /**
    23. * 注销
    24. */
    25. @RequestMapping("/admincancel")
    26. public String cancellation(HttpServletRequest request) {
    27. HttpSession session = request.getSession();
    28. session.removeAttribute("admin");
    29. System.out.println("注销成功");
    30. return "official";
    31. }
    32. @RequestMapping("/details")
    33. public ModelAndView listCategory(@RequestParam int pn) {
    34. ModelAndView mav = new ModelAndView("rentingdel");
    35. // 设置分页传输
    36. PageHelper.startPage(pn, 10);
    37. // 查询所有数据
    38. List<rentwithdrawn> list = rentwithdrawnService.selectRwState("已退租");
    39. // 使用PageInFo封装查询结果
    40. PageInfo<rentwithdrawn> pageInfo = new PageInfo<rentwithdrawn>(list, 5);
    41. // 放入转发参数
    42. mav.addObject("cs", pageInfo);
    43. return mav;
    44. }
    45. @RequestMapping("/delect")
    46. public ModelAndView delect(@RequestParam int id) {
    47. ModelAndView mav = new ModelAndView("rentingdel");
    48. rentwithdrawnService.deleteByPrimaryKey(id);
    49. return mav;
    50. }
    51. @RequestMapping("/rentinglist")
    52. public ModelAndView listHouseState(@RequestParam int pn) {
    53. ModelAndView mav = new ModelAndView("rentinglist");
    54. // 设置分页传输
    55. PageHelper.startPage(pn, 10);
    56. // 查询所有数据
    57. List<leaseinformation> list = leaseinformationService.selecthousteaseWith("出租中");
    58. // 使用PageInFo封装查询结果
    59. PageInfo<leaseinformation> pageInfo = new PageInfo<leaseinformation>(list, 5);
    60. // 放入转发参数
    61. mav.addObject("cs", pageInfo);
    62. return mav;
    63. }
    64. @RequestMapping("/delectcontract")
    65. public ModelAndView delectcontract(@RequestParam int id) {
    66. ModelAndView mav = new ModelAndView("rentinglist");
    67. leaseinformationService.updacontract(id);
    68. return mav;
    69. }
    70. /**
    71. * 看房申请列表
    72. */
    73. @RequestMapping("/houseapply")
    74. public ModelAndView kanfansqing(@RequestParam int pn) {
    75. ModelAndView mav = new ModelAndView("houseapply");
    76. // 设置分页传输
    77. PageHelper.startPage(pn, 10);
    78. // 查询所有数据
    79. List<checkoutapplication> list = checkoutapplicationService.selectCoaState();
    80. // 使用PageInFo封装查询结果
    81. PageInfo<checkoutapplication> pageInfo = new PageInfo<checkoutapplication>(list, 5);
    82. // 放入转发参数
    83. mav.addObject("cs", pageInfo);
    84. return mav;
    85. }
    86. /**
    87. * 预约看房申请
    88. */
    89. @RequestMapping("/tonyizp")
    90. public ModelAndView tonyizp(@RequestParam int id, String housecall, String name) throws ParseException {
    91. ModelAndView mav = new ModelAndView("houseapply");
    92. checkoutapplicationService.xgaiCoaState("已同意", id);
    93. leaseinformation house = leaseinformationService.selectHouseCall(housecall).get(0);
    94. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");// 设置日期格式
    95. Calendar c = Calendar.getInstance();
    96. c.add(Calendar.DATE, 30);// 计算30天后的时间
    97. String t1 = df.format(new Date());
    98. String t2 = df.format(c.getTime());
    99. // 格式转换date格式
    100. Date date1 = df.parse(t1);
    101. Date date2 = df.parse(t2);
    102. house.setHousestartingdate(date1);
    103. house.setHouseclosingdate(date2);
    104. house.setHousestate("出租中");
    105. house.setUsername(name);
    106. leaseinformationService.updateByPrimaryKey(house);
    107. return mav;
    108. }
    109. @RequestMapping("/jujzp")
    110. public ModelAndView jujzp(@RequestParam int id) {
    111. ModelAndView mav = new ModelAndView("houseapply");
    112. checkoutapplicationService.xgaiCoaState("已拒绝", id);
    113. return mav;
    114. }
    115. /**
    116. * 退房申请
    117. */
    118. @RequestMapping("/tzshenqing")
    119. public ModelAndView tzshenqing(@RequestParam int pn) {
    120. ModelAndView mav = new ModelAndView("housedel");
    121. // 设置分页传输
    122. PageHelper.startPage(pn, 10);
    123. // 查询所有数据
    124. List<checkoutapplication> list = checkoutapplicationService.selectCoaState1();
    125. // 使用PageInFo封装查询结果
    126. PageInfo<checkoutapplication> pageInfo = new PageInfo<checkoutapplication>(list, 5);
    127. // 放入转发参数
    128. mav.addObject("cs", pageInfo);
    129. return mav;
    130. }
    131. /**
    132. * 删除退房记录
    133. */
    134. @RequestMapping("/delecttzsq")
    135. public ModelAndView delecttzsq(@RequestParam int id) {
    136. ModelAndView mav = new ModelAndView("housedel");
    137. checkoutapplicationService.deleteByPrimaryKey(id);
    138. return mav;
    139. }
    140. /**
    141. * 同意退房
    142. */
    143. @RequestMapping("/checkoutmvc")
    144. public ModelAndView checkoutmvc(@RequestParam int id,String housecall) {
    145. ModelAndView mav = new ModelAndView("housedel");
    146. String news=checkoutapplicationService.updateState("已同意", id);
    147. if(news.equals("同意退租成功!")) {
    148. System.out.println(news);
    149. System.out.println(leaseinformationService.updateCancelForeignKey(housecall));
    150. }
    151. return mav;
    152. }
    153. /**
    154. * 拒绝退房
    155. */
    156. @RequestMapping("/refusemvc")
    157. public ModelAndView refusemvc(@RequestParam int id) {
    158. ModelAndView mav = new ModelAndView("housedel");
    159. System.out.println(checkoutapplicationService.updateState("已拒绝", id));
    160. return mav;
    161. }
    162. /**
    163. * 分页查找所有用户
    164. */
    165. @RequestMapping("/pagingselectuser")
    166. public String pagingselectuser(Model model, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
    167. @RequestParam(required = false, defaultValue = "6") Integer pageSize) {
    168. PageHelper.startPage(pn, 10);
    169. List<userlist> userlist = userlistService.selectAll();
    170. PageInfo<userlist> p = new PageInfo<userlist>(userlist, 3);
    171. model.addAttribute("p", p);
    172. return "account";
    173. }
    174. /**
    175. * 删除用户信息
    176. */
    177. @RequestMapping("/deletuser")
    178. public String deletuser(int id,String username,HttpServletRequest request) {
    179. userlistService.updateJointTabledelete(username);
    180. headPortraitImgService.deletuserimg(userlistService.selectUserId(id).getUsercall());
    181. userlistService.deleteByPrimaryKey(id);
    182. return "redirect:pagingselectuser.do";
    183. }
    184. /**
    185. * 添加房源
    186. *
    187. * @throws IOException
    188. * @throws IllegalStateException
    189. */
    190. @RequestMapping("/addhouse")
    191. public String addhouse(String housecall, String address, String area, String rent, String housetype, String[] state,
    192. @RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request)
    193. throws IllegalStateException, IOException {
    194. if (housecall.equals("") || address.equals("") || area.equals("") || rent.equals("") || state.equals("")
    195. || housetype.equals("")) {
    196. request.setAttribute("erro", "输入房源信息不能缺少任意一项!");
    197. return "housingadd";
    198. }
    199. List<leaseinformation> list = leaseinformationService.queryAll();
    200. for (leaseinformation leaseinformation : list) {
    201. if (housecall.equals(leaseinformation.getHousecall())) {
    202. request.setAttribute("erro", "该房源编号已存在");
    203. return "housingadd";
    204. }
    205. }
    206. String path = "";
    207. String imgname = "";
    208. if (!file.isEmpty()) {
    209. // 生成uuid作为文件名称
    210. String uuid = UUID.randomUUID().toString().replaceAll("-", "");
    211. // 获得文件类型(可以判断如果不是图片,禁止上传)
    212. String contentType = file.getContentType();
    213. // 获得文件后缀名称
    214. String imageName = contentType.substring(contentType.indexOf("/") + 1);
    215. path = "C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/leaseimg/" + uuid + "." + imageName;
    216. file.transferTo(new File(path));
    217. imgname = uuid + "." + imageName;
    218. }
    219. leaseimg img = new leaseimg();
    220. img.setImgname(address);
    221. img.setImgroute(imgname);
    222. leaseimgService.insert(img);
    223. int id = leaseimgService.selectAll().get(leaseimgService.selectAll().size() - 1).getId();
    224. leaseinformation house = new leaseinformation();
    225. house.setHouseaddress(address);
    226. house.setHousesize(Double.valueOf(area));
    227. house.setHousemoney(rent);
    228. house.setHousestate(state[0]);
    229. house.setHousecall(housecall);
    230. //获取当前时间和一个月后的时间
    231. Date date = new Date();
    232. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
    233. String HouseStartingDate=sdf.format(date);
    234. Calendar cal = Calendar.getInstance();
    235. cal.setTime(date);
    236. cal.add(Calendar.DATE, 30);
    237. String HouseClosingDate=sdf.format(cal.getTime());
    238. house.setHousestartingdate(date);
    239. house.setHouseclosingdate(cal.getTime());
    240. house.setHousestartingdatetemp(HouseStartingDate);
    241. house.setHouseclosingdatetemp(HouseClosingDate);
    242. house.setId(id);
    243. house.setHousetype(housetype);
    244. house.setHouserecommend("未设置");
    245. leaseinformationService.addHouse(house);
    246. request.setAttribute("sessce", "添加成功");
    247. return "housingadd";
    248. }
    249. /**
    250. * 分页展示房源信息
    251. */
    252. @RequestMapping("/pagingselecthouse")
    253. public String pagingselecthouse(Model model, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
    254. @RequestParam(required = false, defaultValue = "6") Integer pageSize) {
    255. PageHelper.startPage(pn, 10);
    256. List<leaseinformation> leaseinformation = leaseinformationService.queryAll();
    257. PageInfo<leaseinformation> p = new PageInfo<leaseinformation>(leaseinformation, 3);
    258. model.addAttribute("p", p);
    259. return "housinglist";
    260. }
    261. /**
    262. * 获取修改房源信息
    263. */
    264. @RequestMapping("/getupdatehouse")
    265. public String getupdatehouse(int houseid, HttpServletRequest request) {
    266. List<leaseinformation> house = leaseinformationService.queryID(houseid);
    267. request.setAttribute("uphouse", house);
    268. return "houseupdate";
    269. }
    270. /**
    271. * 修改房源信息
    272. */
    273. @RequestMapping("/updatehouse")
    274. public String updatehouse(Integer houseid, String housetype, String address, String area, String rent, String state,
    275. HttpServletRequest request) {
    276. leaseinformation house = leaseinformationService.queryID(houseid).get(0);
    277. request.removeAttribute("uphouse");
    278. house.setHouseaddress(address);
    279. house.setHousemoney(rent);
    280. house.setHousetype(housetype);
    281. house.setHousesize(Double.valueOf(area));
    282. house.setHousestate(state);
    283. house.setHouseid(houseid);
    284. leaseinformationService.updateByPrimaryKey(house);
    285. request.setAttribute("sessce", "修改成功");
    286. request.setAttribute("newhouse", house);
    287. return "houseupdate";
    288. }
    289. /**
    290. * 删除房源信息
    291. */
    292. @RequestMapping("/delethouse")
    293. public String delethouse(int houseid, HttpServletRequest request) {
    294. if (houseid >= 0) {
    295. int id = leaseinformationService.queryID(houseid).get(0).getId();
    296. leaseinformationService.deleteByPrimaryKey(houseid);
    297. leaseimgService.deleteByPrimaryKey(id);
    298. }
    299. return "redirect:pagingselecthouse.do";
    300. }
    301. /*
    302. * 推荐房屋列表
    303. */
    304. @RequestMapping("/recommendlist")
    305. public String recommendlist(Model model, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
    306. @RequestParam(required = false, defaultValue = "6") Integer pageSize) {
    307. PageHelper.startPage(pn, 10);
    308. List<leaseinformation> leaseinformation = leaseinformationService.selectAllLeasable();
    309. PageInfo<leaseinformation> p = new PageInfo<leaseinformation>(leaseinformation, 3);
    310. model.addAttribute("p", p);
    311. return "recommendhouse";
    312. }
    313. /**
    314. * 修改推荐信息
    315. */
    316. @RequestMapping("/updaterecommend")
    317. public String updatehouse(Integer houseid) {
    318. leaseinformation house = leaseinformationService.queryID(houseid).get(0);
    319. if (house.getHouserecommend().equals("未推荐")) {
    320. house.setHouserecommend("已推荐");
    321. } else {
    322. house.setHouserecommend("未推荐");
    323. }
    324. leaseinformationService.updateByPrimaryKey(house);
    325. return "redirect:recommendlist.do?";
    326. }
    327. /**
    328. * 分页查询日程信息
    329. */
    330. @RequestMapping("/schedulelist")
    331. public String mydailylifelist(@RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) {
    332. // 引用PageHelper分页插件
    333. PageHelper.startPage(pn, 10);
    334. List<mydailylife> mydailylifes = mydailylifeService.selectAll();
    335. PageInfo<mydailylife> page = new PageInfo<mydailylife>(mydailylifes, 3);
    336. model.addAttribute("p", page);
    337. return "schedulelist";
    338. }
    339. /**
    340. * 添加日程
    341. */
    342. @RequestMapping("/addmydailylife")
    343. public String mydailylifeadd(mydailylife mydailylife) {
    344. mydailylifeService.insert(mydailylife);
    345. return "redirect:/admin/schedulelist.do";
    346. }
    347. /**
    348. * 修改日程
    349. */
    350. @RequestMapping("/updatemydailylife")
    351. public String mydailylifeupdate1(Integer id, HttpServletRequest request) {
    352. mydailylife mydailylife = mydailylifeService.selectByPrimaryKey(id);
    353. request.setAttribute("mydailylife", mydailylife);
    354. return "scheduleupdate";
    355. }
    356. @RequestMapping("/toupdate")
    357. public String mydailylifeupdate2(mydailylife mydailylife) {
    358. mydailylifeService.updateByPrimaryKey(mydailylife);
    359. return "redirect:/admin/schedulelist.do";
    360. }
    361. /**
    362. * 删除日程
    363. */
    364. @RequestMapping("/delmydailylife")
    365. public String mydailylifedel(Integer id) {
    366. mydailylifeService.deleteByPrimaryKey(id);
    367. return "redirect:/admin/schedulelist.do";
    368. }
    369. // 报障
    370. /**
    371. * 查询待处理报障
    372. */
    373. @RequestMapping("/Adminselectrepairwait")
    374. public String selectrepairwait(String state, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
    375. Model model) {
    376. state = "未处理";
    377. // 引用PageHelper分页插件
    378. PageHelper.startPage(pn, 10);
    379. List<fault> faultlist = faultService.AdminSelectStateAll(state);
    380. PageInfo<fault> page = new PageInfo<fault>(faultlist, 3);
    381. model.addAttribute("p", page);
    382. return "repairwait";
    383. }
    384. /**
    385. * 已完成全部报障
    386. */
    387. @RequestMapping("/Adminselectrepairdone")
    388. public String selectrepairdone(String state, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
    389. Model model) {
    390. state = "已处理";
    391. // 引用PageHelper分页插件
    392. PageHelper.startPage(pn, 10);
    393. List<fault> faultdone = faultService.AdminSelectStateAll(state);
    394. PageInfo<fault> page = new PageInfo<fault>(faultdone, 3);
    395. model.addAttribute("p", page);
    396. return "repairdone";
    397. }
    398. /**
    399. * 报障状态修改
    400. */
    401. @RequestMapping("/adminrepairwait")
    402. public String updaterepairwait(Integer id) {
    403. fault fault = faultService.selectByPrimaryKey(id);
    404. String fhouseid = fault.getFhouseid();
    405. String fhouseaddress = fault.getFhouseaddress();
    406. Double fprice = fault.getFprice();
    407. Date fdate = fault.getFdate();
    408. String fcontent = fault.getFcontent();
    409. String fusername = fault.getFusername();
    410. String fuserid = fault.getFuserid();
    411. String fuserphone = fault.getFuserphone();
    412. String fstate = "已处理";
    413. fault f = new fault(fhouseid, fhouseaddress, fprice, fdate, fcontent, fusername, fuserid, fuserphone, fstate,
    414. id);
    415. faultService.updateByPrimaryKey(f);
    416. return "redirect:/admin/Adminselectrepairwait.do";
    417. }
    418. /**
    419. * 报障删除
    420. */
    421. @RequestMapping("/adminrepairdone")
    422. public String delrepair(Integer id) {
    423. faultService.deleteByPrimaryKey(id);
    424. return "redirect:/admin/Adminselectrepairdone.do";
    425. }
    426. /**
    427. * 搜索报障
    428. */
    429. @RequestMapping("/repairselect")
    430. public String repairselect(QueryVo vo, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) {
    431. // 引用PageHelper分页插件
    432. PageHelper.startPage(pn, 10);
    433. List<fault> faultdone = faultService.repairselect(vo);
    434. for (fault temp : faultdone) {
    435. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    436. String date = sdf.format(temp.getFdate());
    437. temp.setFdatetemp(date);
    438. }
    439. PageInfo<fault> page = new PageInfo<fault>(faultdone, 3);
    440. model.addAttribute("p", page);
    441. model.addAttribute("vo", vo);
    442. return "repairdone";
    443. }
    444. /**
    445. * 我要收租
    446. */
    447. @RequestMapping("/adminrentshou")
    448. public String rentshou(@RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) {
    449. // 引用PageHelper分页插件
    450. PageHelper.startPage(pn, 10);
    451. List<userlist> userlists = userlistService.rentSelectAll();
    452. PageInfo<userlist> page = new PageInfo<userlist>(userlists, 3);
    453. model.addAttribute("rent", page);
    454. return "rentshou";
    455. }
    456. /**
    457. * 获取收租信息
    458. */
    459. @RequestMapping("/adminrentselect")
    460. public String rentadd(String housecall, Model model) {
    461. userlist userlist = userlistService.selectUserCallWith(housecall);
    462. model.addAttribute("addrent", userlist);
    463. return "rentadd";
    464. }
    465. /**
    466. * 添加代缴租金
    467. */
    468. @RequestMapping("/adminrentadd")
    469. public String rentaddwait(rentcollection rentcollection) {
    470. rentcollectionService.insert(rentcollection);
    471. return "redirect:/admin/adminrentshou.do";
    472. }
    473. /**
    474. * 代缴租金
    475. */
    476. @RequestMapping("/adminrentwait")
    477. public String rentwait(String rcstate, @RequestParam(value = "pn", defaultValue = "1") Integer pn, Model model) {
    478. rcstate = "未缴纳";
    479. // 引用PageHelper分页插件
    480. PageHelper.startPage(pn, 10);
    481. List<rentcollection> rentlists = rentcollectionService.selectPaidStateAll(rcstate);
    482. PageInfo<rentcollection> page = new PageInfo<rentcollection>(rentlists, 3);
    483. model.addAttribute("rent", page);
    484. return "rentwait";
    485. }
    486. /**
    487. * 删除租金缴纳记录
    488. */
    489. @RequestMapping("/admindelrent")
    490. public String delrent(Integer id) {
    491. rentcollectionService.deleteByPrimaryKey(id);
    492. return "redirect:/admin/adminselectPaidAll.do";
    493. }
    494. /**
    495. * 搜索查询
    496. */
    497. @RequestMapping("/adminselectPaidAll")
    498. public String adminselectPaidAll(QueryVo vo, @RequestParam(value = "pn", defaultValue = "1") Integer pn,
    499. Model model) {
    500. // 引用PageHelper分页插件
    501. PageHelper.startPage(pn, 10);
    502. List<rentcollection> rentlists = rentcollectionService.selectPaidAll(vo);
    503. for (rentcollection temp : rentlists) {
    504. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    505. String date = sdf.format(temp.getRcdate());
    506. temp.setRcdatetemp(date);
    507. if(temp.getRcpaiddate()!=null) {
    508. String Rcpaiddate = sdf.format(temp.getRcpaiddate());
    509. temp.setRcpaiddatetemp(Rcpaiddate);
    510. }
    511. }
    512. PageInfo<rentcollection> page = new PageInfo<rentcollection>(rentlists, 3);
    513. model.addAttribute("rent", page);
    514. model.addAttribute("vo", vo);
    515. return "rentdone";
    516. }
    517. /**
    518. * 查看合同
    519. */
    520. @RequestMapping("/viewcontractadmin")
    521. public ModelAndView viewcontractadmin(String username, String userid, String houseaddress,
    522. String housestartingdatetemp, String houseclosingdatetemp, String housemoney, String userphone,
    523. String houseid, HttpServletRequest request, HttpSession session) {
    524. ModelAndView mav = new ModelAndView("rentinglist");
    525. String arraytemp[] = { username, userid, houseaddress, housestartingdatetemp, houseclosingdatetemp, housemoney,
    526. userphone, houseid };
    527. System.out.println(Arrays.toString(arraytemp));
    528. String temp = arraytemp[7] + "pdf.pdf";
    529. File filetemp = new File("C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/contract/pdf/" + temp);
    530. if (!filetemp.exists()) {
    531. System.out.println(new DocumentConversion().DocumentGeneration(arraytemp));
    532. new DocumentConversion().PdfGeneration(arraytemp[7]);
    533. filetemp = new File("C://Users/Rain/Desktop/ssm_leaseOfHouses/WebContent/contract/pdf/" + temp);
    534. }
    535. String pdf = filetemp.getName();
    536. // 放入转发参数
    537. mav.addObject("pdftemp", pdf);
    538. return mav;
    539. }
    540. }

    房屋信息控制器:

    1. /**
    2. * 房屋信息控制器
    3. * @author yy
    4. *
    5. */
    6. @Controller
    7. @RequestMapping("/leaseinformationmvc")
    8. public class LeaseinformationController {
    9. @Autowired
    10. LeaseinformationService leaseinformationService;
    11. @RequestMapping("/details")
    12. public ModelAndView listCategory(@RequestParam int id){
    13. ModelAndView mav = new ModelAndView("details");
    14. List cs= leaseinformationService.allANDimg1(id);
    15. for (leaseinformation leaseinformation : cs) {
    16. System.out.println(leaseinformation.getLeaseimg().getImgroute());
    17. }
    18. // 放入转发参数
    19. mav.addObject("cs", cs);
    20. return mav;
    21. }
    22. }

    源码获取:俺的博客首页 "资源" 里下载!

  • 相关阅读:
    PostgreSQL数据库统计信息——analyze流程对不同表的处理
    树莓派4B的测试记录(CPU、FFMPEG)
    R Studio 安装stringi 报错download of package ‘stringi’ failed
    鲁棒局部均值分解 (RLMD)(Matlab代码实现)
    群狼调研(长沙医院满意度调查)|如何做医疗服务满意度调查
    软件测试的方法总结
    TCP三次握手四次挥手及常见问题解决方案
    青少年python系列 33.python安装非内置模块
    基于体系结构-架构真题2022(四十一)
    MySQL 中查看锁
  • 原文地址:https://blog.csdn.net/m0_66863468/article/details/127842187