package com.nis.web.service.restful; import java.io.IOException; import java.text.ParseException; import java.util.ArrayList; import java.util.List; import org.apache.http.client.ClientProtocolException; import org.json.JSONException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.nis.domain.Page; import com.nis.domain.restful.DjDnsLog; import com.nis.domain.restful.DjFtpLog; import com.nis.domain.restful.DjHttpKeywordLog; import com.nis.domain.restful.DjHttpReqLog; import com.nis.domain.restful.DjHttpResLog; import com.nis.domain.restful.DjIpPortLog; import com.nis.domain.restful.DjIpsecLog; import com.nis.domain.restful.DjL2tpLog; import com.nis.domain.restful.DjMailLog; import com.nis.domain.restful.DjOpenvpnLog; import com.nis.domain.restful.DjPptpLog; import com.nis.domain.restful.DjSshLog; import com.nis.domain.restful.DjSslLog; import com.nis.util.Constants; import com.nis.web.dao.DjLogSearchDao; import com.nis.web.service.BaseLogService; /** * @ClassName: DjLogSearchService * @Description: TODO(这里用一句话描述这个类的作用) * @author (zbc) * @date 2016年9月7日 上午11:15:12 * @version V1.0 */ @Service public class DjLogSearchService extends BaseLogService { /** * 持久层对象 */ @Autowired protected DjLogSearchDao dao; /** * 查询端口封堵分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findIpPortPage(Page page, DjIpPortLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findIpPortLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findHttpResPage(Page page, DjHttpResLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findHttpResLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param httpReqLog * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findHttpReqPage(Page page, DjHttpReqLog httpReqLog,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { httpReqLog.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, httpReqLog,activeSys); page.setList(resultList); }else{ page.setList(dao.findHttpReqLogs(httpReqLog)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findHttpKeywordPage(Page page, DjHttpKeywordLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findHttpKeywordLogs(entity)); } return page; } /** * 查询分页数据 * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findHttpMultiPartPage(Page page, DjHttpKeywordLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findHttpKeywordLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findMailPage(Page page, DjMailLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findMailLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findDnsPage(Page page, DjDnsLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findDnsLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findFtpPage(Page page, DjFtpLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findFtpLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findPptpPage(Page page, DjPptpLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findPptpLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findL2tpPage(Page page, DjL2tpLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findL2tpLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findIpsecPage(Page page, DjIpsecLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findIpsecLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findOpenvpnPage(Page page, DjOpenvpnLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findOpenvpnLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findSshPage(Page page, DjSshLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findSshLogs(entity)); } return page; } /** * 查询分页数据 * @param page 分页对象 * @param entity * @return * @throws IOException * @throws JSONException * @throws ParseException * @throws ClientProtocolException * @throws IllegalAccessException * @throws IllegalArgumentException */ public Page findSslPage(Page page, DjSslLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException { entity.setPage(page); if(Constants.IS_USE_ES){ List resultList=new ArrayList<>(); elasticsearchSqlDao.findLogs(resultList, entity,activeSys); page.setList(resultList); }else{ page.setList(dao.findSslLogs(entity)); } return page; } }