2 dcd xl dcd_xl 于 2014.06.17 16:55 提问

JAVA Web员工考勤统计

前台有个打卡的页面,员工输入编号之后,会根据这个Servlet判断和赋值,然后存入数据库,但是项目有个要求是显示一个员工一个月的所有的迟到,旷工次数,就统计这块不会做,想请大家帮帮忙。数据库的信息有截图,但是不知道怎么传上来。。。

package com.gxa.servlet.action;

import java.util.Date;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.gxa.service.RecruitService;
import com.gxa.util.AplException;

public class AttendanceCheck extends HttpServlet {

private static final long serialVersionUID = 1L;

public void doGet(HttpServletRequest req, HttpServletResponse resp) {
    doPost(req, resp);
}

@SuppressWarnings("deprecation")
public void doPost(HttpServletRequest req, HttpServletResponse resp){

        try {
            int em_code = Integer.parseInt(req.getParameter("em_code"));
            RecruitService service = new RecruitService();
            Date time = new Date(System.currentTimeMillis());
            if ( time.getHours() > 9 && time.getHours()<12 ) {
                int wo_late = 1;
                String timemonth = time.getMonth() + 1 + "月份";
                int wo_truancy = 0;
                service.check(em_code, timemonth, wo_late, wo_truancy);

                req.getRequestDispatcher("/login1.jsp").forward(req,
                        resp);

            } else if (time.getHours() > 12) {
                int wo_late = 0;
                String timemonth = time.getMonth()+ 1 + "月份";
                int wo_truancy = 1;
                service.check(em_code, timemonth, wo_late, wo_truancy);
                req.getRequestDispatcher("/login1.jsp").forward(req,
                        resp);
            } else {
                int wo_late = 0;
                String timemonth = time.getMonth()+ 1 + "月份";
                int wo_truancy = 0;
                service.check(em_code, timemonth, wo_late, wo_truancy);
                req.getRequestDispatcher("/login1.jsp").forward(req,
                        resp);
            }
        } catch (Exception e) {
            new AplException("",e).printStackTrace(req,resp,"/err.jsp");
        }


}

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!