SSM学生寮管理システムは、Mavenのマルチモジュールのビルドには、サブページング技術+のユーザーログイン役割を実装します

SSM学生寮管理システムは、Mavenのマルチモジュールのビルドには、ユーザーの役割を実装-ログ+ページング技術
項目説明Mavenのサブモジュールプロジェクト+ SSM寮の管理システム+ Spring MVCの+ jQueryの+ストラップ+マルチモジュール+のsvn +役割-ログイン+ページ+インターセプターを+受信メール。Eメールのように。

 コードはgithubの、ダウンロードhttps://github.com/21503882/stususheアップロードされました

動作環境JDK7 + tomcat7 + MySQLの+のIntelliJ IDEA +達人

プロジェクトの技術(必須)春+ Spring MVCの+ MyBatisの+ストラップ+ jqueryの+のjsp

SSM学生寮データベースのファイル管理システムは、Mavenのマルチモジュールのビルドには、サブページング技術+のユーザーログイン役割を実装します

JARパッケージファイルのマルチモジュールのビルド達人

オリジナルSSM学生寮管理システム、Mavenのマルチモジュール構築、ユーザーのログイン+サブの役割ページング技術SSMの学生ホステル管理システム、Mavenのマルチモジュールのビルドを実装するサブページング技術+のユーザーログイン役割を実装

StuDormLsy.controllerをパッケージ化。
 


import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
 


import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
 
import com.xiaozu.coom.QuartzCronDateUtils;
import com.xiaozu.pojo.Classinformation;
import com.xiaozu.pojo.Login;
import com.xiaozu.pojo.Stuinformation;
import com.xiaozu.pojo.Userinformation;
 
import StuDormLsy.biz.LuserinformationBiz;
import StuDormLsybiz.impl.GrantPowerTask;
import StuDormLsybiz.impl.GrantPowerTask;
import StuDormLsybiz.impl.RevokePowerTask;
 
@Controller
public class LuserinformationController {
 
    @Autowired
    private LuserinformationBiz biz;
 
    @Resource(name = "Lubiz")
    public void setBiz(LuserinformationBiz biz) {
        this.biz = biz;
    }
 
    /**
     * 鐧诲綍
     * */
 
    @RequestMapping(value = "/login", method = { RequestMethod.POST,
            RequestMethod.GET })
    public ModelAndView select(Login user, Stuinformation stuinformation,
            Userinformation userinformation, Classinformation classinformation,
            HttpSession session) throws SchedulerException,
            InstantiationException, ParseException {
        ModelAndView view = new ModelAndView();
        String pwd = user.getPassword();
        user = biz.getLogin(user);
        
        if (user==null){
            view.addObject("errmsg", "账号或密码输入错误!");
            view.setViewName("/login.jsp");
        } else {    
            if(user.getRole()==3){
                stuinformation = this.biz.getstuinfo(user.getAccount());
                session.setAttribute("stuinformation", stuinformation);
            }
            
            // 鐝富浠荤櫥褰昪lassID
        /*    if(user.getRole()==2){
                userinformation = this.biz.getuserinfo(user.getAccount());
                classinformation = this.biz.getclassinfo(userinformation.getUserid());
                session.setAttribute("classinformation", classinformation);
            }*/
            session.setAttribute("user", user);
            session.setAttribute("users", user.getName());
            session.setAttribute("Role", user.getRole());
            session.setAttribute("Account", user.getAccount());
            session.setAttribute("phone", user.getPhone());
            session.setAttribute("pwd", pwd);
            // System.out.println(logins.getPassword());
            view.setViewName("/mainAdmin.jsp");
        }
        return view;
    }
 
    @RequestMapping("/Strip")
    public String Xin(Model model) {
        model.addAttribute("mainPage", "passwordChange.jsp");
        return "mainAdmin.jsp";
    }
 
    /*
     * (value="/updatePwd", method = { RequestMethod.POST, RequestMethod.GET })
     */
    // 锟睫革拷锟斤拷锟斤拷
    @RequestMapping("/Modifypassword")
    public ModelAndView updatePwdS(HttpServletRequest request,
            HttpServletResponse response, HttpSession session, String Account,
            String password) throws IOException {
        ModelAndView mav = new ModelAndView();
        Login updatexiu = new Login();
        updatexiu.setAccount(Account);
        updatexiu.setPassword(password);
 
        int num = biz.updatePwd(Account, password);
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName()
                + ":" + request.getServerPort() + path;
        response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
        response.setHeader("Pragma", "no-cache"); // HTTP 1.0
        response.setDateHeader("Expires", 0); // prevents caching at the proxy
                                                // server
        PrintWriter out = response.getWriter();
        if (num == 1) {
            session.invalidate();
            out.print("<script type='text/javascript'>window.top.location.href='"
                    + basePath + "/login.jsp';</script>");
        }
        out.flush();
        out.close();
        return mav;
    }
 
