
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.db.LunarCalendarFestivalUtils" %>
<%!
    public static String getMxId(ConnectionFactory cf,Connection conn,String date) {
        String mx_id="";
        Vector userList = cf.doQuery(conn,"select mx_id from zb_zdpb_bgs where b_time<=? and e_time>=? order by add_time desc limit 1",null,new Object[]{date,date});
        if(userList!=null && userList.size()>0){
            Hashtable ht1 = (Hashtable) userList.get(0);
            mx_id = (String) ht1.get("mx_id");
        }
        return mx_id;
    }
%>
<%
    ConnectionFactory cf = new ConnectionFactory();
    Pub pub = new Pub();
    Connection conn = null;
    Vector v_list = null;
    Vector v_list_h = null;
    Vector v_list_xiu = null;
    String year = pub.trimNull(request.getParameter("year"));
    String month = pub.trimNull(request.getParameter("month"));
    if("13".equals(month)){
        year=String.valueOf(Integer.parseInt(year)+1);
        month="01";
    }
    if("0".equals(month)){
        year=String.valueOf(Integer.parseInt(year)-1);
        month="12";
    }
    String day = pub.trimNull(request.getParameter("day"));
    if(month.length()==1){
        month="0"+month;
    }
    month="-"+month;
    if(day.length()==1){
        day="0"+day;
    }
    day="-"+day;
    List list_s = new ArrayList();
    String result="";
    String name ="";
    String xiuxi ="";
    try {
        LunarCalendarFestivalUtils nl = new LunarCalendarFestivalUtils();
        nl.initLunarCalendarInfo(year+month+day);
        StringBuffer sb = new StringBuffer();
        sb.append("select t1.zb_user from zb_user_gl_bgs t1  where 1=1 ");
        sb.append(" and t1.year=? ");
        list_s.add(year+month+day);
        conn = com.censoft.db.DBUtil.getConnection();
        sb.append(" order by t1.id asc");
        v_list = cf.doQuery(conn, sb.toString(), null, list_s.toArray());
        StringBuffer sql = new StringBuffer();
        sql.append("select name from zb_holiday where h_day=? ");
        v_list_h= cf.doQuery(conn, sql.toString(), null, list_s.toArray());
        StringBuffer sql_xiu = new StringBuffer();
        sql_xiu.append("select name from zb_holiday where day=? ");
        v_list_xiu= cf.doQuery(conn, sql_xiu.toString(), null, list_s.toArray());
        if (v_list == null) {
            out.println("查询出错" + cf.getMsg());
            return;
        }
        if (v_list_h == null) {
            out.println("查询出错" + cf.getMsg());
            return;
        }
        if (v_list_xiu == null) {
            out.println("查询出错" + cf.getMsg());
            return;
        }
        if (v_list != null && v_list.size() > 0) {
            for (int i = 0; i < v_list.size(); i++) {
                Hashtable ht = (Hashtable) v_list.get(i);
                String zb_user = pub.trimNull((String) ht.get("zb_user"));
                result=result+zb_user+"</br>";
            }
        }
        if (v_list_h != null && v_list_h.size() > 0) {
            Hashtable ht = (Hashtable) v_list_h.get(0);
            name = pub.trimNull((String) ht.get("name"));
        }
        if("".equals(name)){
            String nongli =nl.getLunarDay();
            name=nongli;
        }
        if (v_list_xiu != null && v_list_xiu.size() > 0) {
            Hashtable ht = (Hashtable) v_list_xiu.get(0);
            xiuxi = pub.trimNull((String) ht.get("name"));
            xiuxi="休";
        }
        out.println(result+"_"+name+"="+xiuxi);
    } catch (Exception e) {
        out.println("查询异常" + e);
        return;
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
    }
%>