毕业设计-基于Springboot实现公租房申请管理系统

简介: 毕业设计-基于Springboot实现公租房申请管理系统

项目编号:BS-XX-120

一,项目简介


本项目基于Springboot开发实现了一个公租房申请管理系统平台,系统分为管理员用户和公租房申请用户。管理员用户又分为三种:超级管理员,基础数据管理员,审核管理员。超级管理员主要用来管理管理员和普通用户信息,资讯信息等,基础数据管理员主要用来管理小区,房屋等相关信息,审核管理员主要用来审核用户的申请信息,给用户进行配租等。前端用户在前台界面可以查看公租房申请的相关政策信息,相关流程,实现在线注册和登陆,并可以在线申请公租房。

二,环境介绍


语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:springboot+mybatis

前台开发技术:layui+jquery

特点技术:短信发送,GoEasy通信技术等

三,系统展示


前端用户功能展示

用户注册

image.png

用户登陆

image.png

首页

854cabf1d9fa436db766f20d7b90a1e9.png

申请指南

image.png

新闻动态

image.png

审核结果公示

image.png

在线申请

image.png

申请结果查询

image.png

管理员功能展示

超级管理员登陆

image.png

后台主界面

image.png

管理员管理:可以停用和删除

image.png

前台用户管理

image.png

资讯管理

image.png

审核人员管理功能

image.png

办公地点管理

image.png

公告管理

image.png

审核结果发布

image.png

基础数据管理员

image.png

房屋管理

image.png

给通过人员配租

image.png

image.png

四,核心代码展示


package org.wy.gzf_boot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.wy.gzf_boot.model.Admin;
import org.wy.gzf_boot.model.Community;
import org.wy.gzf_boot.service.AdminService;
import org.wy.gzf_boot.service.ApartmentService;
import org.wy.gzf_boot.service.CommunityService;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * <p>
 * 管理员表 前端控制器
 * </p>
 *
 * @since 2020-03-08
 */
@Controller
@RequestMapping("/admin")
public class AdminController {
    @Resource
    private AdminService adminService;
    @Resource
    private CommunityService communityService;
    @Resource
    private ApartmentService apartmentService;
    @RequestMapping("/toWelcome")
    public String toWelcome(){
        return "xianadmin/welcome";
    }
    /**
     * 登录页面入口
     * @return
     */
    @RequestMapping("/toLogin")
    public String toLogin(){
        return "xianadmin/login";
    }
    /**
     * 管理员登录验证账号密码
     */
    @ResponseBody
    @RequestMapping("/toCheck")
    public Map toCheck(Admin admin,HttpSession session){
        Map map=new HashMap();
        Admin a=adminService.login(admin);
        if(a!=null){
            session.setAttribute("admin",a);
            map.put("admin",a);
        }
        return map;
    }
    @RequestMapping("/toIndex")
    public String toIndex(int adminState){
        if(adminState==0){
            return "superadmin/index";
        }else if (adminState==1){
            return "xianadmin/index";
        }else{
            return "shiadmin/index";
        }
    }
    @RequestMapping("/toRole")
    public String toRole(){
        return "superadmin/admin-role";
    }
    @RequestMapping("/toAdminList")
    public String toAdminList(){
        return "superadmin/admin-list";
    }
    @RequestMapping("/toCommunityList")
    public String toCommunityList(){
        return "superadmin/community-list";
    }
    @RequestMapping("/toAddCommunity")
    public String toAddCommunity(){
        return "superadmin/community-add";
    }
    @RequestMapping("/toApartmentList")
    public ModelAndView toApartmentList(ModelAndView mv){
        List<Community> allCommunity=communityService.getCommunityList();
        mv.addObject("allCommunity",allCommunity);
        mv.setViewName("superadmin/apartment-list");
        return mv;
    }
    @RequestMapping("/toAddApartment")
    public ModelAndView toAddApartment(ModelAndView mv){
        List<Community> allCommunity=communityService.getCommunityList();
        mv.addObject("allCommunity",allCommunity);
        mv.setViewName("superadmin/apartment-add");
        return mv;
    }
    @RequestMapping("/toApplicant")
    public String toApplicant(){
        return "xianadmin/applicant-list";
    }
    @RequestMapping("/toAddApplicant")
    public String toAddApplicant(){
        return "xianadmin/applicant-add";
    }
    @RequestMapping("/toApplyCheck")
    public String toApplyCheck(){
        return "shiadmin/shi-apply-list";
    }
    @RequestMapping("/toNotice")
    public String toNotice(){
        return "superadmin/notice-write";
    }
    @ResponseBody
    @RequestMapping("/adminExit")
    public ModelAndView adminExit(HttpSession session,ModelAndView mv){
     session.invalidate();
     mv.setViewName("xianadmin/login");
     return mv;
    }
    @RequestMapping("/toNoticeBox")
    public ModelAndView toNoticeBox(ModelAndView mv){
        mv.setViewName("shiadmin/notice-box");
        return mv;
    }
    @RequestMapping("/toAdmin")
    public String toAdmin(){
        return "superadmin/admin-list";
    }
    @ResponseBody
    @RequestMapping("/getAdminList")
    public Map toAdminList(Admin admin){
        Map map=new HashMap();
        List adminList=adminService.getAdminList(admin);
        int adminCount=adminService.getAdminCount(admin);
        map.put("adminList",adminList);
        map.put("adminCount",adminCount);
        return map;
    }
    @ResponseBody
    @RequestMapping("/addAdmin")
    public int addAdmin(Admin admin){
        return adminService.addAdmin(admin);
    }
    @RequestMapping("/toAddAdmin")
    public String toAddAdmin(){
        return "superadmin/admin-add";
    }
    @ResponseBody
    @RequestMapping("/banAdminById")
    public int banAdminById(Admin admin){
        return adminService.banAdminById(admin);
    }
    @ResponseBody
    @RequestMapping("delAdmin")
    public int delAdmin(Admin admin){
        return adminService.delAdmin(admin);
    }
    @RequestMapping("/toApplyHelp")
    public String toApplyHelp(){
        return "user/apply-help";
    }
}
package org.wy.gzf_boot.controller;
import com.github.pagehelper.PageInfo;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import org.wy.gzf_boot.mapper.ApartmentMapper;
import org.wy.gzf_boot.model.Apartment;
import org.wy.gzf_boot.model.Community;
import org.wy.gzf_boot.service.ApartmentService;
import org.wy.gzf_boot.service.CommunityService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.websocket.server.PathParam;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * <p>
 * 房源表 前端控制器
 * </p>
 *
 * @since 2020-03-08
 */
@Controller
@RequestMapping("/apartment")
public class ApartmentController {
    @Resource
    private ApartmentService apartmentService;
    @Resource
    private CommunityService communityService;
    //获取符合条件的所有房源
    @ResponseBody
    @RequestMapping("/getApartmentList")
    public Map getApartmentList(Community community, Apartment apartment,int pageNum, int pageSize){
        apartment.setCommunity(community);
        System.out.println("单元号:"+apartment.getUnitId());
        Map map=new HashMap();
        map.put("apartment",apartment);
        int apartmentCount=apartmentService.getApartmentCount(map);
        map.put("pageNum",pageNum);
        map.put("pageSize",pageSize);
        PageInfo page=apartmentService.getApartmentList(map);
        map.put("apartmentCount",apartmentCount);
        map.put("page",page);
        return map;
    }
    //获取符合条件的所有空闲房源
    @ResponseBody
    @RequestMapping("/getFreeApartmentList")
    public Map getFreeApartmentList(Community community, Apartment apartment,int pageNum, int pageSize){
        apartment.setCommunity(community);
        System.out.println("单元号:"+apartment.getUnitId());
        Map map=new HashMap();
        map.put("apartment",apartment);
        int apartmentCount=apartmentService.getFreeApartmentCount(map);
        map.put("pageNum",pageNum);
        map.put("pageSize",pageSize);
        PageInfo page=apartmentService.getFreeApartmentList(map);
        map.put("apartmentCount",apartmentCount);
        map.put("page",page);
        return map;
    }
    /**
     * 添加房源
     * @param apartment
     * @return
     */
    @ResponseBody
    @RequestMapping("/addApartment")
    public int addApartment(Apartment apartment,Community community){
        apartment.setCommunity(community);
        int result=apartmentService.addApartment(apartment);
        return result;
    }
    @ResponseBody
    @RequestMapping("/delApartment")
    public int delApartment(int apartmentId){
        return apartmentService.delApartment(apartmentId);
    }
    @RequestMapping("/toApartmentEdit")
    public ModelAndView toEditApartment(Apartment apartment, ModelAndView mv){
        Apartment apartment1=apartmentService.getApartmentById(apartment);
        mv.addObject("apartment",apartment1);
        mv.setViewName("superadmin/apartment-edit");
        return mv;
    }
    @ResponseBody
    @RequestMapping("/editApartment")
    public int editApartment(Apartment apartment){
        return apartmentService.editApartment(apartment);
    }
    /**
     * excel导出
     * @param request
     * @param response
     * @throws Exception
     */
    @RequestMapping("/apartment_excel_down")
    public void exportPermMatrix(HttpServletRequest request, HttpServletResponse response) throws Exception {
        HSSFWorkbook workbook = new HSSFWorkbook();
        HSSFSheet sheet = workbook.createSheet("xxx信息表");
        List<Apartment> apartmentList = apartmentService.getAllApartment();
        //此处添加数据
        HSSFRow headerRow1 = sheet.createRow(0);
        headerRow1.createCell(0).setCellValue("位置");
        headerRow1.createCell(1).setCellValue("房源");
        headerRow1.createCell(2).setCellValue("房源面积");
        headerRow1.createCell(3).setCellValue("计租面积");
        headerRow1.createCell(4).setCellValue("户型");
        headerRow1.createCell(5).setCellValue("建筑结构");
        headerRow1.createCell(6).setCellValue("状态");
        //headerRow1.createCell(6).setCellValue("总层数");
        for (int i = 0; i < apartmentList.size(); i++) {
            HSSFRow headerRow = sheet.createRow(i + 1);
            headerRow.createCell(0).setCellValue(apartmentList.get(i).getCommunity().getLocation());
            headerRow.createCell(1).setCellValue(apartmentList.get(i).getCommunity().getCommunityName()+apartmentList.get(i).getUnitId()+"号楼"+apartmentList.get(i).getFloorId()+"-"+apartmentList.get(i).getRoomId());
            headerRow.createCell(2).setCellValue(apartmentList.get(i).getRoomArea()+"㎡");
            headerRow.createCell(3).setCellValue(apartmentList.get(i).getRentArea()+"㎡");
            headerRow.createCell(4).setCellValue(apartmentList.get(i).getHouseType());
            headerRow.createCell(5).setCellValue(apartmentList.get(i).getCommunity().getStructure());
            headerRow.createCell(6).setCellValue(apartmentList.get(i).getRoomState());
        }
        //清空response
        response.reset();
        response.setContentType("multipart/form-data");
        response.setHeader("Content-Disposition",
                "attachment; filename=" + new String("房源信息列表".getBytes(), "iso8859-1") + ".xls");
        OutputStream os = new BufferedOutputStream(response.getOutputStream());
        workbook.write(os);
        os.flush();
        os.close();
        //workbook.close();
    }
    /**
     * excel导入数据
     */
    @ResponseBody
    @RequestMapping("/apartment_input_excel")
    @Transactional(rollbackFor = Exception.class)
    public Map importWatchExcel(@RequestParam("file") MultipartFile xlsFile) {
        Map result = new HashMap<>();
        // contentType
        // String contentType = file.getContentType();
        // excel文件名
        // String fileName = file.getOriginalFilename();
        if (xlsFile.isEmpty()) {
            result.put("code", 500);
            result.put("message", "导入文件为空!");
            return result;
        }
        // 根据不同excel创建不同对象,Excel2003版本-->HSSFWorkbook,Excel2007版本-->XSSFWorkbook
        Workbook wb = null;
        InputStream im = null;
        try {
            im = xlsFile.getInputStream();
            wb = WorkbookFactory.create(im);
            // 根据页面index 获取sheet页
            Sheet sheet = wb.getSheetAt(0);
            Row row = null;
            // 循环sheet页中数据从第x行开始,例:第3行开始为导入数据
            for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
               Apartment apartment=new Apartment();
                // 获取每一行数据
                row = sheet.getRow(i);
                // 输出表格内容,此处可替换为数据插入操作
                String communityName=row.getCell(1).getStringCellValue();
                List communityList=communityService.getCommunityByName(communityName);
                Community community= (Community) communityList.get(0);
                apartment.setCommunity(community);
                if (null != row.getCell(2) && "" != row.getCell(2).toString()) {
                    row.getCell(2).setCellType(CellType.STRING);
                    apartment.setUnitId(Integer.parseInt(row.getCell(2).getStringCellValue()));
                }
                if (null != row.getCell(3) && "" != row.getCell(3).toString()) {
                    row.getCell(3).setCellType(CellType.STRING);
                   apartment.setFloorId(Integer.parseInt(row.getCell(3).getStringCellValue()));
                }
                if (null != row.getCell(4) && "" != row.getCell(4).toString()) {
                    row.getCell(4).setCellType(CellType.STRING);
                    apartment.setRoomId(Integer.parseInt(row.getCell(4).getStringCellValue()));
                }
                if (null != row.getCell(5) && "" != row.getCell(5).toString()) {
                    String roomArea=row.getCell(5).getStringCellValue();
                    apartment.setRoomArea(Float.parseFloat(roomArea));
                }
                if (null != row.getCell(6) && "" != row.getCell(6).toString()) {
                    String rentArea=row.getCell(6).getStringCellValue();
                    apartment.setRentArea(Float.parseFloat(rentArea));
                }
                if (null != row.getCell(7) && "" != row.getCell(7).toString()) {
                    apartment.setHouseType(row.getCell(7).getStringCellValue());
                }
                if (null != row.getCell(9) && "" != row.getCell(9).toString()) {
                    apartment.setRoomState(row.getCell(9).getStringCellValue());
                }
                apartmentService.addApartment(apartment);
            }
            result.put("code", 200);
            result.put("message", "导入成功!");
        } catch (Exception e1) {
            // 回滚数据
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            e1.printStackTrace();
        } finally {
            try {
                im.close();
                wb.close();
            } catch (IOException e2) {
                e2.printStackTrace();
            }
        }
        return result;
    }
    @RequestMapping("/toSelectExcel")
    public String toSelectExcel(){
        return "superadmin/apartment-excel-select";
    }
    @ResponseBody
    @RequestMapping("/getAllApartment")
    public List getAllApartment(){
        return apartmentService.getAllApartment();
    }
}
package org.wy.gzf_boot.controller;
import com.github.pagehelper.PageInfo;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.wy.gzf_boot.model.*;
import org.wy.gzf_boot.service.ApplicantService;
import org.wy.gzf_boot.service.SecondTrialService;
import org.wy.gzf_boot.service.UserInformService;
import org.wy.gzf_boot.util.FileUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;
/**
 * <p>
 * 申请人表 前端控制器
 * </p>
 *
 * @since 2020-03-08
 */