    // 锟睫革拷
    @SuppressWarnings("deprecation")
    @RequestMapping("updateRole")
    public String update(String Account, int role, String StratDate,
            String EndDate, int UserId, String Ban, String Ren, String Ming)
            throws ParseException, SchedulerException {
        SchedulerFactory schedulerFactory = new StdSchedulerFactory();
        SchedulerFactory schedulerFactorys = new StdSchedulerFactory();
        Scheduler scheduler = null;
        Scheduler schedulers = null;
        QuartzCronDateUtils qq = new QuartzCronDateUtils();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
        String jj = qq.getCron(format.parse(StratDate));
        scheduler = schedulerFactory.getScheduler();
        JobDetail job = JobBuilder.newJob(GrantPowerTask.class)
                .withIdentity("grant", "power")
                .usingJobData("account", Account)
                .usingJobData("stratdate", StratDate)
                .usingJobData("enddate", EndDate)
                .usingJobData("raccount", Account)
                .usingJobData("userid", UserId)
                .usingJobData("receivingtime", StratDate)
                .usingJobData("ban", Ban).usingJobData("ren", Ren)
                .usingJobData("ming", Ming).build();
        // JobDataMap = dataMap = job.getJobDataMap();
        Trigger trigger = TriggerBuilder.newTrigger()
                .withIdentity("CronTrigger1", "CronTriggerGroup")
                .withSchedule(CronScheduleBuilder.cronSchedule(jj)).startNow()
                .build();
        scheduler.scheduleJob(job, trigger);
        scheduler.start();
 
        String kkd = qq.getCron(format.parse(EndDate));
        schedulers = schedulerFactorys.getScheduler();
        JobDetail jobs = JobBuilder.newJob(RevokePowerTask.class)
                .withIdentity("revoke", "power")
                .usingJobData("account", Account).build();
        Trigger triggers = TriggerBuilder.newTrigger()
                .withIdentity("CronTrigger2", "CronTriggerGroups")
                .withSchedule(CronScheduleBuilder.cronSchedule(kkd)).startNow()
                .build();
        schedulers.scheduleJob(jobs, triggers);
        schedulers.start();
        /*
         * Login roles = new Login(); roles.setAccount(Account);
         * roles.setRole(role);
         */
 
        return "/mainAdmin.jsp";
    }
 
    /*
     * @RequestMapping("updateRoless") public String updates(String Account){
     * int role=3; Login roles=new Login(); roles.setAccount(Account);
     * roles.setRole(role); int num=biz.updateRole(Account, role); if(num == 1){
     * return "/mainAdmin.jsp"; } return "/mainAdmin.jsp"; }
     */
 
    // 锟斤拷锟斤拷锟斤拷锟窖�
    @RequestMapping("chuanRoles")
    public String updatetime(Model model) {
        List<Login> Roles = biz.selectxia();
        if (Roles != null) {
            model.addAttribute("Roles", Roles);
            model.addAttribute("mainPage", "Jurisdiction.jsp");
        }
        return "mainAdmin.jsp";
    }
 
    @RequestMapping("recordStu")
    public String selectStudent(Model model, HttpSession session, String Name) {
 
        List<Stuinformation> student = biz.studentSelect(Name);
        if (student != null) {
            model.addAttribute("student", student);
            model.addAttribute("mainPage", "admin/record.jsp");
 
            System.out.println();
        }
        return "mainAdmin.jsp";
    }
 
    @RequestMapping("selectStudents")
    public ModelAndView getAddstudents(Login login, HttpSession session) {
        ModelAndView view = new ModelAndView();
        String account = login.getAccount();
        String phone = login.getPhone();
        String name = login.getName();
        int nums = biz.getAddLogin(login);
        if (nums != 0) {
            view.setViewName("/Stripes");
            session.setAttribute("login", login);
            session.setAttribute("account", account);
            session.setAttribute("phone", phone);
            session.setAttribute("name", name);
        }
        return view;
    }
 
    @RequestMapping("selectStudent")
    public ModelAndView getAddstudent(String Account, String IDnumber,
            String Name, String Sex, String NativePlace, String Phone,
            Integer ClassId, String stayDate, Double HotelExpense,
            Integer Occupancy, Integer RoomId) {
        ModelAndView view = new ModelAndView();
        int num = biz.getAddstudent(Account, IDnumber, Name, Sex, NativePlace,
                Phone, ClassId, stayDate, HotelExpense, Occupancy, RoomId);
        if (num != 0) {
            view.setViewName("/servletStu");
        }
        return view;
    }
 
    @RequestMapping("updateMation")
    public String updatemation(String Account) {
        Integer Occupancy=1;
        Stuinformation mation=new Stuinformation();
        mation.setAccount(Account);
        mation.setOccupancy(Occupancy);
        int num = biz.updateStu(Account, Occupancy);
        if (num == 1) {
            return "/recordStu";
        }
        return "/mainAdmin.jsp";
    }
 
    @RequestMapping("/Strips")
    public String Xins(Model model) {
        model.addAttribute("mainPage", "admin/save.jsp");
        return "mainAdmin.jsp";
    }
 
    @RequestMapping("/Stripes")
    public String Xines(Model model) {
        model.addAttribute("mainPage", "admin/studentSave.jsp");
        return "mainAdmin.jsp";
    }
    
    @RequestMapping("/Striptian")
    public String Xintian(Model model) {
        model.addAttribute("mainPage", "tianjia.jsp");
        return "mainAdmin.jsp";
    }
 
    // 注锟斤拷
    @RequestMapping("/exit")
    public String exit(HttpSession session) {
        session.invalidate();
        return "/login.jsp";
    }
}
  代码已经上传github,下载地址 https://github.com/21503882/stusushe

发布了38 篇原创文章 · 获赞 10 · 访问量 4123

おすすめ

転載: blog.csdn.net/QQ21503882/article/details/104261959