<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.hrm.resource.ResourceComInfo" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%
    RecordSet rs = new RecordSet();
    out.print(":预计落地时间前15天，若尚未进行过程性管理录入，\n" +
              " 提醒人：企微提醒录入人员进行录入；</br>");
    ResourceComInfo resourceComInfo = null;
    try{
        resourceComInfo = new ResourceComInfo();
        List<Map<String,String>> list = new ArrayList<Map<String,String>>();
        String sql =" select id,modedatacreater,proname,profall\n" +
                    " from uf_threebatches\n" +
                    " where id in(\n" +
                    "   select l.id \n" +
                    "   from uf_threebatches l " +
                    "   left join uf_threebatches_dt4 t on l.id = t.mainid \n" +
                    "   where l.id in(\n" +
                    "       select p.id\n" +
                    "       from uf_threebatches p\n" +
                    "       where (trunc(sysdate - to_date(p.profall,'YYYY-MM-DD' ))+1) <= 15 " +
                    "       and (trunc(sysdate - to_date(p.profall,'YYYY-MM-DD' ))+1) >= 0 \n" +
                    "  )\n" +
                    "  group by l.id having count(t.id) = 0\n" +
                    ")" ;

        out.print("当前时间在预计落地时间(profall)的前15天，并且明细表4没有数据的:"+sql+"</br>");

        rs.executeQuery(sql);
        while (rs.next()){
            String id = Util.null2String(rs.getString("id"));
            String lrry = Util.null2String(rs.getString("modedatacreater"));
            String xmmc = Util.null2String(rs.getString("proname"));
            String profall = Util.null2String(rs.getString("profall"));
//            out.print("项目名称:"+xmmc+" 预计落地时间:"+profall+"</br>");

            Map<String,String> map = new HashMap<String,String>();
            map.put("id",id);
            map.put("lrry",lrry);
            map.put("xmmc",xmmc);
            map.put("profall",profall);
            list.add(map);
        }

        out.print("总计:"+list.size()+" 行</br>");

        for(int i=0;i<list.size();i++){
            Map<String,String> map = list.get(i);
            String xmmc = map.get("xmmc");
            String lrry = map.get("lrry");
            String billid = map.get("id");
            String profall = map.get("profall");

            String context = "项目:"+xmmc+"未及时填报过程管理,请及时填报";
            String title = "三个一批项目提醒";
            Set<String> userSet = new HashSet<String>();
            userSet.add(lrry);
            out.print("序号:"+(i+1)+" ,建模ID:"+billid+" ,预计落地时间:"+profall+" ,提醒标题:"+title+" ,提醒内容:"+context+" ,提醒人:"+resourceComInfo.getLastname(lrry)+"("+lrry+")</br>");
        }
    }catch (Exception e){
        out.print("e:"+e);
    }
%>
