dcd_xl 2014-06-17 08:55
浏览 2630

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");
        }


}

}

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog