<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%
    RecordSet rs = new RecordSet();
    try{
        String sql =" select id,profall,(trunc( to_date(profall, 'YYYY-MM-DD') - sysdate )+1) as sjc,(trunc(sysdate - to_date(profall, 'YYYY-MM-DD')  )+1) as sjc2 from uf_threebatches where (trunc( sysdate - to_date(profall, 'YYYY-MM-DD') )+1) <=15 " ;
        out.print("queryExpectedLandingTime15Day:sql:"+sql+"</br>");
        rs.executeQuery(sql);
        while (rs.next()){
            out.print(Util.null2String(rs.getString("id"))+"</br>");
            out.print(Util.null2String(rs.getString("profall"))+"</br>");
            out.print(Util.null2String(rs.getString("sjc"))+"</br>");
            out.print(Util.null2String(rs.getString("sjc2"))+"</br>");
        }


        sql =" select id,profall,TO_DATE(profall,'YYYY-MM-DD' ) as profall2,(trunc(to_date(profall, 'YYYY-MM-DD') - sysdate )+1) as sjc,(trunc(sysdate - to_date(profall, 'YYYY-MM-DD'))+1) as sjc2 " +
             "  from uf_threebatches where profall>='2025-01-01' and profall<='2025-02-20'" ;
        out.print("queryExpectedLandingTime15Day:sql:"+sql+"</br>");
        rs.executeQuery(sql);
        while (rs.next()){
            out.print(Util.null2String(rs.getString("id"))+"</br>");
            out.print(Util.null2String(rs.getString("profall"))+"</br>");
            out.print(Util.null2String(rs.getString("profall2"))+"</br>");
            out.print(Util.null2String(rs.getString("sjc"))+"</br>");
            out.print(Util.null2String(rs.getString("sjc2"))+"</br>");
        }


        sql =" select l.id,count(t.id) as cou\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\n" +
            "  )\n" +
            "  group by l.id having count(t.id) = 0\n" ;
   


        out.print("queryExpectedLandingTime15Day:sql:"+sql+"</br>");

        rs.executeQuery(sql);
        while (rs.next()){
            out.print(Util.null2String(rs.getString("id"))+"</br>");
            out.print(Util.null2String(rs.getString("cou"))+"</br>");
        }


    }catch (Exception e){
        out.print("e:"+e);
    }
%>