@Controller
@RequestMapping("/applicant")
public class ApplicantController {
    @Resource
    private ApplicantService applicantService;
    @Resource
    private SecondTrialService secondTrialService;
    @Resource
    private UserInformService userInformService;
    @Value("${uploadPath}")
    private String uploadPath;
    @ResponseBody
    @RequestMapping("/getApplicantList")
    public Map getApplicantList(int pageSize, int pageNum, String applicantName, String adminState) {
        Map map = new HashMap();
        map.put("adminState", adminState);
        int applicantCount = applicantService.getApplicantCount(map);
        map.put("applicantCount", applicantCount);
        System.out.println("申请人总条数:" + applicantCount);
        map.put("pageNum", pageNum);
        map.put("pageSize", pageSize);
        map.put("applicantName", applicantName);
        PageInfo page = applicantService.getApplicantList(map);
        map.put("page", page);
        return map;
    }
    /**
     * 申请人信息提交,多文件上传
     *
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/addApplicant")
    public int addApply(HttpServletRequest request) {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        List<MultipartFile> file1 = multipartRequest.getFiles("file1");
        List<MultipartFile> file2 = multipartRequest.getFiles("file2");
        List<MultipartFile> file3 = multipartRequest.getFiles("file3");
        List<MultipartFile> file4 = multipartRequest.getFiles("file4");
        List<MultipartFile> file5 = multipartRequest.getFiles("file5");
        Applicant applicant = new Applicant();
        User user = new User();
        user.setUserId(Integer.parseInt(multipartRequest.getParameter("userId")));
        applicant.setUser(user);
        applicant.setApplicantName(multipartRequest.getParameter("applicantName"));
        applicant.setSex(Integer.parseInt(multipartRequest.getParameter("sex")));
        applicant.setIdNumber(multipartRequest.getParameter("idNumber"));
        applicant.setBirthday(multipartRequest.getParameter("birthday"));
        applicant.setEducation(multipartRequest.getParameter("education"));
        applicant.setWorkUnit(multipartRequest.getParameter("workUnit"));
        applicant.setPhone(multipartRequest.getParameter("phone"));
        applicant.setAddress(multipartRequest.getParameter("address"));
        Community community = new Community();
        community.setCommunityId(Integer.parseInt(multipartRequest.getParameter("communityId")));
        applicant.setCommunity(community);
        applicant.setDemandArea(Integer.parseInt(multipartRequest.getParameter("demandArea")));
        applicant.setDemandFloor(Integer.parseInt(multipartRequest.getParameter("demandFloor")));
        applicant.setDemandRoom(multipartRequest.getParameter("demandRoom"));
        List<MultipartFile> allFiles = new ArrayList<>();
        allFiles.add(file1.get(0));
        allFiles.add(file2.get(0));
        allFiles.add(file3.get(0));
        allFiles.add(file4.get(0));
        allFiles.add(file5.get(0));
        for (int i = 0; i < allFiles.size(); i++) {
            String fileName = allFiles.get(i).getOriginalFilename();
            if (!"".equals(fileName)) {
                String suffixName = fileName.substring(fileName.lastIndexOf("."));
                fileName = UUID.randomUUID() + suffixName;  //新文件名
                if (i == 0) {
                    applicant.setIdentityCard(fileName);
                } else if (i == 1) {
                    applicant.setMarriageProof(fileName);
                } else if (i == 2) {
                    applicant.setHouseProof(fileName);
                } else if (i == 3) {
                    applicant.setWorkProof(fileName);
                } else if (i == 4) {
                    applicant.setApplyDoc(fileName);
                }
            }
            String path = uploadPath;
            FileUtils.upload(allFiles.get(i), path, fileName);
        }
        int result = applicantService.addApplicant(applicant);
        if (result > 0) {
            UserInform userInform = new UserInform();
            userInform.setTitle("申请提交通知");
            userInform.setContent(applicant.getApplicantName() + "(先生/女士),您的公租房申请材料已经提交,请您耐心等待。您可在首页的查询办理进度,也可等待审核公告发布");
            userInform.setUser(user);
            userInformService.addUserInform(userInform);
            return result;
        }
        return 0;
    }
    @RequestMapping("/getApplicantById")
    public ModelAndView getApplicantById(int applicantId, ModelAndView mv) {
        Applicant applicant = applicantService.getApplicantById(applicantId);
        mv.addObject("applicant", applicant);
        mv.setViewName("xianadmin/applicant-edit");
        return mv;
    }
    @ResponseBody
    @RequestMapping("/editApplicant")
    public int editApplicant(Applicant applicant) {
        return applicantService.editApplicant(applicant);
    }
    @RequestMapping("/getIdentityCard")
    public ModelAndView getIdentityCard(int applicantId, ModelAndView mv) {
        Applicant applicant = applicantService.getIdentityCard(applicantId);
        mv.setViewName("xianadmin/identitycard-img");
        mv.addObject("applicant", applicant);
        return mv;
    }
    @ResponseBody
    @RequestMapping("/editIdentityCard")
    public int editIdentityCard(@RequestParam("file") MultipartFile file, Applicant applicant) {
        String fileName = file.getOriginalFilename();
        if (!"".equals(fileName)) {
            String suffixName = fileName.substring(fileName.lastIndexOf("."));
            fileName = UUID.randomUUID() + suffixName;  //新文件名
        }
        String path = "D:\\gzf_boot\\src\\main\\resources\\static\\upload";
        FileUtils.upload(file, path, fileName);
        applicant.setIdentityCard(fileName);
        int result = applicantService.editIdentityCard(applicant);
        return result;
    }
    @RequestMapping("/shiCheckApplicant")
    public ModelAndView shiCheckApplicant(int applicantId, ModelAndView mv) {
        Applicant applicant = applicantService.getApplicantById(applicantId);
        mv.addObject("applicant", applicant);
        mv.setViewName("shiadmin/shi-apply-details");
        return mv;
    }
    @RequestMapping("/xianCheckApplicant")
    public ModelAndView xianCheckApplicant(int applicantId, ModelAndView mv) {
        Applicant applicant = applicantService.getApplicantById(applicantId);
        mv.addObject("applicant", applicant);
        mv.setViewName("xianadmin/xian-apply-details");
        return mv;
    }
    @RequestMapping("/checkIdentityCard")
    public ModelAndView checkIdentityCard(int applicantId, ModelAndView mv) {
        Applicant applicant = applicantService.getIdentityCard(applicantId);
        mv.setViewName("shiadmin/identitycard-check");
        mv.addObject("applicant", applicant);
        return mv;
    }
    @RequestMapping("/checkMarriageProof")
    public ModelAndView checkMarriageProof(Applicant applicant, ModelAndView mv) {
        mv.setViewName("shiadmin/marriageProof-check");
        mv.addObject("applicant", applicant);
        return mv;
    }
    @RequestMapping("/checkWorkProof")
    public ModelAndView checkWorkProof(Applicant applicant, ModelAndView mv) {
        mv.setViewName("shiadmin/workProof-check");
        mv.addObject("applicant", applicant);
        return mv;
    }
    @RequestMapping("/checkHouseProof")
    public ModelAndView checkHouseProof(Applicant applicant, ModelAndView mv) {
        mv.setViewName("shiadmin/houseProof-check");
        mv.addObject("applicant", applicant);
        return mv;
    }
    @RequestMapping("/checkApplyDoc")
    public ModelAndView checkApplyDoc(Applicant applicant, ModelAndView mv) {
        mv.setViewName("shiadmin/applyDoc-check");
        mv.addObject("applicant", applicant);
        return mv;
    }
    @ResponseBody
    @RequestMapping("/checkSuccess")
    public int checkSuccess(int applicantId) {
        Applicant applicant = new Applicant();
        applicant.setShiState(1);
        applicant.setApplicantId(applicantId);
        int result = applicantService.checkApply(applicant);
        SecondTrial secondTrial = new SecondTrial();
        secondTrial.setApplicant(applicant);
        int result2 = secondTrialService.addTrial(secondTrial);
        if (result > 0 && result2 > 0) {
            return 1;
        } else {
            return 0;
        }
    }
    @RequestMapping("/toWriteRefuse")
    public ModelAndView toWriteRefuse(int applicantId, int userId, ModelAndView mv) {
        mv.setViewName("shiadmin/refuse-write");
        mv.addObject("applicantId", applicantId);
        mv.addObject("userId", userId);
        return mv;
    }
    /**
     * 下载小区信息    导出 excel 使用我们的模板导出
     * /excel_down
     */
    @RequestMapping("/applicant_excel_down")
    public void exportPermMatrix(int shiState, HttpServletRequest request, HttpServletResponse response) throws Exception {
        HSSFWorkbook workbook = new HSSFWorkbook();
        HSSFSheet sheet = workbook.createSheet("xxx信息表");
        List<Applicant> list = new ArrayList<>();
        System.out.println("________________" + shiState + "_________________________");
        if (shiState == 0) {
            list = applicantService.getAllApplicant();
        } else {
            list = applicantService.getOkApplicant();
        }
        //此处添加数据
        HSSFRow headerRow1 = sheet.createRow(0);
        headerRow1.createCell(0).setCellValue("申请人姓名");
        headerRow1.createCell(1).setCellValue("性别");
        headerRow1.createCell(2).setCellValue("身份证号");
        headerRow1.createCell(3).setCellValue("出生日期");
        headerRow1.createCell(4).setCellValue("学历");
        headerRow1.createCell(5).setCellValue("工作单位");
        headerRow1.createCell(6).setCellValue("联系电话");
        headerRow1.createCell(7).setCellValue("联系地址");
        headerRow1.createCell(8).setCellValue("需求面积");
        headerRow1.createCell(9).setCellValue("需求楼层");
        headerRow1.createCell(10).setCellValue("需求房型");
        headerRow1.createCell(11).setCellValue("状态");
        for (int i = 0; i < list.size(); i++) {
            HSSFRow headerRow = sheet.createRow(i + 1);
            headerRow.createCell(0).setCellValue(list.get(i).getApplicantName());
            if (list.get(i).getSex() == 0) {
                headerRow.createCell(1).setCellValue("男");
            } else {
                headerRow.createCell(1).setCellValue("女");
            }
            headerRow.createCell(2).setCellValue(list.get(i).getIdNumber());
            headerRow.createCell(3).setCellValue(list.get(i).getBirthday());
            headerRow.createCell(4).setCellValue(list.get(i).getEducation());
            headerRow.createCell(5).setCellValue(list.get(i).getWorkUnit());
            headerRow.createCell(6).setCellValue(list.get(i).getPhone());
            headerRow.createCell(7).setCellValue(list.get(i).getAddress());
            headerRow.createCell(8).setCellValue(list.get(i).getDemandArea() + "㎡");
            headerRow.createCell(9).setCellValue(list.get(i).getDemandFloor() + "层");
            headerRow.createCell(10).setCellValue(list.get(i).getDemandRoom());
            if (list.get(i).getShiState() == 0) {
                headerRow.createCell(11).setCellValue("未审核");
            } else if (list.get(i).getShiState() == 1) {
                headerRow.createCell(11).setCellValue("审核通过");
            } else {
                headerRow.createCell(11).setCellValue("审核未通过");
            }
        }
        //清空response
        response.reset();
        response.setContentType("multipart/form-data");
        if (shiState == 0) {
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("申请人信息列表(全部)".getBytes(), "iso8859-1") + ".xls");
        } else {
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("申请人信息列表(已通过)".getBytes(), "iso8859-1") + ".xls");
        }
        OutputStream os = new BufferedOutputStream(response.getOutputStream());
        workbook.write(os);
        os.flush();
        os.close();
        workbook.close();
    }
    /**
     * excel导入数据
     */
    @ResponseBody
    @RequestMapping("applicant_input_excel")
    @Transactional(rollbackFor = Exception.class)
    public Map importWatchExcel(@RequestParam("file") MultipartFile xlsFile) {
        Map result = new HashMap<>();
        // contentType
        // String contentType = file.getContentType();
        // excel文件名
        // String fileName = file.getOriginalFilename();
        if (xlsFile.isEmpty()) {
            result.put("code", 500);
            result.put("message", "导入文件为空!");
            return result;
        }
        // 根据不同excel创建不同对象,Excel2003版本-->HSSFWorkbook,Excel2007版本-->XSSFWorkbook
        Workbook wb = null;
        InputStream im = null;
        try {
            im = xlsFile.getInputStream();
            wb = WorkbookFactory.create(im);
            // 根据页面index 获取sheet页
            Sheet sheet = wb.getSheetAt(0);
            Row row = null;
            // 循环sheet页中数据从第x行开始,例:第2行开始为导入数据
            for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
                Applicant applicant = new Applicant();
                // 获取每一行数据
                row = sheet.getRow(i);
                // 输出表格内容,此处可替换为数据插入操作
                if (null != row.getCell(0) && "" != row.getCell(0).toString()) {
                    applicant.setApplicantName(row.getCell(0).getStringCellValue());
                }
                // 内容,表格数字格式为常规
                if (null != row.getCell(1) && "" != row.getCell(1).toString()) {
                    String sex = row.getCell(1).getStringCellValue();
                    if ("男".equals(sex)) {
                        applicant.setSex(0);
                    } else {
                        applicant.setSex(1);
                    }
                }
                if (null != row.getCell(2) && "" != row.getCell(2).toString()) {
                    applicant.setIdNumber(row.getCell(2).getStringCellValue());
                }
                if (null != row.getCell(3) && "" != row.getCell(3).toString()) {
                    applicant.setBirthday(row.getCell(3).getStringCellValue());
                }
                if (null != row.getCell(4) && "" != row.getCell(4).toString()) {
                    applicant.setEducation(row.getCell(4).getStringCellValue());
                }
                if (null != row.getCell(5) && "" != row.getCell(5).toString()) {
                    applicant.setWorkUnit(row.getCell(5).getStringCellValue());
                }
                if (null != row.getCell(6) && "" != row.getCell(6).toString()) {
                    applicant.setPhone(row.getCell(6).getStringCellValue());
                }
                if (null != row.getCell(7) && "" != row.getCell(7).toString()) {
                    applicant.setAddress(row.getCell(7).getStringCellValue());
                }
                if (null != row.getCell(8) && "" != row.getCell(8).toString()) {
                    row.getCell(8).setCellType(CellType.STRING);
                    applicant.setDemandArea(Integer.parseInt(row.getCell(8).getStringCellValue()));
                }
                if (null != row.getCell(9) && "" != row.getCell(9).toString()) {
                    row.getCell(9).setCellType(CellType.STRING);
                    applicant.setDemandFloor(Integer.parseInt(row.getCell(9).getStringCellValue()));
                }
                if (null != row.getCell(10) && "" != row.getCell(10).toString()) {
                    applicant.setDemandRoom(row.getCell(10).getStringCellValue());
                }
                if (null != row.getCell(11) && "" != row.getCell(11).toString()) {
                    String state = row.getCell(11).getStringCellValue();
                    if ("未审核".equals(state)) {
                        applicant.setShiState(0);
                    } else if ("审核通过".equals(state)) {
                        applicant.setShiState(1);
                    } else {
                        applicant.setShiState(2);
                    }
                }
                applicantService.addApplicant(applicant);
            }
            result.put("code", 200);
            result.put("message", "导入成功!");
        } catch (Exception e1) {
            // 回滚数据
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            e1.printStackTrace();
        } finally {
            try {
                im.close();
                wb.close();
            } catch (IOException e2) {
                e2.printStackTrace();
            }
        }
        return result;
    }
    @RequestMapping("/toSelectExcel")
    public String toSelectExcel() {
        return "xianadmin/applicant-excel-select";
    }
    @ResponseBody
    @RequestMapping("/toCheckApply")
    public Map toCheckApply(String applicantName, String idNumber) {
        Map map = new HashMap();
        map.put("applicantName", applicantName);
        map.put("idNumber", idNumber);
        Applicant applicant = applicantService.toCheckApply(map);
        map.put("applicant", applicant);
        return map;
    }
    @ResponseBody
    @RequestMapping("/getApplicantListByTime")
    public Map getApplicantListByTime(String startDate, String endDate, int pageNum, int pageSize) {
        Map map = new HashMap();
        map.put("startDate", startDate);
        map.put("endDate", endDate);
        int applicantCount = applicantService.getApplicantListByTimeCount(map);
        map.put("applicantCount", applicantCount);
        System.out.println("申请人总条数:" + applicantCount);
        map.put("pageNum", pageNum);
        map.put("pageSize", pageSize);
        PageInfo page = applicantService.getApplicantListByTime(map);
        map.put("page", page);
        return map;
    }
    @ResponseBody
    @RequestMapping("/getApplicantForUser")
    public Map getApplicantForUser(String startDate, String endDate, int times, int pageNum, int pageSize) {
        Map map = new HashMap();
        map.put("startDate", startDate);
        map.put("endDate", endDate);
        map.put("times", times);
        if (times == 1) {
            int applicantCount = applicantService.getApplicantListByTimeCount(map);
            map.put("applicantCount", applicantCount);
            map.put("pageNum", pageNum);
            map.put("pageSize", pageSize);
            PageInfo page = applicantService.getApplicantListByTime(map);
            map.put("applicantPage", page);
        } else {
            int trialCount = secondTrialService.getAllTrialCount(map);
            map.put("trialCount", trialCount);
            map.put("pageNum", pageNum);
            map.put("pageSize", pageSize);
            PageInfo page = secondTrialService.getAllTrial(map);
            map.put("trialPage", page);
        }
        return map;
    }
}

