<%@page import="weaver.conn.RecordSet"%>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.conn.RecordSetDataSource" %>
<jsp:useBean id="bb" class="weaver.general.BaseBean" scope="page" />
<%@ page language="java" contentType="text/html; charset=UTF-8" %>

<%
    String dataResource = "E7TEST";

    RecordSet rs = new RecordSet();
    List<String> E9ActivitiesList = getE9HrmActivitiesData();
    List<String> E7ActivitiesList = getE7HrmActivitiesList(dataResource);
    String E7IDS = "";
    out.println("E7比E9多的:</br>");
    for(String e7id : E7ActivitiesList){
        if(!E9ActivitiesList.contains(e7id)){
            E7IDS += StringUtils.isBlank(E7IDS) ? e7id : ","+e7id ;
        }
    }
    out.println(E7IDS+"</br>");

    out.println("E9比E7多的:</br>");
    String E9IDS = "";
    for(String e9id : E9ActivitiesList){
        if(!E7ActivitiesList.contains(e9id)){
            E9IDS += StringUtils.isBlank(E9IDS) ? e9id : ","+ e9id ;
        }
    }
    out.println(E9IDS+"</br>");

%>

<%!
    public List<String> getE7HrmActivitiesList(String dataResource){

        RecordSetDataSource rsd = new RecordSetDataSource(dataResource);
        List<String> activitiesList = new ArrayList<String>();
        String sql = " select id from hrmjobactivities " ;
        rsd.execute(sql);
        while (rsd.next()){
            String id = Util.null2String(rsd.getString("id"));
            activitiesList.add(id);
        }
        return activitiesList;
    }

    /***
     *
     * @return
     */
    public List<String> getE9HrmActivitiesData(){

        RecordSet rsd = new RecordSet();
        List<String> activitiesList = new ArrayList<String>();
        String sql = " select outkey from hrmjobactivities where id in(select h.jobactivityid from hrmjobtitles h)";
        rsd.execute(sql);
        while (rsd.next()){
            String outkey = Util.null2String(rsd.getString("outkey"));
            activitiesList.add(outkey);
        }
        return activitiesList;
    }



%>