五,项目总结


本项目基于springboot框架来进行开发实现,符合现在开发的主流趋势,项目结构清晰明了,层次分明,采用MVC设计模式和三层架构来进行整体设计。界面布局简洁大方,操作符合用户使用习惯,人机交互处理的比较人性化,适合做毕业设计使用,也可以做课程设计或期未作业使用。

相关文章
|
3月前
|
JavaScript 前端开发 Java
垃圾分类管理系统基于 Spring Boot Vue 3 微服务架构实操指南
本文介绍了基于Java技术的垃圾分类管理系统开发方案与实施案例。系统采用前后端分离架构,后端使用Spring Boot框架搭配MySQL数据库,前端可选择Vue.js或Java Swing实现。核心功能模块包括垃圾分类查询、科普教育、回收预约等。文中提供了两个典型应用案例:彭湖花园小区使用的Swing桌面系统和基于Spring Boot+Vue的城市管理系统,分别满足不同场景需求。最新技术方案升级为微服务架构,整合Spring Cloud、Redis、Elasticsearch等技术,并采用Docker容器
191 0
|
4月前
|
JavaScript 前端开发 Java
制造业ERP源码,工厂ERP管理系统,前端框架:Vue,后端框架:SpringBoot
这是一套基于SpringBoot+Vue技术栈开发的ERP企业管理系统,采用Java语言与vscode工具。系统涵盖采购/销售、出入库、生产、品质管理等功能,整合客户与供应商数据,支持在线协同和业务全流程管控。同时提供主数据管理、权限控制、工作流审批、报表自定义及打印、在线报表开发和自定义表单功能,助力企业实现高效自动化管理,并通过UniAPP实现移动端支持,满足多场景应用需求。
408 1
|
5月前
|
前端开发 Java 关系型数据库
基于Java+Springboot+Vue开发的鲜花商城管理系统源码+运行
基于Java+Springboot+Vue开发的鲜花商城管理系统(前后端分离),这是一项为大学生课程设计作业而开发的项目。该系统旨在帮助大学生学习并掌握Java编程技能,同时锻炼他们的项目设计与开发能力。通过学习基于Java的鲜花商城管理系统项目,大学生可以在实践中学习和提升自己的能力,为以后的职业发展打下坚实基础。技术学习共同进步
404 7
|
5月前
|
存储 Java 数据库
Spring Boot 注册登录系统:问题总结与优化实践
在Spring Boot开发中,注册登录模块常面临数据库设计、密码加密、权限配置及用户体验等问题。本文以便利店销售系统为例,详细解析四大类问题:数据库字段约束(如默认值缺失)、密码加密(明文存储风险)、Spring Security配置(路径权限不当)以及表单交互(数据丢失与提示不足)。通过优化数据库结构、引入BCrypt加密、完善安全配置和改进用户交互,提供了一套全面的解决方案,助力开发者构建更 robust 的系统。
161 0
|
2月前
|
前端开发 Java API
酒店管理系统基于 JavaFX Spring Boot 和 React 经典项目重构实操
本文介绍了基于现代技术栈的酒店管理系统开发方案,整合了JavaFX、Spring Boot和React三大技术框架。系统采用前后端分离架构,JavaFX构建桌面客户端,React开发Web管理界面,Spring Boot提供RESTful API后端服务。核心功能模块包括客房管理和客户预订流程,文中提供了JavaFX实现的客房管理界面代码示例和React开发的预订组件代码,展示了如何实现客房信息展示、添加修改操作以及在线预订功能。
158 1
|
消息中间件 存储 Java
📨 Spring Boot 3 整合 MQ 构建聊天消息存储系统
本文详细介绍了如何使用Spring Boot 3结合RabbitMQ构建高效可靠的聊天消息存储系统。通过引入消息队列,实现了聊天功能与消息存储的解耦,解决了高并发场景下直接写入数据库带来的性能瓶颈问题。文章首先分析了不同MQ产品的特点及适用场景,最终选择RabbitMQ作为解决方案,因其成熟稳定、灵活路由和易于集成等优势。接着,通过Docker快速部署RabbitMQ,并完成Spring Boot项目的配置与代码实现,包括生产者发送消息、消费者接收并处理消息等功能。最后,通过异步存储机制,既保证了消息的即时性,又实现了可靠持久化。
356 0
📨 Spring Boot 3 整合 MQ 构建聊天消息存储系统
|
4月前
|
供应链 JavaScript BI
ERP系统源码,基于SpringBoot+Vue+ElementUI+UniAPP开发
这是一款专为小微企业打造的 SaaS ERP 管理系统,基于 SpringBoot+Vue+ElementUI+UniAPP 技术栈开发,帮助企业轻松上云。系统覆盖进销存、采购、销售、生产、财务、品质、OA 办公及 CRM 等核心功能,业务流程清晰且操作简便。支持二次开发与商用,提供自定义界面、审批流配置及灵活报表设计,助力企业高效管理与数字化转型。
424 2
ERP系统源码,基于SpringBoot+Vue+ElementUI+UniAPP开发
|
3月前
|
Java 调度 流计算
基于Java 17 + Spring Boot 3.2 + Flink 1.18的智慧实验室管理系统核心代码
这是一套基于Java 17、Spring Boot 3.2和Flink 1.18开发的智慧实验室管理系统核心代码。系统涵盖多协议设备接入(支持OPC UA、MQTT等12种工业协议)、实时异常检测(Flink流处理引擎实现设备状态监控)、强化学习调度(Q-Learning算法优化资源分配)、三维可视化(JavaFX与WebGL渲染实验室空间)、微服务架构(Spring Cloud构建分布式体系)及数据湖建设(Spark构建实验室数据仓库)。实际应用中,该系统显著提升了设备调度效率(响应时间从46分钟降至9秒)、设备利用率(从41%提升至89%),并大幅减少实验准备时间和维护成本。
240 0
|
3月前
|
机器学习/深度学习 数据采集 人机交互
springboot+redis互联网医院智能导诊系统源码,基于医疗大模型、知识图谱、人机交互方式实现
智能导诊系统基于医疗大模型、知识图谱与人机交互技术,解决患者“知症不知病”“挂错号”等问题。通过多模态交互(语音、文字、图片等)收集病情信息,结合医学知识图谱和深度推理,实现精准的科室推荐和分级诊疗引导。系统支持基于规则模板和数据模型两种开发原理:前者依赖人工设定症状-科室规则,后者通过机器学习或深度学习分析问诊数据。其特点包括快速病情收集、智能病症关联推理、最佳就医推荐、分级导流以及与院内平台联动,提升患者就诊效率和服务体验。技术架构采用 SpringBoot+Redis+MyBatis Plus+MySQL+RocketMQ,确保高效稳定运行。
229 0
|
6月前
|
人工智能 自然语言处理 前端开发
20分钟上手DeepSeek开发:SpringBoot + Vue2快速构建AI对话系统
本文介绍如何使用Spring Boot3与Vue2快速构建基于DeepSeek的AI对话系统。系统具备实时流式交互、Markdown内容渲染、前端安全防护等功能,采用响应式架构提升性能。后端以Spring Boot为核心,结合WebFlux和Lombok开发;前端使用Vue2配合WebSocket实现双向通信,并通过DOMPurify保障安全性。项目支持中文语义优化,API延迟低,成本可控,适合个人及企业应用。跟随教程,轻松开启AI应用开发之旅!

热门文章

最新文章