上传代码
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.restful.ConfigPzIdSource;
|
||||
import com.nis.web.dao.ConfigPzIdDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
* @ClassName:ConfigPzIdService
|
||||
* @Description:TODO(这里用一句话描述这个类的作用)
|
||||
* @author (zdx)
|
||||
* @date 2017年9月20日 上午10:43:36
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ConfigPzIdService extends BaseLogService {
|
||||
|
||||
protected final Logger logger = Logger.getLogger(this.getClass());
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected ConfigPzIdDao dao;
|
||||
|
||||
public ConfigPzIdSource getConfigPzIdList(ConfigPzIdSource entity){
|
||||
List<Long> pzIdList = new ArrayList<Long>();
|
||||
entity.setSourceName(entity.getSourceName().toUpperCase());
|
||||
for (int i = 0; i < entity.getNum(); i++) {
|
||||
pzIdList.add(dao.getConfigPzIdList(entity));
|
||||
}
|
||||
entity.setPzIdList(pzIdList);
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
2007
src/main/java/com/nis/web/service/restful/ConfigSourcesService.java
Normal file
2007
src/main/java/com/nis/web/service/restful/ConfigSourcesService.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @Title: ControlService.java
|
||||
* @Package com.nis.web.service.restful
|
||||
* @Description: TODO(用一句话描述该文件做什么)
|
||||
* @author (darnell)
|
||||
* @date 2016年8月15日 下午4:08:12
|
||||
* @version V1.0
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.ControlLog;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.web.dao.ControlLogDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: ControlService
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @author (darnell)
|
||||
* @date 2016年8月15日 下午4:08:12
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ControlLogService extends CrudService<ControlLogDao, ControlLog>{
|
||||
|
||||
@Autowired
|
||||
public ControlLogDao logDao;
|
||||
|
||||
public Page<ControlLog> getLogInfo(Page<ControlLog> page, ControlLog log) {
|
||||
return findPage(page, log);
|
||||
}
|
||||
|
||||
public ControlLog findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
|
||||
public void createControlLog(ControlLog log) {
|
||||
logDao.saveControlLog(log);
|
||||
}
|
||||
|
||||
public void deleteControlLog(long id) {
|
||||
logDao.removeControlLog(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DataDictionaryName;
|
||||
import com.nis.domain.restful.DataDictionaryValue;
|
||||
import com.nis.web.dao.DataDictionaryDao;
|
||||
|
||||
@Service
|
||||
public class DataDictionaryService {
|
||||
protected final Logger logger1 = Logger.getLogger(this.getClass());
|
||||
@Autowired
|
||||
private DataDictionaryDao dataDictionaryDao;
|
||||
|
||||
public Map<String, List<DataDictionaryValue>> getAllDataDict() {
|
||||
Map<String, List<DataDictionaryValue>> map = new HashMap<String, List<DataDictionaryValue>>();
|
||||
List<DataDictionaryValue> allDictName = dataDictionaryDao.getAllDictName(new DataDictionaryValue());
|
||||
for (DataDictionaryValue dictVal : allDictName) {
|
||||
if (map.containsKey(dictVal.getDataDictName())) {
|
||||
map.get(dictVal.getDataDictName()).add(dictVal);
|
||||
} else {
|
||||
List<DataDictionaryValue> list = new ArrayList<DataDictionaryValue>();
|
||||
list.add(dictVal);
|
||||
map.put(dictVal.getDataDictName(), list);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Page<DataDictionaryValue> getDataDictList(Page<DataDictionaryValue> page, DataDictionaryValue entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dataDictionaryDao.getAllDictName(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public List<DataDictionaryName> getDataDictList() {
|
||||
return dataDictionaryDao.selAllDictName();
|
||||
}
|
||||
|
||||
public String saveDataDict(String dataDictId, String addDictName, String dictVal, String option) {
|
||||
if (null != option && option.equals("addName")) {
|
||||
DataDictionaryName dataDictionaryName = new DataDictionaryName(addDictName);
|
||||
dataDictionaryDao.addDictName(dataDictionaryName);
|
||||
return "ok";
|
||||
} else if (null != option && option.equals("addValue")) {
|
||||
String[] split = dictVal.split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
dataDictionaryDao.addDictValue(new DataDictionaryValue(Long.parseLong(dataDictId), split[i]));
|
||||
}
|
||||
return "ok";
|
||||
} else if (null != option && option.equals("addNameAndValue")) {
|
||||
DataDictionaryName dataDictionaryName = new DataDictionaryName(addDictName);
|
||||
dataDictionaryDao.addDictName(dataDictionaryName);
|
||||
Long dictNameId = dataDictionaryName.getDictNameId();
|
||||
String[] split = dictVal.split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
dataDictionaryDao.addDictValue(new DataDictionaryValue(dictNameId, split[i]));
|
||||
}
|
||||
return "ok";
|
||||
} else {
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
public String delDictVal(String id) {
|
||||
if (id.contains(",")) {
|
||||
id = id.replace("[", "").replace("]", "");
|
||||
String[] idArr = id.split(",");
|
||||
for (String str : idArr) {
|
||||
if (null != str && !str.equals("")) {
|
||||
dataDictionaryDao.updateDictValue(new DataDictionaryValue(Long.parseLong(str), 0l));
|
||||
}
|
||||
}
|
||||
return "ok";
|
||||
} else {
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
public String delDictName(String id) {
|
||||
if (id.contains(",")) {
|
||||
id = id.replace("[", "").replace("]", "");
|
||||
String[] idArr = id.split(",");
|
||||
for (String str : idArr) {
|
||||
if (null != str && !str.equals("")) {
|
||||
dataDictionaryDao.updateDictName(new DataDictionaryName(Long.parseLong(str), 0l));
|
||||
DataDictionaryValue dictVal = new DataDictionaryValue();
|
||||
dictVal.setDictNameId(Long.parseLong(str));
|
||||
dictVal.setIsValid(0l);
|
||||
dataDictionaryDao.updateDictValue(dictVal);
|
||||
}
|
||||
}
|
||||
return "ok";
|
||||
} else {
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
public DataDictionaryValue getDict(String id) {
|
||||
Long dictId = null;
|
||||
if (id.contains(",")) {
|
||||
id = id.replace("[", "").replace("]", "");
|
||||
String[] idArr = id.split(",");
|
||||
for (String str : idArr) {
|
||||
if (null != str && !str.equals("")) {
|
||||
dictId = Long.parseLong(str);
|
||||
}
|
||||
}
|
||||
if (null == dictId) {
|
||||
return null;
|
||||
}
|
||||
List<DataDictionaryValue> allDictName = dataDictionaryDao.getAllDictName(new DataDictionaryValue(dictId));
|
||||
return allDictName.get(0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String updateDataDict(String dictVal, String dictId, String option) {
|
||||
if (null != option && option.equals("updateVal")) {// 修改值
|
||||
dataDictionaryDao.updateDictValue(new DataDictionaryValue(Long.parseLong(dictId), null, dictVal));
|
||||
return "ok";
|
||||
} else {
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfDjNestLog;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.DfDjNestLogDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* @ClassName: DfDjNestLogService
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @author (zbc)
|
||||
* @date 2016年11月11日 下午4:40:00
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DfDjNestLogService extends BaseLogService {
|
||||
protected final Logger logger = Logger.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
protected DfDjNestLogDao dao;
|
||||
|
||||
|
||||
public Page<DfDjNestLog> findDfDjNestLogPage(Page<DfDjNestLog> page, DfDjNestLog entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfDjNestLogPage(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public void queryConditionCheck(SaveRequestLogThread thread, long start, DfDjNestLog entity, Class<DfDjNestLog> clazz, Page<?> page) {
|
||||
|
||||
if(StringUtil.isBlank(entity.getSearchLayerId())) {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchLayerId查询参数不能为空",
|
||||
RestBusinessCode.missing_args.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
checkCloumnIsExist(thread,start,clazz, page);
|
||||
} catch (RestServiceException e) {
|
||||
logger.error(e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
*@Title: DfIpPortUdpService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfIpPortUdp;
|
||||
import com.nis.web.dao.DfIpPortUdpDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: DfIpPortUdpService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DfIpPortUdpService extends CrudService<DfIpPortUdpDao, DfIpPortUdp> {
|
||||
@Autowired
|
||||
public DfIpPortUdpDao dfIpPortUdpDao;
|
||||
public void saveDfIpPortUdpBatch(List<DfIpPortUdp> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,DfIpPortUdpDao.class);
|
||||
}
|
||||
public void updateDfIpPortUdpBatch(List<DfIpPortUdp> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, DfIpPortUdpDao.class);
|
||||
}
|
||||
public void removeDfIpPortUdp(long id) {
|
||||
dfIpPortUdpDao.delete(id);
|
||||
}
|
||||
public void removeDfIpPortUdpBatch(List<DfIpPortUdp> entity) {
|
||||
super.deleteBatch(entity, DfIpPortUdpDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfJitAffairDestReport;
|
||||
import com.nis.domain.restful.DfJitAffairSrcReport;
|
||||
import com.nis.domain.restful.DfJitFlDestReport;
|
||||
import com.nis.domain.restful.DfJitFlSrcReport;
|
||||
import com.nis.domain.restful.DfJitGuaranteeDestReport;
|
||||
import com.nis.domain.restful.DfJitGuaranteeSrcReport;
|
||||
import com.nis.domain.restful.DfJitIdDestReport;
|
||||
import com.nis.domain.restful.DfJitIdSrcReport;
|
||||
import com.nis.domain.restful.DfJitMissionDestReport;
|
||||
import com.nis.domain.restful.DfJitMissionSrcReport;
|
||||
import com.nis.domain.restful.DfJitTagDestReport;
|
||||
import com.nis.domain.restful.DfJitTagSrcReport;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.DfJitLogSearchDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
@Service
|
||||
public class DfJitLogSearchService extends BaseLogService {
|
||||
|
||||
@Autowired
|
||||
private DfJitLogSearchDao dfJitLogSearchDao;
|
||||
|
||||
public Page<DfJitFlSrcReport> findDfJitFlSrcReport(Page<DfJitFlSrcReport> page, DfJitFlSrcReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitFlSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitFlDestReport> findDfJitFlDestReport(Page<DfJitFlDestReport> page, DfJitFlDestReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitFlDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitAffairSrcReport> findDfJitAffairSrcReport(Page<DfJitAffairSrcReport> page,
|
||||
DfJitAffairSrcReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitAffairSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitAffairDestReport> findDfJitAffairDestReport(Page<DfJitAffairDestReport> page,
|
||||
DfJitAffairDestReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitAffairDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DfJitMissionSrcReport> findDfJitMissionSrcReport(Page<DfJitMissionSrcReport> page,
|
||||
DfJitMissionSrcReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitMissionSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitMissionDestReport> findDfJitMissionDestReport(Page<DfJitMissionDestReport> page,
|
||||
DfJitMissionDestReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitMissionDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitGuaranteeSrcReport> findDfJitGuaranteeSrcReport(Page<DfJitGuaranteeSrcReport> page,
|
||||
DfJitGuaranteeSrcReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitGuaranteeSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitGuaranteeDestReport> findDfJitGuaranteeDestReport(Page<DfJitGuaranteeDestReport> page,
|
||||
DfJitGuaranteeDestReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitGuaranteeDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitTagSrcReport> findDfJitTagSrcReport(Page<DfJitTagSrcReport> page, DfJitTagSrcReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitTagSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitTagDestReport> findDfJitTagDestReport(Page<DfJitTagDestReport> page, DfJitTagDestReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitTagDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitIdSrcReport> findDfJitIdSrcReport(Page<DfJitIdSrcReport> page, DfJitIdSrcReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitIdSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfJitIdDestReport> findDfJitIdDestReport(Page<DfJitIdDestReport> page, DfJitIdDestReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dfJitLogSearchDao.findDfJitIdDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public void queryDfJitFlCheck(SaveRequestLogThread thread,long start,String searchFl, String searchXz) {
|
||||
try {
|
||||
if (!StringUtil.isBlank(searchFl)) {
|
||||
Integer.parseInt(searchFl);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"searchFl参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"searchFl参数错误");
|
||||
}
|
||||
try {
|
||||
if (!StringUtil.isBlank(searchXz)) {
|
||||
Integer.parseInt(searchXz);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"searchXz参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"searchXz参数错误");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfKeyConvertUrl;
|
||||
import com.nis.domain.restful.DfKeyMailAdd;
|
||||
import com.nis.domain.restful.DjFlowControlStop;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.DfKeyConvertUrlDao;
|
||||
import com.nis.web.dao.IntervalTimeSearchDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* @ClassName: DfKeyConvertUrlService
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @author (DDM)
|
||||
* @date 2016年9月27日上午10:12:58
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DfKeyConvertUrlService extends BaseLogService {
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
protected final Logger logger = Logger.getLogger(this.getClass());
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DfKeyConvertUrlDao dao;
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfKeyConvertUrl> findFlowControlStopPage(Page<DfKeyConvertUrl> page,
|
||||
DfKeyConvertUrl entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfKeyConvertUrlPage(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键字业务转换url查询条件检查
|
||||
* wx
|
||||
* @param entity
|
||||
*/
|
||||
public void queryConditionCheck(SaveRequestLogThread thread,long start,DfKeyConvertUrl entity,Page page) {
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchId())) {
|
||||
Long.parseLong(entity.getSearchId());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数错误");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getOptStartTime())) {
|
||||
sdf.parse(entity.getOptStartTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optStartTime参数格式错误");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getOptEndTime())) {
|
||||
sdf.parse(entity.getOptEndTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optEndTime参数错误");
|
||||
}
|
||||
|
||||
try {
|
||||
checkCloumnIsExist(thread,start,DfKeyConvertUrl.class, page);
|
||||
} catch (RestServiceException e) {
|
||||
logger.error(e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfKeyMailAdd;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.DfKeyMailAddDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* @ClassName: DfKeyMailAddService
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @author (ZBC)
|
||||
* @date 2016年11月09日 下午02:25:00
|
||||
* @version V1.0
|
||||
*/
|
||||
|
||||
@Service
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public class DfKeyMailAddService extends BaseLogService {
|
||||
protected final Logger logger = Logger.getLogger(this.getClass());
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Autowired
|
||||
protected DfKeyMailAddDao dao;
|
||||
|
||||
public Page<DfKeyMailAdd> findDfKeyMailAddPage(Page<DfKeyMailAdd> page, DfKeyMailAdd entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfKeyMailAddPage(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询条件检查
|
||||
*/
|
||||
public void queryConditionCheck(SaveRequestLogThread thread, long start, DfKeyMailAdd entity, Page page) {
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchId())) {
|
||||
Long.parseLong(entity.getSearchId());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数错误");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getOptStartTime())) {
|
||||
sdf.parse(entity.getOptStartTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optStartTime参数格式错误");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getOptEndTime())) {
|
||||
sdf.parse(entity.getOptEndTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optEndTime参数错误");
|
||||
}
|
||||
|
||||
try {
|
||||
checkCloumnIsExist(thread,start,DfKeyMailAdd.class, page);
|
||||
} catch (RestServiceException e) {
|
||||
logger.error(e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,556 @@
|
||||
/**
|
||||
* @Title: DfLogSearchService.java
|
||||
* @Package com.nis.web.service.restful
|
||||
* @Description: TODO(用一句话描述该文件做什么)
|
||||
* @author (ddm)
|
||||
* @date 2016年9月15日 下午2:08:12
|
||||
* @version V1.0
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
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.LogEntity;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfDnsLog;
|
||||
import com.nis.domain.restful.DfFtpLog;
|
||||
import com.nis.domain.restful.DfHttpKeywordLog;
|
||||
import com.nis.domain.restful.DfHttpReqLog;
|
||||
import com.nis.domain.restful.DfHttpResLog;
|
||||
import com.nis.domain.restful.DfIpPortLog;
|
||||
import com.nis.domain.restful.DfIpsecLog;
|
||||
import com.nis.domain.restful.DfL2tpLog;
|
||||
import com.nis.domain.restful.DfMailLog;
|
||||
import com.nis.domain.restful.DfOpenvpnLog;
|
||||
import com.nis.domain.restful.DfPptpLog;
|
||||
import com.nis.domain.restful.DfSshLog;
|
||||
import com.nis.domain.restful.DfSslLog;
|
||||
import com.nis.domain.restful.DfTunnelRandomLog;
|
||||
//import com.nis.util.MysqlJDBC;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.DfLogSearchDao;
|
||||
import com.nis.web.dao.DfLogSearchDaoCluster;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
* @ClassName: DfLogSearchService
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @author (ddm)
|
||||
* @date 2016年9月5日 下午2:08:12
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DfLogSearchService extends BaseLogService{
|
||||
protected final Logger logger = Logger.getLogger(this.getClass());
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DfLogSearchDao dao;
|
||||
@Autowired
|
||||
protected DfLogSearchDaoCluster daoCluster;
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public LogEntity get(Long id) {
|
||||
return dao.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public LogEntity get(LogEntity entity) {
|
||||
return dao.get(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public List<LogEntity> findList(LogEntity entity) {
|
||||
return dao.findList(entity);
|
||||
}
|
||||
/**
|
||||
* 查询端口封堵分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfIpPortLog> findIpPortPage(Page<DfIpPortLog> page, DfIpPortLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfIpPortLog> 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 Exception
|
||||
*/
|
||||
public Page<DfHttpReqLog> findHttpReqPage(Page<DfHttpReqLog> page, DfHttpReqLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfHttpReqLog> resultList=new ArrayList<>();
|
||||
elasticsearchSqlDao.findLogs(resultList, entity,activeSys);
|
||||
page.setList(resultList);
|
||||
}else{
|
||||
page.setList(dao.findHttpReqLogs(entity));
|
||||
}
|
||||
/*if(type.equals("jdbc")){
|
||||
logger.info("**********oralce JDBC数据查询开始时间"+System.currentTimeMillis());
|
||||
page.setList(MysqlJDBC.queryByCondition(page, entity));
|
||||
logger.info("**********oralce JDBC数据查询结束时间"+System.currentTimeMillis());
|
||||
}else if(type.equals("es")){
|
||||
logger.info("**********es数据查询开始时间"+System.currentTimeMillis());
|
||||
List<DfHttpReqLog> dfHttpReqLogs=new ArrayList<DfHttpReqLog>();
|
||||
elasticsearchSqlDao.findLogs(dfHttpReqLogs, entity);
|
||||
page.setList(dfHttpReqLogs);
|
||||
logger.info("**********es数据查询开始时间"+System.currentTimeMillis());
|
||||
}else{
|
||||
logger.info("**********oralce Mybatis数据查询开始时间"+System.currentTimeMillis());
|
||||
page.setList(dao.findHttpReqLogs(entity));
|
||||
logger.info("**********oralce Mybatis数据查询开始结束"+System.currentTimeMillis());
|
||||
}*/
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfHttpResLog> findHttpResPage(Page<DfHttpResLog> page, DfHttpResLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfHttpResLog> resultList=new ArrayList<>();
|
||||
elasticsearchSqlDao.findLogs(resultList, entity,activeSys);
|
||||
page.setList(resultList);
|
||||
}else{
|
||||
page.setList(dao.findHttpResLogs(entity));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfHttpKeywordLog> findHttpKeywordPage(Page<DfHttpKeywordLog> page, DfHttpKeywordLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfHttpKeywordLog> resultList=new ArrayList<>();
|
||||
elasticsearchSqlDao.findLogs(resultList, entity,activeSys);
|
||||
page.setList(resultList);
|
||||
}else{
|
||||
page.setList(dao.findHttpKeywordLogs(entity));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfHttpKeywordLog> findHttpMultiPartPage(Page<DfHttpKeywordLog> page, DfHttpKeywordLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfHttpKeywordLog> 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 Exception
|
||||
*/
|
||||
public Page<DfMailLog> findMailPage(Page<DfMailLog> page, DfMailLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfMailLog> 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 Exception
|
||||
*/
|
||||
public Page<DfDnsLog> findDnsPage(Page<DfDnsLog> page, DfDnsLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfDnsLog> 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 Exception
|
||||
*/
|
||||
public Page<DfFtpLog> findFtpPage(Page<DfFtpLog> page, DfFtpLog entity,String activeSys) throws SQLException, IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfFtpLog> 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 Exception
|
||||
*/
|
||||
public Page<DfPptpLog> findPptpPage(Page<DfPptpLog> page, DfPptpLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfPptpLog> 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 Exception
|
||||
*/
|
||||
public Page<DfL2tpLog> findL2tpPage(Page<DfL2tpLog> page, DfL2tpLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfL2tpLog> 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 Exception
|
||||
*/
|
||||
public Page<DfIpsecLog> findIpsecPage(Page<DfIpsecLog> page, DfIpsecLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfIpsecLog> 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 Exception
|
||||
*/
|
||||
public Page<DfOpenvpnLog> findOpenvpnPage(Page<DfOpenvpnLog> page, DfOpenvpnLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfOpenvpnLog> 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 Exception
|
||||
*/
|
||||
public Page<DfSshLog> findSshPage(Page<DfSshLog> page, DfSshLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfSshLog> 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 Exception
|
||||
*/
|
||||
public Page<DfSslLog> findSslPage(Page<DfSslLog> page, DfSslLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfSslLog> resultList=new ArrayList<>();
|
||||
elasticsearchSqlDao.findLogs(resultList, entity,activeSys);
|
||||
page.setList(resultList);
|
||||
}else{
|
||||
page.setList(dao.findSslLogs(entity));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfTunnelRandomLog> findTunnelRandomPage(Page<DfTunnelRandomLog> page, DfTunnelRandomLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DfTunnelRandomLog> resultList=new ArrayList<>();
|
||||
elasticsearchSqlDao.findLogs(resultList, entity,activeSys);
|
||||
page.setList(resultList);
|
||||
}else{
|
||||
page.setList(dao.findTunnelRandomLogs(entity));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询端口封堵分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfIpPortLog> findIpPortPageCluster(Page<DfIpPortLog> page, DfIpPortLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findIpPortLogsCluster(entity));
|
||||
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfHttpReqLog> findHttpReqPageCluster(Page<DfHttpReqLog> page, DfHttpReqLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findHttpReqLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfHttpResLog> findHttpResPageCluster(Page<DfHttpResLog> page, DfHttpResLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findHttpResLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfHttpKeywordLog> findHttpKeywordPageCluster(Page<DfHttpKeywordLog> page, DfHttpKeywordLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findHttpKeywordLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfHttpKeywordLog> findHttpMultiPartPageCluster(Page<DfHttpKeywordLog> page, DfHttpKeywordLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findHttpKeywordLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfMailLog> findMailPageCluster(Page<DfMailLog> page, DfMailLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findMailLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfDnsLog> findDnsPageCluster(Page<DfDnsLog> page, DfDnsLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findDnsLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfFtpLog> findFtpPageCluster(Page<DfFtpLog> page, DfFtpLog entity,String activeSys) throws SQLException, IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findFtpLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfPptpLog> findPptpPageCluster(Page<DfPptpLog> page, DfPptpLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findPptpLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfL2tpLog> findL2tpPageCluster(Page<DfL2tpLog> page, DfL2tpLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findL2tpLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfIpsecLog> findIpsecPageCluster(Page<DfIpsecLog> page, DfIpsecLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findIpsecLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfOpenvpnLog> findOpenvpnPageCluster(Page<DfOpenvpnLog> page, DfOpenvpnLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findOpenvpnLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfSshLog> findSshPageCluster(Page<DfSshLog> page, DfSshLog entity,String activeSys) throws Exception {
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findSshLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfSslLog> findSslPageCluster(Page<DfSslLog> page, DfSslLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findSslLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Page<DfTunnelRandomLog> findTunnelRandomPageCluster(Page<DfTunnelRandomLog> page, DfTunnelRandomLog entity,String activeSys) throws Exception{
|
||||
entity.setPage(page);
|
||||
page.setList(daoCluster.findTunnelRandomLogsCluster(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfAttrTypeReport;
|
||||
import com.nis.domain.restful.DfDestIpCountryReport;
|
||||
import com.nis.domain.restful.DfDestIpReport;
|
||||
import com.nis.domain.restful.DfEntranceReport;
|
||||
import com.nis.domain.restful.DfLwhhAttrReport;
|
||||
import com.nis.domain.restful.DfLwhhReport;
|
||||
import com.nis.domain.restful.DfLwhhTagReport;
|
||||
import com.nis.domain.restful.DfPzReport;
|
||||
import com.nis.domain.restful.DfPzReportStat;
|
||||
import com.nis.domain.restful.DfServiceReport;
|
||||
import com.nis.domain.restful.DfSrcIpAttrReport;
|
||||
import com.nis.domain.restful.DfSrcIpDomeSticReport;
|
||||
import com.nis.domain.restful.DfSrcIpReport;
|
||||
import com.nis.domain.restful.DfSrcIpTagReport;
|
||||
import com.nis.domain.restful.DfTagReport;
|
||||
import com.nis.web.dao.DfMultiDimensionalReportDao;
|
||||
import com.nis.web.dao.DfReportDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: DfMultiDimensionsReportService
|
||||
* @Description: TODO(df多维实时统计)
|
||||
* @author (DDM)
|
||||
* @date 2017年8月4日下午3:14:07
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DfMultiDimensionalReportService extends BaseLogService {
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DfMultiDimensionalReportDao dao;
|
||||
|
||||
|
||||
public Page<DfLwhhAttrReport> findDfLwhhAttrReportPage(Page<DfLwhhAttrReport> page, DfLwhhAttrReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfLwhhAttrReport> dfLwhhAttrReports = dao.findDfLwhhAttrReport(entity);
|
||||
if (null != dfLwhhAttrReports && dfLwhhAttrReports.size() > 0) {
|
||||
for (DfLwhhAttrReport dfLwhhAttrReport : dfLwhhAttrReports) {
|
||||
if (null != dfLwhhAttrReport.getAsum() && dfLwhhAttrReport.getAsum() != 0) {
|
||||
dfLwhhAttrReport.setAbsum(dfLwhhAttrReport.getAsum());
|
||||
} else if ((null == dfLwhhAttrReport.getAsum() || dfLwhhAttrReport.getAsum() == 0)
|
||||
&& (null != dfLwhhAttrReport.getBsum() && dfLwhhAttrReport.getBsum() != 0)) {
|
||||
dfLwhhAttrReport.setAbsum(dfLwhhAttrReport.getBsum());
|
||||
} else {
|
||||
dfLwhhAttrReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(dfLwhhAttrReports);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfLwhhTagReport> findDfLwhhTagReportPage(Page<DfLwhhTagReport> page, DfLwhhTagReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfLwhhTagReport> dfLwhhTagReports = dao.findDfLwhhTagReportPage(entity);
|
||||
if (null != dfLwhhTagReports && dfLwhhTagReports.size() > 0) {
|
||||
for (DfLwhhTagReport dfLwhhTagReport : dfLwhhTagReports) {
|
||||
if (null != dfLwhhTagReport.getAsum() && dfLwhhTagReport.getAsum() != 0) {
|
||||
dfLwhhTagReport.setAbsum(dfLwhhTagReport.getAsum());
|
||||
} else if ((null == dfLwhhTagReport.getAsum() || dfLwhhTagReport.getAsum() == 0)
|
||||
&& (null != dfLwhhTagReport.getBsum() && dfLwhhTagReport.getBsum() != 0)) {
|
||||
dfLwhhTagReport.setAbsum(dfLwhhTagReport.getBsum());
|
||||
} else {
|
||||
dfLwhhTagReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(dfLwhhTagReports);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfSrcIpAttrReport> findDfSrcIpAttrReportPage(Page<DfSrcIpAttrReport> page, DfSrcIpAttrReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfSrcIpAttrReport> dfSrcIpAttrReports = dao.findDfSrcIpAttrReportPage(entity);
|
||||
if (null != dfSrcIpAttrReports && dfSrcIpAttrReports.size() > 0) {
|
||||
for (DfSrcIpAttrReport dfSrcIpAttrReport : dfSrcIpAttrReports) {
|
||||
if (null != dfSrcIpAttrReport.getAsum() && dfSrcIpAttrReport.getAsum() != 0) {
|
||||
dfSrcIpAttrReport.setAbsum(dfSrcIpAttrReport.getAsum());
|
||||
} else if ((null == dfSrcIpAttrReport.getAsum() || dfSrcIpAttrReport.getAsum() == 0)
|
||||
&& (null != dfSrcIpAttrReport.getBsum() && dfSrcIpAttrReport.getBsum() != 0)) {
|
||||
dfSrcIpAttrReport.setAbsum(dfSrcIpAttrReport.getBsum());
|
||||
} else {
|
||||
dfSrcIpAttrReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(dfSrcIpAttrReports);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfSrcIpTagReport> findDfSrcIpTagReportPage(Page<DfSrcIpTagReport> page, DfSrcIpTagReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfSrcIpTagReport> dfSrcIpTagReports = dao.findDfSrcIpTagReportPage(entity);
|
||||
if (null != dfSrcIpTagReports && dfSrcIpTagReports.size() > 0) {
|
||||
for (DfSrcIpTagReport dfSrcIpTagReport : dfSrcIpTagReports) {
|
||||
if (null != dfSrcIpTagReport.getAsum() && dfSrcIpTagReport.getAsum() != 0) {
|
||||
dfSrcIpTagReport.setAbsum(dfSrcIpTagReport.getAsum());
|
||||
} else if ((null == dfSrcIpTagReport.getAsum() || dfSrcIpTagReport.getAsum() == 0)
|
||||
&& (null != dfSrcIpTagReport.getBsum() && dfSrcIpTagReport.getBsum() != 0)) {
|
||||
dfSrcIpTagReport.setAbsum(dfSrcIpTagReport.getBsum());
|
||||
} else {
|
||||
dfSrcIpTagReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(dfSrcIpTagReports);
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfLwhhAttrDaily;
|
||||
import com.nis.domain.restful.DfLwhhAttrMonth;
|
||||
import com.nis.domain.restful.DfLwhhTagDaily;
|
||||
import com.nis.domain.restful.DfLwhhTagMonth;
|
||||
import com.nis.domain.restful.DfSrcIpAttrDaily;
|
||||
import com.nis.domain.restful.DfSrcIpAttrMonth;
|
||||
import com.nis.domain.restful.DfSrcIpTagDaily;
|
||||
import com.nis.domain.restful.DfSrcIpTagMonth;
|
||||
import com.nis.web.dao.DfMultiDimensionalStatLogDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: DfMultiDimensionsReportService
|
||||
* @Description: TODO(df多维实时统计)
|
||||
* @author (DDM)
|
||||
* @date 2017年8月4日下午3:14:07
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DfMultiDimensionalStatLogService extends BaseLogService {
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DfMultiDimensionalStatLogDao dao;
|
||||
|
||||
public Page<DfLwhhAttrDaily> dfLwhhAttrDaily(Page<DfLwhhAttrDaily> page, DfLwhhAttrDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfLwhhAttrDaily(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DfLwhhAttrMonth> dfLwhhAttrMonth(Page<DfLwhhAttrMonth> page, DfLwhhAttrMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfLwhhAttrMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DfLwhhTagDaily> dfLwhhTagDaily(Page<DfLwhhTagDaily> page, DfLwhhTagDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfLwhhTagDaily(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DfLwhhTagMonth> dfLwhhTagMonth(Page<DfLwhhTagMonth> page, DfLwhhTagMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfLwhhTagMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DfSrcIpAttrDaily> dfSrcIpAttrDaily(Page<DfSrcIpAttrDaily> page, DfSrcIpAttrDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfSrcIpAttrDaily(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DfSrcIpAttrMonth> dfSrcIpAttrMonth(Page<DfSrcIpAttrMonth> page, DfSrcIpAttrMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfSrcIpAttrMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DfSrcIpTagDaily> dfSrcIpTagDaily(Page<DfSrcIpTagDaily> page, DfSrcIpTagDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfSrcIpTagDaily(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DfSrcIpTagMonth> dfSrcIpTagMonth(Page<DfSrcIpTagMonth> page, DfSrcIpTagMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfSrcIpTagMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
277
src/main/java/com/nis/web/service/restful/DfReportService.java
Normal file
277
src/main/java/com/nis/web/service/restful/DfReportService.java
Normal file
@@ -0,0 +1,277 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfAttrTypeReport;
|
||||
import com.nis.domain.restful.DfDestIpCountryReport;
|
||||
import com.nis.domain.restful.DfDestIpReport;
|
||||
import com.nis.domain.restful.DfEntranceReport;
|
||||
import com.nis.domain.restful.DfLwhhReport;
|
||||
import com.nis.domain.restful.DfPzReport;
|
||||
import com.nis.domain.restful.DfPzReportStat;
|
||||
import com.nis.domain.restful.DfServiceReport;
|
||||
import com.nis.domain.restful.DfSrcIpDomeSticReport;
|
||||
import com.nis.domain.restful.DfSrcIpReport;
|
||||
import com.nis.domain.restful.DfTagReport;
|
||||
import com.nis.web.dao.DfReportDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: DfReportService
|
||||
* @Description: TODO(一句话描述这个类)
|
||||
* @author (DDM)
|
||||
* @date 2016年10月31日上午11:54:46
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DfReportService extends BaseLogService {
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DfReportDao dao;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @Title: findDfPzReportPage
|
||||
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||
* @param @param
|
||||
* page
|
||||
* @param @param
|
||||
* entity
|
||||
* @param @return
|
||||
* @param @throws
|
||||
* SQLException
|
||||
* @return Map 返回类型
|
||||
* @author (DDM)
|
||||
* @version V1.0
|
||||
*/
|
||||
public Page<DfPzReport> findDfPzReportPage(Page<DfPzReport> page, DfPzReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfPzReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfAttrTypeReport> findAttrTypeReport(Page<DfAttrTypeReport> page, DfAttrTypeReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfAttrTypeReport> findAttrTypeReport = dao.findAttrTypeReport(entity);
|
||||
page.setList(findAttrTypeReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfSrcIpDomeSticReport> findSrcIpDomeSticReport(Page<DfSrcIpDomeSticReport> page,
|
||||
DfSrcIpDomeSticReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfSrcIpDomeSticReport> findSrcIpDomeSticReport = dao.findSrcIpDomeSticReport(entity);
|
||||
if (null != findSrcIpDomeSticReport && findSrcIpDomeSticReport.size() > 0) {
|
||||
for (DfSrcIpDomeSticReport dfSrcIpDomeSticReport : findSrcIpDomeSticReport) {
|
||||
if (null != dfSrcIpDomeSticReport.getAsum() && dfSrcIpDomeSticReport.getAsum() != 0) {
|
||||
dfSrcIpDomeSticReport.setAbsum(dfSrcIpDomeSticReport.getAsum());
|
||||
} else if ((null == dfSrcIpDomeSticReport.getAsum() || dfSrcIpDomeSticReport.getAsum() == 0)
|
||||
&& (null != dfSrcIpDomeSticReport.getBsum() && dfSrcIpDomeSticReport.getBsum() != 0)) {
|
||||
dfSrcIpDomeSticReport.setAbsum(dfSrcIpDomeSticReport.getBsum());
|
||||
} else {
|
||||
dfSrcIpDomeSticReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(findSrcIpDomeSticReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfDestIpCountryReport> findDestIpCountryReport(Page<DfDestIpCountryReport> page,
|
||||
DfDestIpCountryReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfDestIpCountryReport> destIpCountryReport = dao.findDestIpCountryReport(entity);
|
||||
if (null != destIpCountryReport && destIpCountryReport.size() > 0) {
|
||||
for (DfDestIpCountryReport dfDestIpCountryReport : destIpCountryReport) {
|
||||
if (null != dfDestIpCountryReport.getAsum() && dfDestIpCountryReport.getAsum() != 0) {
|
||||
dfDestIpCountryReport.setAbsum(dfDestIpCountryReport.getAsum());
|
||||
} else if ((null == dfDestIpCountryReport.getAsum() || dfDestIpCountryReport.getAsum() == 0)
|
||||
&& (null != dfDestIpCountryReport.getBsum() && dfDestIpCountryReport.getBsum() != 0)) {
|
||||
dfDestIpCountryReport.setAbsum(dfDestIpCountryReport.getBsum());
|
||||
} else {
|
||||
dfDestIpCountryReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(destIpCountryReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfEntranceReport> findDfEntranceReport(Page<DfEntranceReport> page, DfEntranceReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfEntranceReport> findDfEntranceReport = dao.findDfEntranceReport(entity);
|
||||
if (null != findDfEntranceReport && findDfEntranceReport.size() > 0) {
|
||||
for (DfEntranceReport dfEntranceReport : findDfEntranceReport) {
|
||||
if (null != dfEntranceReport.getAsum() && dfEntranceReport.getAsum() != 0) {
|
||||
dfEntranceReport.setAbsum(dfEntranceReport.getAsum());
|
||||
} else if ((null == dfEntranceReport.getAsum() || dfEntranceReport.getAsum() == 0)
|
||||
&& (null != dfEntranceReport.getBsum() && dfEntranceReport.getBsum() != 0)) {
|
||||
dfEntranceReport.setAbsum(dfEntranceReport.getBsum());
|
||||
} else {
|
||||
dfEntranceReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(findDfEntranceReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfLwhhReport> findDfLwhhReport(Page<DfLwhhReport> page, DfLwhhReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfLwhhReport> findDfLwhhReport = dao.findDfLwhhReport(entity);
|
||||
if (null != findDfLwhhReport && findDfLwhhReport.size() > 0) {
|
||||
for (DfLwhhReport dfLwhhReport : findDfLwhhReport) {
|
||||
if (null != dfLwhhReport.getAsum() && dfLwhhReport.getAsum() != 0) {
|
||||
dfLwhhReport.setAbsum(dfLwhhReport.getAsum());
|
||||
} else if ((null == dfLwhhReport.getAsum() || dfLwhhReport.getAsum() == 0)
|
||||
&& (null != dfLwhhReport.getBsum() && dfLwhhReport.getBsum() != 0)) {
|
||||
dfLwhhReport.setAbsum(dfLwhhReport.getBsum());
|
||||
} else {
|
||||
dfLwhhReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(findDfLwhhReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfTagReport> findDfTagReport(Page<DfTagReport> page, DfTagReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfTagReport> findDfTagReport = dao.findDfTagReport(entity);
|
||||
page.setList(findDfTagReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfPzReport> findDfPriTagReport(Page<DfPzReport> page, DfPzReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DfPzReport> findDfPzReport = dao.findDfPzReport(entity);
|
||||
if (null != findDfPzReport && findDfPzReport.size() > 0) {
|
||||
for (DfPzReport dfPzReport : findDfPzReport) {
|
||||
if (null != dfPzReport.getAsum() && dfPzReport.getAsum() != 0) {
|
||||
dfPzReport.setAbsum(dfPzReport.getAsum());
|
||||
} else if ((null == dfPzReport.getAsum() || dfPzReport.getAsum() == 0)
|
||||
&& (null != dfPzReport.getBsum() && dfPzReport.getBsum() != 0)) {
|
||||
dfPzReport.setAbsum(dfPzReport.getBsum());
|
||||
} else {
|
||||
dfPzReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(findDfPzReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DfPzReportStat> findDfPzReportStatPage(Page<DfPzReportStat> page, DfPzReportStat entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfPzReportStat(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DfPzReportStat> findDfPzReportStatMinutesPage(Page<DfPzReportStat> page, DfPzReportStat entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfPzReportStatMinutes(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Long findDfPzReportSumStat(Page<DfPzReportStat> page, DfPzReportStat entity) throws SQLException {
|
||||
return dao.findDfPzReportSum(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Title: findDfSrcIpReport
|
||||
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||
* @param @param
|
||||
* page
|
||||
* @param @param
|
||||
* entity
|
||||
* @param @return
|
||||
* @param @throws
|
||||
* SQLException
|
||||
* @return Map 返回类型
|
||||
* @author (DDM)
|
||||
* @version V1.0
|
||||
*/
|
||||
public Page<DfSrcIpReport> findDfSrcIpReport(Page<DfSrcIpReport> page, DfSrcIpReport entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfSrcIpReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Title: findDfDestIpReport
|
||||
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||
* @param @param
|
||||
* page
|
||||
* @param @param
|
||||
* entity
|
||||
* @param @return
|
||||
* @param @throws
|
||||
* SQLException
|
||||
* @return Map 返回类型
|
||||
* @author (DDM)
|
||||
* @version V1.0
|
||||
*/
|
||||
public Page<DfDestIpReport> findDfDestIpReport(Page<DfDestIpReport> page, DfDestIpReport entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfDestIpReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @Title: findDfServiceReportPage
|
||||
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||
* @param @param
|
||||
* page
|
||||
* @param @param
|
||||
* entity
|
||||
* @param @return
|
||||
* @param @throws
|
||||
* SQLException
|
||||
* @return Map 返回类型
|
||||
* @author (DDM)
|
||||
* @version V1.0
|
||||
*/
|
||||
public Page<DfServiceReport> findDfServiceReportPage(Page<DfServiceReport> page, DfServiceReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfServiceReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Title: findDfTagReportPage
|
||||
* @Description: TODO(这里用一句话描述这个方法的作用)
|
||||
* @param @param
|
||||
* page
|
||||
* @param @param
|
||||
* entity
|
||||
* @param @return
|
||||
* @param @throws
|
||||
* SQLException
|
||||
* @return Map 返回类型
|
||||
* @author (DDM)
|
||||
* @version V1.0
|
||||
*/
|
||||
public Page<DfTagReport> findDfTagReportPage(Page<DfTagReport> page, DfTagReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
|
||||
List<DfTagReport> findDfTagReportPage = dao.findDfTagReportPage(entity);
|
||||
page.setList(findDfTagReportPage);
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
203
src/main/java/com/nis/web/service/restful/DfStatLogService.java
Normal file
203
src/main/java/com/nis/web/service/restful/DfStatLogService.java
Normal file
@@ -0,0 +1,203 @@
|
||||
/**
|
||||
* @Title: DfStatLogService.java
|
||||
* @Package com.nis.web.service.restful
|
||||
* @Description: TODO(用一句话描述该文件做什么)
|
||||
* @author (ddm)
|
||||
* @date 2016年9月13日 上午11:50:12
|
||||
* @version V1.0
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfAttrStatLogDaily;
|
||||
import com.nis.domain.restful.DfAttrStatLogMonth;
|
||||
import com.nis.domain.restful.DfDestIpCounrtyStatLogDaily;
|
||||
import com.nis.domain.restful.DfDestIpCounrtyStatLogMonth;
|
||||
import com.nis.domain.restful.DfEntrStatLogDaily;
|
||||
import com.nis.domain.restful.DfEntrStatLogMonth;
|
||||
import com.nis.domain.restful.DfLwhhStatLogDaily;
|
||||
import com.nis.domain.restful.DfLwhhStatLogMonth;
|
||||
import com.nis.domain.restful.DfSrcIpDomesticStatLogDaily;
|
||||
import com.nis.domain.restful.DfSrcIpDomesticStatLogMonth;
|
||||
import com.nis.domain.restful.DfStatLogDaily;
|
||||
import com.nis.domain.restful.DfStatLogMonth;
|
||||
import com.nis.domain.restful.DfTagStatLogDaily;
|
||||
import com.nis.domain.restful.DfTagStatLogMonth;
|
||||
import com.nis.web.dao.DfStatLogDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
* @ClassName: DfStatLogService
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @author (ddm)
|
||||
* @date 2016年9月13日 上午11:50:12
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DfStatLogService extends BaseLogService{
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DfStatLogDao dao;
|
||||
|
||||
/**
|
||||
* 查询端口封堵分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfStatLogDaily> dfStatLogDaily(Page<DfStatLogDaily> page, DfStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询端口封堵分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfStatLogMonth> dfStatLogMonth(Page<DfStatLogMonth> page, DfStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询标签日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfTagStatLogDaily> dfTagStatLogDaily(Page<DfTagStatLogDaily> page, DfTagStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfTagStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询标签月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfTagStatLogMonth> dfTagStatLogMonth(Page<DfTagStatLogMonth> page, DfTagStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfTagStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询性质日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfAttrStatLogDaily> dfAttrStatLogDaily(Page<DfAttrStatLogDaily> page, DfAttrStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfAttrStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询性质月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfAttrStatLogMonth> dfAttrStatLogMonth(Page<DfAttrStatLogMonth> page, DfAttrStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfAttrStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询局点日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfEntrStatLogDaily> dfEntrStatLogDaily(Page<DfEntrStatLogDaily> page, DfEntrStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfEntrStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询局点月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfEntrStatLogMonth> dfEntrStatLogMonth(Page<DfEntrStatLogMonth> page, DfEntrStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfEntrStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询来文函号日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfLwhhStatLogDaily> dfLwhhStatLogDaily(Page<DfLwhhStatLogDaily> page, DfLwhhStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfLwhhStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询来文函号月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfLwhhStatLogMonth> dfLwhhStatLogMonth(Page<DfLwhhStatLogMonth> page, DfLwhhStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfLwhhStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询境内源ip日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfSrcIpDomesticStatLogDaily> dfSrcIpDomesticStatLogDaily(Page<DfSrcIpDomesticStatLogDaily> page, DfSrcIpDomesticStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfSrcIpDomesticStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询境内源ip月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfSrcIpDomesticStatLogMonth> dfSrcIpDomesticStatLogMonth(Page<DfSrcIpDomesticStatLogMonth> page, DfSrcIpDomesticStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfSrcIpDomesticStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询国家目的ip日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfDestIpCounrtyStatLogDaily> dfDestIpCounrtyStatLogDaily(Page<DfDestIpCounrtyStatLogDaily> page, DfDestIpCounrtyStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfDestIpCounrtyStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询国家目的ip月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DfDestIpCounrtyStatLogMonth> dfDestIpCounrtyStatLogMonth(Page<DfDestIpCounrtyStatLogMonth> page, DfDestIpCounrtyStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.dfDestIpCounrtyStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.StatLogEntity;
|
||||
import com.nis.domain.restful.DfDjLogStatistics;
|
||||
import com.nis.domain.restful.DfDjPzLogStatistics;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.DfDjLogStatDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* @ClassName: DfdjLogStatService
|
||||
* @Description: 封堵/监测日志统计查询
|
||||
* @author (zbc)
|
||||
* @date 2016年11月14日 下午4:00:00
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public class DfdjLogStatService extends BaseLogService {
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Autowired
|
||||
protected DfDjLogStatDao dao;
|
||||
|
||||
|
||||
public DfDjLogStatistics findDfLogStatistics(DfDjLogStatistics entity) {
|
||||
List<DfDjLogStatistics> list = dao.findDfLogStatistics(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public Page<DfDjPzLogStatistics> findDfPzLogStatistics(Page<DfDjPzLogStatistics> page, DfDjPzLogStatistics entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDfPzLogStatistics(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public DfDjLogStatistics findDjLogStatistics(DfDjLogStatistics entity) {
|
||||
List<DfDjLogStatistics> list = dao.findDjLogStatistics(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public Page<DfDjPzLogStatistics> findDjPzLogStatistics(Page<DfDjPzLogStatistics> page, DfDjPzLogStatistics entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDjPzLogStatistics(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void queryConditionCheck(SaveRequestLogThread thread, long start, StatLogEntity entity, Class clazz, Page page) {
|
||||
/*
|
||||
* searchConfigId为多条件格式
|
||||
*/
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchStatStartTime())) {
|
||||
sdf.parse(entity.getSearchStatStartTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatStartTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatStartTime参数格式错误");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchStatEndTime())) {
|
||||
sdf.parse(entity.getSearchStatEndTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatEndTime参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchStatEndTime参数错误");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getSearchService())) {
|
||||
Integer.parseInt(entity.getSearchService());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数错误");
|
||||
}
|
||||
|
||||
try {
|
||||
checkCloumnIsExist(thread,start,clazz, page);
|
||||
} catch (RestServiceException e) {
|
||||
logger.error(e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DjCkStatLog;
|
||||
import com.nis.domain.restful.DjJitAffairDestReport;
|
||||
import com.nis.domain.restful.DjJitAffairSrcReport;
|
||||
import com.nis.domain.restful.DjJitFlDestReport;
|
||||
import com.nis.domain.restful.DjJitFlSrcReport;
|
||||
import com.nis.domain.restful.DjJitGuaranteeDestReport;
|
||||
import com.nis.domain.restful.DjJitGuaranteeSrcReport;
|
||||
import com.nis.domain.restful.DjJitIdDestReport;
|
||||
import com.nis.domain.restful.DjJitIdSrcReport;
|
||||
import com.nis.domain.restful.DjJitMissionDestReport;
|
||||
import com.nis.domain.restful.DjJitMissionSrcReport;
|
||||
import com.nis.domain.restful.DjJitTagDestReport;
|
||||
import com.nis.domain.restful.DjJitTagSrcReport;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.DjJitLogSearchDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
@Service
|
||||
public class DjJitLogSearchService extends BaseLogService {
|
||||
|
||||
@Autowired
|
||||
private DjJitLogSearchDao djJitLogSearchDao;
|
||||
|
||||
public Page<DjJitFlSrcReport> findDjJitFlSrcReport(Page<DjJitFlSrcReport> page, DjJitFlSrcReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitFlSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitFlDestReport> findDjJitFlDestReport(Page<DjJitFlDestReport> page, DjJitFlDestReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitFlDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitAffairSrcReport> findDjJitAffairSrcReport(Page<DjJitAffairSrcReport> page,
|
||||
DjJitAffairSrcReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitAffairSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitAffairDestReport> findDjJitAffairDestReport(Page<DjJitAffairDestReport> page,
|
||||
DjJitAffairDestReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitAffairDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitMissionSrcReport> findDjJitMissionSrcReport(Page<DjJitMissionSrcReport> page,
|
||||
DjJitMissionSrcReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitMissionSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitMissionDestReport> findDjJitMissionDestReport(Page<DjJitMissionDestReport> page,
|
||||
DjJitMissionDestReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitMissionDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitGuaranteeSrcReport> findDjJitGuaranteeSrcReport(Page<DjJitGuaranteeSrcReport> page,
|
||||
DjJitGuaranteeSrcReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitGuaranteeSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitGuaranteeDestReport> findDjJitGuaranteeDestReport(Page<DjJitGuaranteeDestReport> page,
|
||||
DjJitGuaranteeDestReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitGuaranteeDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitTagSrcReport> findDjJitTagSrcReport(Page<DjJitTagSrcReport> page, DjJitTagSrcReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitTagSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitTagDestReport> findDjJitTagDestReport(Page<DjJitTagDestReport> page, DjJitTagDestReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitTagDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitIdSrcReport> findDjJitIdSrcReport(Page<DjJitIdSrcReport> page, DjJitIdSrcReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitIdSrcReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjJitIdDestReport> findDjJitIdDestReport(Page<DjJitIdDestReport> page, DjJitIdDestReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjJitIdDestReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjCkStatLog> findDjCkStatLog(Page<DjCkStatLog> page, DjCkStatLog entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(djJitLogSearchDao.findDjCkStatLog(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public void queryDjJitFlCheck(SaveRequestLogThread thread,long start,String searchFl, String searchXz) {
|
||||
try {
|
||||
if (!StringUtil.isBlank(searchFl)) {
|
||||
Integer.parseInt(searchFl);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"searchFl参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"searchFl参数错误");
|
||||
}
|
||||
try {
|
||||
if (!StringUtil.isBlank(searchXz)) {
|
||||
Integer.parseInt(searchXz);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"searchXz参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"searchXz参数错误");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
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<DjIpPortLog> findIpPortPage(Page<DjIpPortLog> page, DjIpPortLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjIpPortLog> 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<DjHttpResLog> findHttpResPage(Page<DjHttpResLog> page, DjHttpResLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjHttpResLog> 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<DjHttpReqLog> findHttpReqPage(Page<DjHttpReqLog> page, DjHttpReqLog httpReqLog,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
httpReqLog.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjHttpReqLog> 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<DjHttpKeywordLog> findHttpKeywordPage(Page<DjHttpKeywordLog> page, DjHttpKeywordLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjHttpKeywordLog> 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<DjHttpKeywordLog> findHttpMultiPartPage(Page<DjHttpKeywordLog> page, DjHttpKeywordLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjHttpKeywordLog> 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<DjMailLog> findMailPage(Page<DjMailLog> page, DjMailLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjMailLog> 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<DjDnsLog> findDnsPage(Page<DjDnsLog> page, DjDnsLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjDnsLog> 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<DjFtpLog> findFtpPage(Page<DjFtpLog> page, DjFtpLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjFtpLog> 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<DjPptpLog> findPptpPage(Page<DjPptpLog> page, DjPptpLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjPptpLog> 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<DjL2tpLog> findL2tpPage(Page<DjL2tpLog> page, DjL2tpLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjL2tpLog> 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<DjIpsecLog> findIpsecPage(Page<DjIpsecLog> page, DjIpsecLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjIpsecLog> 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<DjOpenvpnLog> findOpenvpnPage(Page<DjOpenvpnLog> page, DjOpenvpnLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjOpenvpnLog> 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<DjSshLog> findSshPage(Page<DjSshLog> page, DjSshLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjSshLog> 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<DjSslLog> findSslPage(Page<DjSslLog> page, DjSslLog entity,String activeSys) throws IllegalArgumentException, IllegalAccessException, ClientProtocolException, ParseException, JSONException, IOException {
|
||||
entity.setPage(page);
|
||||
if(Constants.IS_USE_ES){
|
||||
List<DjSslLog> resultList=new ArrayList<>();
|
||||
elasticsearchSqlDao.findLogs(resultList, entity,activeSys);
|
||||
page.setList(resultList);
|
||||
}else{
|
||||
page.setList(dao.findSslLogs(entity));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DjLwhhAttrReport;
|
||||
import com.nis.domain.restful.DjLwhhReport;
|
||||
import com.nis.domain.restful.DjLwhhTagReport;
|
||||
import com.nis.domain.restful.DjSrcIpAttrReport;
|
||||
import com.nis.domain.restful.DjSrcIpTagReport;
|
||||
import com.nis.web.dao.DjMultiDimensionalReportDao;
|
||||
import com.nis.web.dao.DjReportDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: DjMultiDimensionsReportService
|
||||
* @Description: TODO(dj多维实时统计)
|
||||
* @author (DDM)
|
||||
* @date 2017年8月4日下午3:14:07
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjMultiDimensionalReportService extends BaseLogService {
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DjMultiDimensionalReportDao dao;
|
||||
|
||||
|
||||
public Page<DjLwhhAttrReport> findDjLwhhAttrReportPage(Page<DjLwhhAttrReport> page, DjLwhhAttrReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjLwhhAttrReport> djLwhhAttrReports = dao.findDjLwhhAttrReport(entity);
|
||||
if (null != djLwhhAttrReports && djLwhhAttrReports.size() > 0) {
|
||||
for (DjLwhhAttrReport djLwhhAttrReport : djLwhhAttrReports) {
|
||||
if (null != djLwhhAttrReport.getAsum() && djLwhhAttrReport.getAsum() != 0) {
|
||||
djLwhhAttrReport.setAbsum(djLwhhAttrReport.getAsum());
|
||||
} else if ((null == djLwhhAttrReport.getAsum() || djLwhhAttrReport.getAsum() == 0)
|
||||
&& (null != djLwhhAttrReport.getBsum() && djLwhhAttrReport.getBsum() != 0)) {
|
||||
djLwhhAttrReport.setAbsum(djLwhhAttrReport.getBsum());
|
||||
} else {
|
||||
djLwhhAttrReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(djLwhhAttrReports);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjLwhhTagReport> findDjLwhhTagReportPage(Page<DjLwhhTagReport> page, DjLwhhTagReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjLwhhTagReport> djLwhhTagReports = dao.findDjLwhhTagReportPage(entity);
|
||||
if (null != djLwhhTagReports && djLwhhTagReports.size() > 0) {
|
||||
for (DjLwhhTagReport djLwhhTagReport : djLwhhTagReports) {
|
||||
if (null != djLwhhTagReport.getAsum() && djLwhhTagReport.getAsum() != 0) {
|
||||
djLwhhTagReport.setAbsum(djLwhhTagReport.getAsum());
|
||||
} else if ((null == djLwhhTagReport.getAsum() || djLwhhTagReport.getAsum() == 0)
|
||||
&& (null != djLwhhTagReport.getBsum() && djLwhhTagReport.getBsum() != 0)) {
|
||||
djLwhhTagReport.setAbsum(djLwhhTagReport.getBsum());
|
||||
} else {
|
||||
djLwhhTagReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(djLwhhTagReports);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjSrcIpAttrReport> findDjSrcIpAttrReportPage(Page<DjSrcIpAttrReport> page, DjSrcIpAttrReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjSrcIpAttrReport> djSrcIpAttrReports = dao.findDjSrcIpAttrReportPage(entity);
|
||||
if (null != djSrcIpAttrReports && djSrcIpAttrReports.size() > 0) {
|
||||
for (DjSrcIpAttrReport djSrcIpAttrReport : djSrcIpAttrReports) {
|
||||
if (null != djSrcIpAttrReport.getAsum() && djSrcIpAttrReport.getAsum() != 0) {
|
||||
djSrcIpAttrReport.setAbsum(djSrcIpAttrReport.getAsum());
|
||||
} else if ((null == djSrcIpAttrReport.getAsum() || djSrcIpAttrReport.getAsum() == 0)
|
||||
&& (null != djSrcIpAttrReport.getBsum() && djSrcIpAttrReport.getBsum() != 0)) {
|
||||
djSrcIpAttrReport.setAbsum(djSrcIpAttrReport.getBsum());
|
||||
} else {
|
||||
djSrcIpAttrReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(djSrcIpAttrReports);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjSrcIpTagReport> findDjSrcIpTagReportPage(Page<DjSrcIpTagReport> page, DjSrcIpTagReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjSrcIpTagReport> djSrcIpTagReports = dao.findDjSrcIpTagReportPage(entity);
|
||||
if (null != djSrcIpTagReports && djSrcIpTagReports.size() > 0) {
|
||||
for (DjSrcIpTagReport djSrcIpTagReport : djSrcIpTagReports) {
|
||||
if (null != djSrcIpTagReport.getAsum() && djSrcIpTagReport.getAsum() != 0) {
|
||||
djSrcIpTagReport.setAbsum(djSrcIpTagReport.getAsum());
|
||||
} else if ((null == djSrcIpTagReport.getAsum() || djSrcIpTagReport.getAsum() == 0)
|
||||
&& (null != djSrcIpTagReport.getBsum() && djSrcIpTagReport.getBsum() != 0)) {
|
||||
djSrcIpTagReport.setAbsum(djSrcIpTagReport.getBsum());
|
||||
} else {
|
||||
djSrcIpTagReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(djSrcIpTagReports);
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DjLwhhAttrDaily;
|
||||
import com.nis.domain.restful.DjLwhhAttrMonth;
|
||||
import com.nis.domain.restful.DjLwhhTagDaily;
|
||||
import com.nis.domain.restful.DjLwhhTagMonth;
|
||||
import com.nis.domain.restful.DjSrcIpAttrDaily;
|
||||
import com.nis.domain.restful.DjSrcIpAttrMonth;
|
||||
import com.nis.domain.restful.DjSrcIpTagDaily;
|
||||
import com.nis.domain.restful.DjSrcIpTagMonth;
|
||||
import com.nis.web.dao.DjMultiDimensionalStatLogDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: DjMultiDimensionsReportService
|
||||
* @Description: TODO(dj多维实时统计)
|
||||
* @author (DDM)
|
||||
* @date 2017年8月4日下午3:14:07
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjMultiDimensionalStatLogService extends BaseLogService {
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DjMultiDimensionalStatLogDao dao;
|
||||
|
||||
public Page<DjLwhhAttrDaily> djLwhhAttrDaily(Page<DjLwhhAttrDaily> page, DjLwhhAttrDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djLwhhAttrDaily(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DjLwhhAttrMonth> djLwhhAttrMonth(Page<DjLwhhAttrMonth> page, DjLwhhAttrMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djLwhhAttrMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DjLwhhTagDaily> djLwhhTagDaily(Page<DjLwhhTagDaily> page, DjLwhhTagDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djLwhhTagDaily(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DjLwhhTagMonth> djLwhhTagMonth(Page<DjLwhhTagMonth> page, DjLwhhTagMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djLwhhTagMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DjSrcIpAttrDaily> djSrcIpAttrDaily(Page<DjSrcIpAttrDaily> page, DjSrcIpAttrDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djSrcIpAttrDaily(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DjSrcIpAttrMonth> djSrcIpAttrMonth(Page<DjSrcIpAttrMonth> page, DjSrcIpAttrMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djSrcIpAttrMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DjSrcIpTagDaily> djSrcIpTagDaily(Page<DjSrcIpTagDaily> page, DjSrcIpTagDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djSrcIpTagDaily(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DjSrcIpTagMonth> djSrcIpTagMonth(Page<DjSrcIpTagMonth> page, DjSrcIpTagMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djSrcIpTagMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
186
src/main/java/com/nis/web/service/restful/DjReportService.java
Normal file
186
src/main/java/com/nis/web/service/restful/DjReportService.java
Normal file
@@ -0,0 +1,186 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DjPzReportStat;
|
||||
import com.nis.domain.restful.DjAttrTypeReport;
|
||||
import com.nis.domain.restful.DjDestIpCountryReport;
|
||||
import com.nis.domain.restful.DjEntranceReport;
|
||||
import com.nis.domain.restful.DjLwhhReport;
|
||||
import com.nis.domain.restful.DjSrcIpDomeSticReport;
|
||||
import com.nis.domain.restful.DjTagReport;
|
||||
import com.nis.domain.restful.DjPzReport;
|
||||
import com.nis.web.dao.DjReportDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: DjReportService
|
||||
* @Description: TODO(一句话描述这个类)
|
||||
* @author (ZBC)
|
||||
* @date 2016年11月22日下午06:00:00
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjReportService extends BaseLogService {
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DjReportDao dao;
|
||||
|
||||
/**
|
||||
* @Title: findDjPzReportPage
|
||||
* @param page
|
||||
* @param djPzReport
|
||||
* @return
|
||||
*/
|
||||
public Page<DjPzReport> findDjPzReportPage(Page<DjPzReport> page, DjPzReport entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDjPzReport(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjPzReportStat> findDjPzReportStatPage(Page<DjPzReportStat> page, DjPzReportStat entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDjPzReportStat(entity));
|
||||
return page;
|
||||
}
|
||||
public Page<DjPzReportStat> findDjPzReportStatMinutesPage(Page<DjPzReportStat> page, DjPzReportStat entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findDjPzReportStatMinutes(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjPzReport> findDjPzPrivPage(Page<DjPzReport> page, DjPzReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjPzReport> findDjPzPrivPage = dao.findDjPzPrivPage(entity);
|
||||
if (null != findDjPzPrivPage && findDjPzPrivPage.size() > 0) {
|
||||
for (DjPzReport djPzReport : findDjPzPrivPage) {
|
||||
if (null != djPzReport.getAsum() && djPzReport.getAsum() != 0) {
|
||||
djPzReport.setAbsum(djPzReport.getAsum());
|
||||
} else if ((null == djPzReport.getAsum() || djPzReport.getAsum() == 0)
|
||||
&& (null != djPzReport.getBsum() && djPzReport.getBsum() != 0)) {
|
||||
djPzReport.setAbsum(djPzReport.getBsum());
|
||||
} else {
|
||||
djPzReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(findDjPzPrivPage);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Long findDjPzReportSumStat(Page<DjPzReportStat> page, DjPzReportStat entity) throws SQLException {
|
||||
return dao.findDjPzReportSum(entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Page<DjAttrTypeReport> findAttrTypeReport(Page<DjAttrTypeReport> page, DjAttrTypeReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjAttrTypeReport> findAttrTypeReport = dao.findAttrTypeReport(entity);
|
||||
page.setList(findAttrTypeReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DjSrcIpDomeSticReport> findSrcIpDomeSticReport(Page<DjSrcIpDomeSticReport> page,
|
||||
DjSrcIpDomeSticReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjSrcIpDomeSticReport> findSrcIpDomeSticReport = dao.findSrcIpDomeSticReport(entity);
|
||||
if (null != findSrcIpDomeSticReport && findSrcIpDomeSticReport.size() > 0) {
|
||||
for (DjSrcIpDomeSticReport djSrcIpDomeSticReport : findSrcIpDomeSticReport) {
|
||||
if (null != djSrcIpDomeSticReport.getAsum() && djSrcIpDomeSticReport.getAsum() != 0) {
|
||||
djSrcIpDomeSticReport.setAbsum(djSrcIpDomeSticReport.getAsum());
|
||||
} else if ((null == djSrcIpDomeSticReport.getAsum() || djSrcIpDomeSticReport.getAsum() == 0)
|
||||
&& (null != djSrcIpDomeSticReport.getBsum() && djSrcIpDomeSticReport.getBsum() != 0)) {
|
||||
djSrcIpDomeSticReport.setAbsum(djSrcIpDomeSticReport.getBsum());
|
||||
} else {
|
||||
djSrcIpDomeSticReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(findSrcIpDomeSticReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public Page<DjDestIpCountryReport> findDestIpCountryReport(Page<DjDestIpCountryReport> page,
|
||||
DjDestIpCountryReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjDestIpCountryReport> destIpCountryReport = dao.findDestIpCountryReport(entity);
|
||||
if (null != destIpCountryReport && destIpCountryReport.size() > 0) {
|
||||
for (DjDestIpCountryReport djDestIpCountryReport : destIpCountryReport) {
|
||||
if (null != djDestIpCountryReport.getAsum() && djDestIpCountryReport.getAsum() != 0) {
|
||||
djDestIpCountryReport.setAbsum(djDestIpCountryReport.getAsum());
|
||||
} else if ((null == djDestIpCountryReport.getAsum() || djDestIpCountryReport.getAsum() == 0)
|
||||
&& (null != djDestIpCountryReport.getBsum() && djDestIpCountryReport.getBsum() != 0)) {
|
||||
djDestIpCountryReport.setAbsum(djDestIpCountryReport.getBsum());
|
||||
} else {
|
||||
djDestIpCountryReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(destIpCountryReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjEntranceReport> findDjEntranceReport(Page<DjEntranceReport> page, DjEntranceReport entity)
|
||||
throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjEntranceReport> findDjEntranceReport = dao.findDjEntranceReport(entity);
|
||||
if (null != findDjEntranceReport && findDjEntranceReport.size() > 0) {
|
||||
for (DjEntranceReport djEntranceReport : findDjEntranceReport) {
|
||||
if (null != djEntranceReport.getAsum() && djEntranceReport.getAsum() != 0) {
|
||||
djEntranceReport.setAbsum(djEntranceReport.getAsum());
|
||||
} else if ((null == djEntranceReport.getAsum() || djEntranceReport.getAsum() == 0)
|
||||
&& (null != djEntranceReport.getBsum() && djEntranceReport.getBsum() != 0)) {
|
||||
djEntranceReport.setAbsum(djEntranceReport.getBsum());
|
||||
} else {
|
||||
djEntranceReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(findDjEntranceReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjLwhhReport> findDjLwhhReport(Page<DjLwhhReport> page, DjLwhhReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
List<DjLwhhReport> findDjLwhhReport = dao.findDjLwhhReport(entity);
|
||||
if (null != findDjLwhhReport && findDjLwhhReport.size() > 0) {
|
||||
for (DjLwhhReport djLwhhReport : findDjLwhhReport) {
|
||||
if (null != djLwhhReport.getAsum() && djLwhhReport.getAsum() != 0) {
|
||||
djLwhhReport.setAbsum(djLwhhReport.getAsum());
|
||||
} else if ((null == djLwhhReport.getAsum() || djLwhhReport.getAsum() == 0)
|
||||
&& (null != djLwhhReport.getBsum() && djLwhhReport.getBsum() != 0)) {
|
||||
djLwhhReport.setAbsum(djLwhhReport.getBsum());
|
||||
} else {
|
||||
djLwhhReport.setAbsum(0l);
|
||||
}
|
||||
}
|
||||
}
|
||||
page.setList(findDjLwhhReport);
|
||||
return page;
|
||||
}
|
||||
|
||||
public Page<DjTagReport> findDjTagReportPage(Page<DjTagReport> page, DjTagReport entity) throws SQLException {
|
||||
entity.setPage(page);
|
||||
|
||||
List<DjTagReport> findDjTagReportPage = dao.findDjTagReportPage(entity);
|
||||
page.setList(findDjTagReportPage);
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
203
src/main/java/com/nis/web/service/restful/DjStatLogService.java
Normal file
203
src/main/java/com/nis/web/service/restful/DjStatLogService.java
Normal file
@@ -0,0 +1,203 @@
|
||||
/**
|
||||
* @Title: DjStatLogService.java
|
||||
* @Package com.nis.web.service.restful
|
||||
* @Description: TODO(用一句话描述该文件做什么)
|
||||
* @author (ddm)
|
||||
* @date 2016年9月13日 上午11:50:12
|
||||
* @version V1.0
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DjAttrStatLogDaily;
|
||||
import com.nis.domain.restful.DjAttrStatLogMonth;
|
||||
import com.nis.domain.restful.DjDestIpCounrtyStatLogDaily;
|
||||
import com.nis.domain.restful.DjDestIpCounrtyStatLogMonth;
|
||||
import com.nis.domain.restful.DjEntrStatLogDaily;
|
||||
import com.nis.domain.restful.DjEntrStatLogMonth;
|
||||
import com.nis.domain.restful.DjLwhhStatLogDaily;
|
||||
import com.nis.domain.restful.DjLwhhStatLogMonth;
|
||||
import com.nis.domain.restful.DjSrcIpDomesticStatLogDaily;
|
||||
import com.nis.domain.restful.DjSrcIpDomesticStatLogMonth;
|
||||
import com.nis.domain.restful.DjStatLogDaily;
|
||||
import com.nis.domain.restful.DjStatLogMonth;
|
||||
import com.nis.domain.restful.DjTagStatLogDaily;
|
||||
import com.nis.domain.restful.DjTagStatLogMonth;
|
||||
import com.nis.web.dao.DjStatLogDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
|
||||
/**
|
||||
* @ClassName: DjStatLogService
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @author (ddm)
|
||||
* @date 2016年9月13日 上午11:50:12
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DjStatLogService extends BaseLogService{
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected DjStatLogDao dao;
|
||||
|
||||
/**
|
||||
* 查询端口封堵分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjStatLogDaily> djStatLogDaily(Page<DjStatLogDaily> page, DjStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询端口封堵分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjStatLogMonth> djStatLogMonth(Page<DjStatLogMonth> page, DjStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询标签日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjTagStatLogDaily> djTagStatLogDaily(Page<DjTagStatLogDaily> page, DjTagStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djTagStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询标签月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjTagStatLogMonth> djTagStatLogMonth(Page<DjTagStatLogMonth> page, DjTagStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djTagStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询性质日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjAttrStatLogDaily> djAttrStatLogDaily(Page<DjAttrStatLogDaily> page, DjAttrStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djAttrStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询性质月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjAttrStatLogMonth> djAttrStatLogMonth(Page<DjAttrStatLogMonth> page, DjAttrStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djAttrStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询局点日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjEntrStatLogDaily> djEntrStatLogDaily(Page<DjEntrStatLogDaily> page, DjEntrStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djEntrStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询局点月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjEntrStatLogMonth> djEntrStatLogMonth(Page<DjEntrStatLogMonth> page, DjEntrStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djEntrStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询来文函号日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjLwhhStatLogDaily> djLwhhStatLogDaily(Page<DjLwhhStatLogDaily> page, DjLwhhStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djLwhhStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询来文函号月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjLwhhStatLogMonth> djLwhhStatLogMonth(Page<DjLwhhStatLogMonth> page, DjLwhhStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djLwhhStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询境内源ip日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjSrcIpDomesticStatLogDaily> djSrcIpDomesticStatLogDaily(Page<DjSrcIpDomesticStatLogDaily> page, DjSrcIpDomesticStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djSrcIpDomesticStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询境内源ip月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjSrcIpDomesticStatLogMonth> djSrcIpDomesticStatLogMonth(Page<DjSrcIpDomesticStatLogMonth> page, DjSrcIpDomesticStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djSrcIpDomesticStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询国家目的ip日报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjDestIpCounrtyStatLogDaily> djDestIpCounrtyStatLogDaily(Page<DjDestIpCounrtyStatLogDaily> page, DjDestIpCounrtyStatLogDaily entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djDestIpCounrtyStatLogDaily(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 查询国家目的ip月报表
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjDestIpCounrtyStatLogMonth> djDestIpCounrtyStatLogMonth(Page<DjDestIpCounrtyStatLogMonth> page, DjDestIpCounrtyStatLogMonth entity) throws SQLException{
|
||||
entity.setPage(page);
|
||||
page.setList(dao.djDestIpCounrtyStatLogMonth(entity));
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
53
src/main/java/com/nis/web/service/restful/DmbCkService.java
Normal file
53
src/main/java/com/nis/web/service/restful/DmbCkService.java
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
*@Title: DmbCkService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DmbCk;
|
||||
import com.nis.web.dao.DmbCkDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: DmbCkService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DmbCkService extends CrudService<DmbCkDao, DmbCk> {
|
||||
@Autowired
|
||||
public DmbCkDao dmbCkDao;
|
||||
public Page<DmbCk> getDmbCk(Page<DmbCk> page, DmbCk entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public DmbCk findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveDmbCkBatch(List<DmbCk> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,DmbCkDao.class);
|
||||
}
|
||||
public void updateDmbCkBatch(List<DmbCk> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, DmbCkDao.class);
|
||||
}
|
||||
public void removeDmbCk(long id) {
|
||||
dmbCkDao.delete(id);
|
||||
}
|
||||
public void removeDmbCkBatch(List<DmbCk> entity) {
|
||||
super.deleteBatch(entity, DmbCkDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
*@Title: DmbPortService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DmbPort;
|
||||
import com.nis.web.dao.DmbPortDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: DmbPortService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DmbPortService extends CrudService<DmbPortDao, DmbPort> {
|
||||
@Autowired
|
||||
public DmbPortDao dmbPortDao;
|
||||
public Page<DmbPort> getDmbPort(Page<DmbPort> page, DmbPort entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public DmbPort findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveDmbPortBatch(List<DmbPort> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,DmbPortDao.class);
|
||||
}
|
||||
public void updateDmbPortBatch(List<DmbPort> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, DmbPortDao.class);
|
||||
}
|
||||
public void removeDmbPort(long id) {
|
||||
dmbPortDao.delete(id);
|
||||
}
|
||||
public void removeDmbPortBatch(List<DmbPort> entity) {
|
||||
super.deleteBatch(entity, DmbPortDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
*@Title: DnsFakeInfoService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DnsFakeInfo;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.DnsFakeInfoDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: DnsFakeInfoService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DnsFakeInfoService extends CrudService<DnsFakeInfoDao, DnsFakeInfo> {
|
||||
@Autowired
|
||||
public DnsFakeInfoDao dnsFakeInfoDao;
|
||||
public Page<DnsFakeInfo> getDnsFakeInfo(Page<DnsFakeInfo> page, DnsFakeInfo entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public DnsFakeInfo findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveDnsFakeInfoBatch(List<DnsFakeInfo> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,DnsFakeInfoDao.class);
|
||||
}
|
||||
public void updateDnsFakeInfoBatch(List<DnsFakeInfo> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, DnsFakeInfoDao.class);
|
||||
}
|
||||
public void removeDnsFakeInfo(long id) {
|
||||
dnsFakeInfoDao.delete(id);
|
||||
}
|
||||
public void removeDnsFakeInfoBatch(List<DnsFakeInfo> entity) {
|
||||
super.deleteBatch(entity, DnsFakeInfoDao.class);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isValid(单条有效验证)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param id
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean isValid(long id){
|
||||
return dnsFakeInfoDao.isValid(id)==Integer.parseInt(Constants.YES);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isValid(多条有效验证)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean isValid(List<DnsFakeInfo> entity){
|
||||
boolean vaild=false;
|
||||
List<Long> idsList=new ArrayList<Long>();
|
||||
for(DnsFakeInfo DnsFakeInfo : entity){
|
||||
idsList.add(DnsFakeInfo.getId());
|
||||
if(idsList.size()%1000==0&&idsList.size()!=0){
|
||||
int count=dnsFakeInfoDao.isValidBatch(idsList,Integer.parseInt(Constants.YES));
|
||||
idsList.clear();
|
||||
if(count>0){
|
||||
vaild=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(idsList.size()>0){
|
||||
int count=dnsFakeInfoDao.isValidBatch(idsList,Integer.parseInt(Constants.YES));
|
||||
idsList.clear();
|
||||
if(count>0)vaild=true;
|
||||
}
|
||||
return vaild;
|
||||
}
|
||||
}
|
||||
163
src/main/java/com/nis/web/service/restful/DnsFakeIpService.java
Normal file
163
src/main/java/com/nis/web/service/restful/DnsFakeIpService.java
Normal file
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
*@Title: DnsFakeIpService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DnsFakeIp;
|
||||
import com.nis.domain.restful.FakeIpConfigCompile;
|
||||
import com.nis.domain.restful.FakeIpConfigGroup;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.DnsFakeIpDao;
|
||||
import com.nis.web.dao.FakeIpConfigCompileDao;
|
||||
import com.nis.web.dao.FakeIpConfigGroupDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
/**
|
||||
* @ClassName: DnsFakeIpService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DnsFakeIpService extends CrudService<DnsFakeIpDao, DnsFakeIp> {
|
||||
@Autowired
|
||||
public DnsFakeIpDao dnsFakeIpDao;
|
||||
@Autowired
|
||||
public FakeIpConfigCompileDao fakeIpConfigCompileDao;
|
||||
@Autowired
|
||||
public FakeIpConfigGroupDao fakeIpConfigGroupDao;
|
||||
public Page<DnsFakeIp> getDnsFakeIp(Page<DnsFakeIp> page, DnsFakeIp entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public DnsFakeIp findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveDnsFakeIpBatch(List<DnsFakeIp> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
this.saveBatch(entity,DnsFakeIpDao.class);
|
||||
}
|
||||
public void updateDnsFakeIpBatch(List<DnsFakeIp> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, DnsFakeIpDao.class);
|
||||
}
|
||||
public void removeDnsFakeIp(long id) {
|
||||
dnsFakeIpDao.delete(id);
|
||||
}
|
||||
public void removeDnsFakeIpBatch(List<DnsFakeIp> entity) {
|
||||
super.deleteBatch(entity, DnsFakeIpDao.class);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isValid(单条有效验证)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param id
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean isValid(long id){
|
||||
return dnsFakeIpDao.isValid(id)==Integer.parseInt(Constants.YES);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isValid(多条有效验证)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean isValid(List<DnsFakeIp> entity){
|
||||
boolean vaild=false;
|
||||
List<Long> idsList=new ArrayList<Long>();
|
||||
for(DnsFakeIp DnsFakeIp : entity){
|
||||
idsList.add(DnsFakeIp.getId());
|
||||
if(idsList.size()%1000==0&&idsList.size()!=0){
|
||||
int count=dnsFakeIpDao.isValidBatch(idsList,Integer.parseInt(Constants.YES));
|
||||
idsList.clear();
|
||||
if(count>0){
|
||||
vaild=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(idsList.size()>0){
|
||||
int count=dnsFakeIpDao.isValidBatch(idsList,Integer.parseInt(Constants.YES));
|
||||
idsList.clear();
|
||||
if(count>0)vaild=true;
|
||||
}
|
||||
return vaild;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.nis.web.service.CrudService#saveBatch(java.util.List, java.lang.Class)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void saveBatch(List<DnsFakeIp> data, @SuppressWarnings("rawtypes") Class mClass) {
|
||||
Date now=new Date();
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
DnsFakeIp t = data.get(index);
|
||||
((DnsFakeIpDao) batchSqlSession.getMapper(mClass)).insert(t);
|
||||
if(t.getGroupId()==0||t.getGroupId()==1){
|
||||
//先生成编译,获得编译号
|
||||
FakeIpConfigCompile fakeIpConfigCompile=new FakeIpConfigCompile();
|
||||
long compileId=fakeIpConfigCompileDao.getCompileId();
|
||||
fakeIpConfigCompile.setLastUpdate(now);
|
||||
System.out.println(compileId);
|
||||
fakeIpConfigCompile.setCompileId(compileId);
|
||||
if(t.getGroupId()==0){
|
||||
fakeIpConfigCompile.setAction(2);
|
||||
}else if(t.getGroupId()==1)
|
||||
fakeIpConfigCompile.setAction(1);
|
||||
fakeIpConfigCompile.setOpTime(t.getOpTime());
|
||||
fakeIpConfigCompile.setActiveSys(3);
|
||||
((FakeIpConfigCompileDao) batchSqlSession.getMapper(FakeIpConfigCompileDao.class)).insert(fakeIpConfigCompile);
|
||||
//生成分组
|
||||
FakeIpConfigGroup fakeIpConfigGroup=new FakeIpConfigGroup();
|
||||
fakeIpConfigGroup.setLastUpdate(now);
|
||||
fakeIpConfigGroup.setGroupId(t.getGroupId());
|
||||
fakeIpConfigGroup.setCompileId(compileId);
|
||||
fakeIpConfigGroup.setOpTime(t.getOpTime());
|
||||
((FakeIpConfigGroupDao) batchSqlSession.getMapper(FakeIpConfigGroupDao.class)).insert(fakeIpConfigGroup);
|
||||
}
|
||||
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
*@Title: DnsGroupTypeService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DnsGroupType;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.DnsGroupTypeDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* @ClassName: DnsGroupTypeService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DnsGroupTypeService extends CrudService<DnsGroupTypeDao, DnsGroupType> {
|
||||
@Autowired
|
||||
public DnsGroupTypeDao dnsGroupTypeDao;
|
||||
public Page<DnsGroupType> getDnsGroupType(Page<DnsGroupType> page, DnsGroupType entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public DnsGroupType findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveDnsGroupTypeBatch(SaveRequestLogThread thread,long start,List<DnsGroupType> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
List<Integer> idsList=new ArrayList<>();
|
||||
for(DnsGroupType e:entity){
|
||||
if(e.getGroupId()!=null)
|
||||
idsList.add(e.getGroupId());
|
||||
}
|
||||
if(idsList.size()>0){
|
||||
boolean unique=this.groupIdValidation(idsList);
|
||||
if(!unique)
|
||||
throw new RestServiceException(thread, System.currentTimeMillis(), "分组号不唯一", RestBusinessCode.not_unique.getValue());
|
||||
}
|
||||
super.saveBatch(entity,DnsGroupTypeDao.class);
|
||||
}
|
||||
public void updateDnsGroupTypeBatch(SaveRequestLogThread thread,long start,List<DnsGroupType> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
// List<Integer> idsList=new ArrayList<>();
|
||||
// for(DnsGroupType e:entity){
|
||||
// if(e.getGroupId()!=null)
|
||||
// idsList.add(e.getGroupId());
|
||||
// }
|
||||
// if(idsList.size()>0){
|
||||
// boolean unique=this.groupIdValidation(idsList);
|
||||
// if(!unique)
|
||||
// throw new RestServiceException(thread, System.currentTimeMillis(), "分组号不唯一", RestBusinessCode.not_unique.getValue());
|
||||
//
|
||||
// }
|
||||
super.updateBatch(entity, DnsGroupTypeDao.class);
|
||||
}
|
||||
public void removeDnsGroupType(long id) {
|
||||
dnsGroupTypeDao.delete(id);
|
||||
}
|
||||
public void removeDnsGroupTypeBatch(List<DnsGroupType> entity) {
|
||||
super.deleteBatch(entity, DnsGroupTypeDao.class);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isValid(单条有效验证)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param id
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean isValid(long id){
|
||||
return dnsGroupTypeDao.isValid(id)==Integer.parseInt(Constants.YES);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isValid(多条有效验证)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean isValid(List<DnsGroupType> entity){
|
||||
boolean vaild=false;
|
||||
List<Long> idsList=new ArrayList<Long>();
|
||||
for(DnsGroupType dnsGroupType : entity){
|
||||
idsList.add(dnsGroupType.getId());
|
||||
if(idsList.size()%1000==0&&idsList.size()!=0){
|
||||
int count=dnsGroupTypeDao.isValidBatch(idsList,Integer.parseInt(Constants.YES));
|
||||
idsList.clear();
|
||||
if(count>0){
|
||||
vaild=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(idsList.size()>0){
|
||||
int count=dnsGroupTypeDao.isValidBatch(idsList,Integer.parseInt(Constants.YES));
|
||||
idsList.clear();
|
||||
if(count>0)vaild=true;
|
||||
}
|
||||
return vaild;
|
||||
}
|
||||
/**
|
||||
* 验证字段唯一性
|
||||
* reqStrateIdValidation(这里用一句话描述这个方法的作用)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean groupIdValidation(List<Integer> idsList){
|
||||
int count=0;
|
||||
if(idsList.size()>=1000){
|
||||
int i=0;
|
||||
for(;i<idsList.size()/1000;i++){
|
||||
List<Integer> subList=idsList.subList(i*1000,(i+1)*1000);
|
||||
count=dnsGroupTypeDao.isGroupIdUnique(subList);
|
||||
if(count>0){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(idsList.size()>(i*1000)){
|
||||
List<Integer> subList=idsList.subList(i*1000,idsList.size());
|
||||
count=dnsGroupTypeDao.isGroupIdUnique(subList);
|
||||
}
|
||||
}else{
|
||||
count=dnsGroupTypeDao.isGroupIdUnique(idsList);
|
||||
}
|
||||
return count==0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
/**
|
||||
*@Title: DnsResponseStrategy.java
|
||||
*@Package com.nis.web.controller.restful
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2016年9月5日 下午3:37:54
|
||||
*@version 1.0
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DnsResponseStrategy;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.DnsResponseStrategyDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* @ClassName: DnsResponseStrategy.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2016年9月5日 下午3:37:54
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DnsResponseStrategyService extends CrudService<DnsResponseStrategyDao, DnsResponseStrategy> {
|
||||
@Autowired
|
||||
public DnsResponseStrategyDao dnsResponseStrategyDao;
|
||||
public Page<DnsResponseStrategy> getDnsResponseStrategy(Page<DnsResponseStrategy> page, DnsResponseStrategy dnsResponseStrategy) {
|
||||
return findPage(page, dnsResponseStrategy);
|
||||
}
|
||||
|
||||
public DnsResponseStrategy findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* saveDnsResponseStrategyBatch(多条插入)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void saveDnsResponseStrategyBatch(List<DnsResponseStrategy> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,DnsResponseStrategyDao.class);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* saveDnsResponseStrategyBatch(多条插入)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void saveDnsResponseStrategyBatch(SaveRequestLogThread thread,long start,List<DnsResponseStrategy> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
List idsList=new ArrayList<>();
|
||||
for(DnsResponseStrategy e:entity){
|
||||
if(e.getReqStrateId()!=null)
|
||||
idsList.add(e.getReqStrateId());
|
||||
}
|
||||
if(idsList.size()>0){
|
||||
boolean uinque=this.reqStrateIdValidation(idsList);
|
||||
if(!uinque){
|
||||
throw new RestServiceException(thread, System.currentTimeMillis(), "请求策略号不唯一", RestBusinessCode.not_unique.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
super.saveBatch(entity,DnsResponseStrategyDao.class);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* updateDnsResponseStrategyBatch(多条更新)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void updateDnsResponseStrategyBatch(List<DnsResponseStrategy> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
super.updateBatch(entity, DnsResponseStrategyDao.class);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* updateDnsResponseStrategyBatch(多条更新)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void updateDnsResponseStrategyBatch(SaveRequestLogThread thread,long start,List<DnsResponseStrategy> entity) {
|
||||
// List idsList=new ArrayList<>();
|
||||
// for(DnsResponseStrategy e:entity){
|
||||
// if(e.getReqStrateId()!=null)
|
||||
// idsList.add(e.getReqStrateId());
|
||||
// }
|
||||
// if(idsList.size()>0){
|
||||
// boolean uinque=this.reqStrateIdValidation(idsList);
|
||||
// if(!uinque){
|
||||
// throw new RestServiceException(thread, System.currentTimeMillis(), "请求策略号不唯一", RestBusinessCode.not_unique.getValue());
|
||||
// }
|
||||
// }
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, DnsResponseStrategyDao.class);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* removeDnsResponseStrategy(单条删除)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param id
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void removeDnsResponseStrategy(long id) {
|
||||
dnsResponseStrategyDao.delete(id);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* removeDnsResponseStrategyBatch(多条删除)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void removeDnsResponseStrategyBatch(List<DnsResponseStrategy> entity) {
|
||||
super.deleteBatch(entity, DnsResponseStrategyDao.class);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isValid(单条有效验证)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param id
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean isValid(long id){
|
||||
return dnsResponseStrategyDao.isValid(id)==Integer.parseInt(Constants.YES);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* isValid(多条有效验证)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param entity
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean isValid(List<DnsResponseStrategy> entity){
|
||||
boolean vaild=false;
|
||||
List<Long> idsList=new ArrayList<Long>();
|
||||
for(DnsResponseStrategy dnsResponseStrategy : entity){
|
||||
idsList.add(dnsResponseStrategy.getId());
|
||||
if(idsList.size()%1000==0&&idsList.size()!=0){
|
||||
int count=dnsResponseStrategyDao.isValidBatch(idsList,Integer.parseInt(Constants.YES));
|
||||
idsList.clear();
|
||||
if(count>0){
|
||||
vaild=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(idsList.size()>0){
|
||||
int count=dnsResponseStrategyDao.isValidBatch(idsList,Integer.parseInt(Constants.YES));
|
||||
idsList.clear();
|
||||
if(count>0)vaild=true;
|
||||
}
|
||||
return vaild;
|
||||
}
|
||||
/**
|
||||
* 验证字段唯一性
|
||||
* reqStrateIdValidation(这里用一句话描述这个方法的作用)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean reqStrateIdValidation(List<Integer> idsList){
|
||||
int count=0;
|
||||
if(idsList.size()>=1000){
|
||||
int i=0;
|
||||
for(;i<idsList.size()/1000;i++){
|
||||
List<Integer> subList=idsList.subList(i*1000,(i+1)*1000);
|
||||
count=dnsResponseStrategyDao.isReqStrateIdUnique(subList);
|
||||
if(count>0){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(idsList.size()>(i*1000)){
|
||||
List<Integer> subList=idsList.subList(i*1000,idsList.size());
|
||||
count=dnsResponseStrategyDao.isReqStrateIdUnique(subList);
|
||||
}
|
||||
}else{
|
||||
count=dnsResponseStrategyDao.isReqStrateIdUnique(idsList);
|
||||
}
|
||||
return count==0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
*@Title: EncryptProtoRandomService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.EncryptProtoRandom;
|
||||
import com.nis.web.dao.EncryptProtoRandomDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: EncryptProtoRandomService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class EncryptProtoRandomService extends CrudService<EncryptProtoRandomDao, EncryptProtoRandom> {
|
||||
@Autowired
|
||||
public EncryptProtoRandomDao encryptProtoRandomDao;
|
||||
public Page<EncryptProtoRandom> getEncryptProtoRandom(Page<EncryptProtoRandom> page, EncryptProtoRandom entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public EncryptProtoRandom findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveEncryptProtoRandomBatch(List<EncryptProtoRandom> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,EncryptProtoRandomDao.class);
|
||||
}
|
||||
public void updateEncryptProtoRandomBatch(List<EncryptProtoRandom> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, EncryptProtoRandomDao.class);
|
||||
}
|
||||
public void removeEncryptProtoRandom(Long id) {
|
||||
encryptProtoRandomDao.delete(id);
|
||||
}
|
||||
public void removeEncryptProtoRandomBatch(List<EncryptProtoRandom> entity) {
|
||||
super.deleteBatch(entity, EncryptProtoRandomDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
*@Title: DnsFakeIpService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.restful.FakeIpConfigCompile;
|
||||
import com.nis.web.dao.FakeIpConfigCompileDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: DnsFakeIpService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class FakeIpConfigCompileService extends CrudService<FakeIpConfigCompileDao, FakeIpConfigCompile> {
|
||||
@Autowired
|
||||
public FakeIpConfigCompileDao fakeIpConfigCompileDao;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
*@Title: DnsFakeIpService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.restful.FakeIpConfigGroup;
|
||||
import com.nis.web.dao.FakeIpConfigGroupDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: DnsFakeIpService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class FakeIpConfigGroupService extends CrudService<FakeIpConfigGroupDao, FakeIpConfigGroup> {
|
||||
@Autowired
|
||||
public FakeIpConfigGroupDao fakeIpConfigGroupDao;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
*@Title: FwqInfoService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.FwqInfo;
|
||||
import com.nis.web.dao.FwqInfoDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: FwqInfoService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class FwqInfoService extends CrudService<FwqInfoDao, FwqInfo> {
|
||||
@Autowired
|
||||
public FwqInfoDao fwqInfoDao;
|
||||
public Page<FwqInfo> getFwqInfo(Page<FwqInfo> page, FwqInfo entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public FwqInfo findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveFwqInfoBatch(List<FwqInfo> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,FwqInfoDao.class);
|
||||
}
|
||||
public void updateFwqInfoBatch(List<FwqInfo> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, FwqInfoDao.class);
|
||||
}
|
||||
public void removeFwqInfo(long id) {
|
||||
fwqInfoDao.delete(id);
|
||||
}
|
||||
public void removeFwqInfoBatch(List<FwqInfo> entity) {
|
||||
super.deleteBatch(entity, FwqInfoDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.DfKeyConvertUrl;
|
||||
import com.nis.domain.restful.DjFlowControlStop;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.IntervalTimeSearchDao;
|
||||
import com.nis.web.service.BaseLogService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* @ClassName: IntervalTimeSearchService
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @author (zbc)
|
||||
* @date 2016年9月8日下午8:11:58
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class IntervalTimeSearchService extends BaseLogService {
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
protected final Logger logger = Logger.getLogger(this.getClass());
|
||||
/**
|
||||
* 持久层对象
|
||||
*/
|
||||
@Autowired
|
||||
protected IntervalTimeSearchDao dao;
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<DjFlowControlStop> findFlowControlStopPage(Page<DjFlowControlStop> page,
|
||||
DjFlowControlStop entity) {
|
||||
entity.setPage(page);
|
||||
page.setList(dao.findFlowControlStopPage(entity));
|
||||
return page;
|
||||
}
|
||||
/**
|
||||
* 流控日志查询条件检查
|
||||
* wx
|
||||
* @param entity
|
||||
*/
|
||||
public void queryConditionCheck(SaveRequestLogThread thread,long start,DjFlowControlStop entity,Page page) {
|
||||
/*try {
|
||||
if (!StringUtil.isBlank(entity.getSearchCfgId())) {
|
||||
Long.parseLong(entity.getSearchCfgId());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchCfgId参数格式错误",
|
||||
RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchCfgId参数错误");
|
||||
}*/
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getOptStartTime())) {
|
||||
sdf.parse(entity.getOptStartTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optStartTime参数格式错误");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!StringUtil.isBlank(entity.getOptEndTime())) {
|
||||
sdf.parse(entity.getOptEndTime());
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread,System.currentTimeMillis()-start,"optEndTime参数错误");
|
||||
}
|
||||
|
||||
try {
|
||||
checkCloumnIsExist(thread,start,DjFlowControlStop.class, page);
|
||||
} catch (RestServiceException e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
|
||||
logger.error(e);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
221
src/main/java/com/nis/web/service/restful/JDBCTest.java
Normal file
221
src/main/java/com/nis/web/service/restful/JDBCTest.java
Normal file
@@ -0,0 +1,221 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.List;
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigGroupRelation;
|
||||
import com.nis.domain.restful.IpRegion;
|
||||
import com.nis.domain.restful.NumRegion;
|
||||
import com.nis.domain.restful.StrRegion;
|
||||
|
||||
/**
|
||||
* jdbc测试批量插入
|
||||
*
|
||||
* @author RenKaiGe-Office
|
||||
*
|
||||
*/
|
||||
public class JDBCTest {
|
||||
public static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) {
|
||||
java.sql.Timestamp sqlDate = null;
|
||||
long t = udate.getTime();
|
||||
sqlDate = new java.sql.Timestamp(t);
|
||||
return sqlDate;
|
||||
|
||||
}
|
||||
|
||||
public static void saveCompile(List<ConfigCompile> compileList, Connection conn, int batchSize) throws Exception {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate)");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (ConfigCompile compile : compileList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { compile.getCompileId(), compile.getService(), compile.getAction(),
|
||||
compile.getContType(), compile.getAttrType(), compile.getContLabel(), compile.getTaskId(),
|
||||
compile.getGuaranteeId(), compile.getAffAirId(), compile.getTopIcId(), compile.getDoBlackList(),
|
||||
compile.getDoLog(), compile.getEffectiveRange(), compile.getActiveSys(), compile.getConfigPercent(),
|
||||
compile.getConfigOption(), compile.getStartTime(), compile.getEndTime(), compile.getUserRegion(),
|
||||
compile.getIsValid(), compile.getGroupNum(), compile.getFatherCfgId(), compile.getOpTime() };
|
||||
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 16) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getStartTime()));
|
||||
} else if (x == 17) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getEndTime()));
|
||||
} else if (x == 22) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
if (count % batchSize == 0) {
|
||||
ps.executeBatch();
|
||||
////conn.commit();
|
||||
}
|
||||
}
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
|
||||
public static void saveGroup(List<ConfigGroupRelation> groupList, Connection conn, int batchSize) throws Exception {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_GROUP (ID,GROUP_ID, COMPILE_ID, IS_VALID, LAST_UPDATE, OP_TIME ) values ( seq_config_group.nextval, ?, ?, ?, sysdate, ?) ");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (ConfigGroupRelation group : groupList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { group.getGroupId(), group.getCompileId(), group.getIsValid(),
|
||||
group.getOpTime() };
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 3) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(group.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
if (count % batchSize == 0) {
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
}
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
|
||||
public static void saveIPRegion(String name, List<IpRegion> ipRegionList, Connection conn, int batchSize)
|
||||
throws Exception {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT, DST_IP, MASK_DST_IP, DST_PORT, MASK_DST_PORT, PROTOCOL, DIRECTION, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { ipRegion.getRegionId(), ipRegion.getGroupId(), ipRegion.getAddrType(),
|
||||
ipRegion.getSrcIp(), ipRegion.getMaskSrcIp(), ipRegion.getSrcPort(), ipRegion.getMaskSrcPort(),
|
||||
ipRegion.getDstIp(), ipRegion.getMaskDstIp(), ipRegion.getDstPort(), ipRegion.getMaskDstPort(),
|
||||
ipRegion.getProtocol(), ipRegion.getDirection(), ipRegion.getIsValid(), ipRegion.getOpTime()
|
||||
|
||||
};
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 14) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(ipRegion.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
if (count % batchSize == 0) {
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
}
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
|
||||
public static void saveNumRegion(String name, List<NumRegion> numRegionList, Connection conn, int batchSize)
|
||||
throws Exception {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
" (REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE) values(?, ?, ?, ?, ?, ?, sysdate)");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { numRegion.getRegionId(), numRegion.getGroupId(), numRegion.getLowBoundary(),
|
||||
numRegion.getUpBoundary(), numRegion.getIsValid(), numRegion.getOpTime() };
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 5) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(numRegion.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
if (count % batchSize == 0) {
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
}
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
|
||||
public static void saveStrongStrRegion(String name, List<StrRegion> strRegionList, Connection conn, int batchSize)
|
||||
throws Exception {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, DISTRICT, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), strRegion.getDistrict(),
|
||||
strRegion.getKeywords(), strRegion.getExprType(), strRegion.getMatchMethod(),
|
||||
strRegion.getIsHexbin(), strRegion.getIsValid(), strRegion.getOpTime() };
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 8) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(strRegion.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
if (count % batchSize == 0) {
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
}
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
|
||||
public static void saveStrRegion(String name, List<StrRegion> strRegionList, Connection conn, int batchSize)
|
||||
throws Exception {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), strRegion.getKeywords(),
|
||||
strRegion.getExprType(), strRegion.getMatchMethod(), strRegion.getIsHexbin(),
|
||||
strRegion.getIsValid(), strRegion.getOpTime() };
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 7) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(strRegion.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
if (count % batchSize == 0) {
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
}
|
||||
ps.executeBatch();
|
||||
//conn.commit();
|
||||
}
|
||||
}
|
||||
472
src/main/java/com/nis/web/service/restful/JDBCThreadTest.java
Normal file
472
src/main/java/com/nis/web/service/restful/JDBCThreadTest.java
Normal file
@@ -0,0 +1,472 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigGroupRelation;
|
||||
import com.nis.domain.restful.IpRegion;
|
||||
import com.nis.domain.restful.NumRegion;
|
||||
import com.nis.domain.restful.StrRegion;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* jdbc测试批量插入
|
||||
*
|
||||
* @author RenKaiGe-Office
|
||||
*
|
||||
*/
|
||||
public class JDBCThreadTest implements Runnable {
|
||||
|
||||
private static SaveRequestLogThread thread;
|
||||
private static Long start;
|
||||
private CountDownLatch latch;
|
||||
private Boolean isStrongStr;
|
||||
private String tableName;
|
||||
private int batchSize;
|
||||
private Connection conn;
|
||||
private List<ConfigCompile> compileList;
|
||||
private List<ConfigGroupRelation> groupList;
|
||||
private List<IpRegion> ipRegionList;
|
||||
private List<NumRegion> numRegionList;
|
||||
private List<StrRegion> strRegionList;
|
||||
|
||||
public JDBCThreadTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public JDBCThreadTest(int batchSize, Connection conn, CountDownLatch latch, SaveRequestLogThread thread,
|
||||
Long start) {
|
||||
super();
|
||||
this.batchSize = batchSize;
|
||||
this.conn = conn;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public JDBCThreadTest(String tableName, int batchSize, Connection conn, CountDownLatch latch,
|
||||
SaveRequestLogThread thread, Long start) {
|
||||
super();
|
||||
this.tableName = tableName;
|
||||
this.batchSize = batchSize;
|
||||
this.conn = conn;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public JDBCThreadTest(boolean isStrongStr, String tableName, int batchSize, Connection conn, CountDownLatch latch,
|
||||
SaveRequestLogThread thread, Long start) {
|
||||
super();
|
||||
this.isStrongStr = isStrongStr;
|
||||
this.tableName = tableName;
|
||||
this.batchSize = batchSize;
|
||||
this.conn = conn;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public SaveRequestLogThread getThread() {
|
||||
return thread;
|
||||
}
|
||||
|
||||
public void setThread(SaveRequestLogThread thread) {
|
||||
this.thread = thread;
|
||||
}
|
||||
|
||||
public Long getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public void setStart(Long start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public int getBatchSize() {
|
||||
return batchSize;
|
||||
}
|
||||
|
||||
public void setBatchSize(int batchSize) {
|
||||
this.batchSize = batchSize;
|
||||
}
|
||||
|
||||
public CountDownLatch getLatch() {
|
||||
return latch;
|
||||
}
|
||||
|
||||
public void setLatch(CountDownLatch latch) {
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public Boolean getIsStrongStr() {
|
||||
return isStrongStr;
|
||||
}
|
||||
|
||||
public void setIsStrongStr(Boolean isStrongStr) {
|
||||
this.isStrongStr = isStrongStr;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public Connection getConn() {
|
||||
return conn;
|
||||
}
|
||||
|
||||
public void setConn(Connection conn) {
|
||||
this.conn = conn;
|
||||
}
|
||||
|
||||
public List<ConfigCompile> getCompileList() {
|
||||
return compileList;
|
||||
}
|
||||
|
||||
public void setCompileList(List<ConfigCompile> compileList) {
|
||||
this.compileList = compileList;
|
||||
}
|
||||
|
||||
public List<ConfigGroupRelation> getGroupList() {
|
||||
return groupList;
|
||||
}
|
||||
|
||||
public void setGroupList(List<ConfigGroupRelation> groupList) {
|
||||
this.groupList = groupList;
|
||||
}
|
||||
|
||||
public List<IpRegion> getIpRegionList() {
|
||||
return ipRegionList;
|
||||
}
|
||||
|
||||
public void setIpRegionList(List<IpRegion> ipRegionList) {
|
||||
this.ipRegionList = ipRegionList;
|
||||
}
|
||||
|
||||
public List<NumRegion> getNumRegionList() {
|
||||
return numRegionList;
|
||||
}
|
||||
|
||||
public void setNumRegionList(List<NumRegion> numRegionList) {
|
||||
this.numRegionList = numRegionList;
|
||||
}
|
||||
|
||||
public List<StrRegion> getStrRegionList() {
|
||||
return strRegionList;
|
||||
}
|
||||
|
||||
public void setStrRegionList(List<StrRegion> strRegionList) {
|
||||
this.strRegionList = strRegionList;
|
||||
}
|
||||
|
||||
public static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) {
|
||||
java.sql.Timestamp sqlDate = null;
|
||||
long t = udate.getTime();
|
||||
sqlDate = new java.sql.Timestamp(t);
|
||||
return sqlDate;
|
||||
|
||||
}
|
||||
|
||||
public static void saveCompile(List<ConfigCompile> compileList, Connection conn, int batchSize) {
|
||||
if (null != conn) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate)");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (ConfigCompile compile : compileList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { compile.getCompileId(), compile.getService(), compile.getAction(),
|
||||
compile.getContType(), compile.getAttrType(), compile.getContLabel(), compile.getTaskId(),
|
||||
compile.getGuaranteeId(), compile.getAffAirId(), compile.getTopIcId(),
|
||||
compile.getDoBlackList(), compile.getDoLog(), compile.getEffectiveRange(),
|
||||
compile.getActiveSys(), compile.getConfigPercent(), compile.getConfigOption(),
|
||||
compile.getStartTime(), compile.getEndTime(), compile.getUserRegion(), compile.getIsValid(),
|
||||
compile.getGroupNum(), compile.getFatherCfgId(), compile.getOpTime() };
|
||||
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 16) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getStartTime()));
|
||||
} else if (x == 17) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getEndTime()));
|
||||
} else if (x == 22) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
// if (count % batchSize == 0) {
|
||||
// ps.executeBatch();
|
||||
// ps.clearBatch();
|
||||
// }
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
conn.close();
|
||||
conn = null;
|
||||
} catch (SQLException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// ps.close();
|
||||
// conn.commit();
|
||||
}
|
||||
|
||||
public static void saveGroup(List<ConfigGroupRelation> groupList, Connection conn, int batchSize) {
|
||||
if (null != conn) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_GROUP (ID,GROUP_ID, COMPILE_ID, IS_VALID, LAST_UPDATE, OP_TIME ) values ( seq_config_group.nextval, ?, ?, ?, sysdate, ?) ");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (ConfigGroupRelation group : groupList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { group.getGroupId(), group.getCompileId(), group.getIsValid(),
|
||||
group.getOpTime() };
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 3) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(group.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
// if (count % batchSize == 0) {
|
||||
// ps.executeBatch();
|
||||
// ps.clearBatch();
|
||||
// }
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
conn.close();
|
||||
conn = null;
|
||||
} catch (SQLException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// ps.close();
|
||||
// conn.commit();
|
||||
}
|
||||
|
||||
public static void saveIPRegion(String name, List<IpRegion> ipRegionList, Connection conn, int batchSize) {
|
||||
if (null != conn) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT, DST_IP, MASK_DST_IP, DST_PORT, MASK_DST_PORT, PROTOCOL, DIRECTION, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { ipRegion.getRegionId(), ipRegion.getGroupId(), ipRegion.getAddrType(),
|
||||
ipRegion.getSrcIp(), ipRegion.getMaskSrcIp(), ipRegion.getSrcPort(),
|
||||
ipRegion.getMaskSrcPort(), ipRegion.getDstIp(), ipRegion.getMaskDstIp(),
|
||||
ipRegion.getDstPort(), ipRegion.getMaskDstPort(), ipRegion.getProtocol(),
|
||||
ipRegion.getDirection(), ipRegion.getIsValid(), ipRegion.getOpTime()
|
||||
|
||||
};
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 14) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(ipRegion.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
// if (count % batchSize == 0) {
|
||||
// ps.executeBatch();
|
||||
// ps.clearBatch();
|
||||
// }
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
conn.close();
|
||||
conn = null;
|
||||
} catch (SQLException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// ps.close();
|
||||
// conn.commit();
|
||||
}
|
||||
|
||||
public static void saveNumRegion(String name, List<NumRegion> numRegionList, Connection conn, int batchSize) {
|
||||
if (null != conn) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
" (REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE) values(?, ?, ?, ?, ?, ?, sysdate)");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
int count = 0;
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { numRegion.getRegionId(), numRegion.getGroupId(),
|
||||
numRegion.getLowBoundary(), numRegion.getUpBoundary(), numRegion.getIsValid(),
|
||||
numRegion.getOpTime() };
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 5) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(numRegion.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
// if (count % batchSize == 0) {
|
||||
// ps.executeBatch();
|
||||
// ps.clearBatch();
|
||||
// }
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
conn.close();
|
||||
conn = null;
|
||||
} catch (SQLException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// ps.close();
|
||||
// conn.commit();
|
||||
}
|
||||
|
||||
public static void saveStrongStrRegion(String name, List<StrRegion> strRegionList, Connection conn, int batchSize) {
|
||||
if (null != conn) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, DISTRICT, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
|
||||
int count = 0;
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { strRegion.getRegionId(), strRegion.getGroupId(),
|
||||
strRegion.getDistrict(), strRegion.getKeywords(), strRegion.getExprType(),
|
||||
strRegion.getMatchMethod(), strRegion.getIsHexbin(), strRegion.getIsValid(),
|
||||
strRegion.getOpTime() };
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 8) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(strRegion.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
// if (count % batchSize == 0) {
|
||||
// ps.executeBatch();
|
||||
// ps.clearBatch();
|
||||
// }
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
conn.close();
|
||||
conn = null;
|
||||
} catch (SQLException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// ps.close();
|
||||
// conn.commit();
|
||||
}
|
||||
|
||||
public static void saveStrRegion(String name, List<StrRegion> strRegionList, Connection conn, int batchSize) {
|
||||
if (null != conn) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
|
||||
int count = 0;
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
count++;
|
||||
Object[] obj = new Object[] { strRegion.getRegionId(), strRegion.getGroupId(),
|
||||
strRegion.getKeywords(), strRegion.getExprType(), strRegion.getMatchMethod(),
|
||||
strRegion.getIsHexbin(), strRegion.getIsValid(), strRegion.getOpTime() };
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
if (x == 7) {
|
||||
ps.setTimestamp(x + 1, utileDate2TimeStamp(strRegion.getOpTime()));
|
||||
} else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
// if (count % batchSize == 0) {
|
||||
// ps.executeBatch();
|
||||
// ps.clearBatch();
|
||||
// }
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
conn.close();
|
||||
conn = null;
|
||||
} catch (SQLException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// ps.close();
|
||||
// conn.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (conn) {
|
||||
try {
|
||||
if (null != compileList && compileList.size() > 0) {
|
||||
saveCompile(compileList, conn, batchSize);
|
||||
} else if (null != groupList && groupList.size() > 0) {
|
||||
saveGroup(groupList, conn, batchSize);
|
||||
} else if (null != ipRegionList && ipRegionList.size() > 0) {
|
||||
saveIPRegion(tableName, ipRegionList, conn, batchSize);
|
||||
} else if (null != strRegionList && strRegionList.size() > 0) {
|
||||
if (null != isStrongStr && isStrongStr) {
|
||||
saveStrongStrRegion(tableName, strRegionList, conn, batchSize);
|
||||
} else {
|
||||
saveStrRegion(tableName, strRegionList, conn, batchSize);
|
||||
}
|
||||
}else if (null != numRegionList && numRegionList.size() > 0) {
|
||||
saveNumRegion(tableName, numRegionList, conn, batchSize);
|
||||
}
|
||||
latch.countDown();
|
||||
System.out.println("latchCount=======================" + latch.getCount());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
*@Title: JdjInfoService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.JdjInfo;
|
||||
import com.nis.web.dao.JdjInfoDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: JdjInfoService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JdjInfoService extends CrudService<JdjInfoDao, JdjInfo> {
|
||||
@Autowired
|
||||
public JdjInfoDao jdjInfoDao;
|
||||
public Page<JdjInfo> getJdjInfo(Page<JdjInfo> page, JdjInfo entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public JdjInfo findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveJdjInfoBatch(List<JdjInfo> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,JdjInfoDao.class);
|
||||
}
|
||||
public void updateJdjInfoBatch(List<JdjInfo> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, JdjInfoDao.class);
|
||||
}
|
||||
public void removeJdjInfo(long id) {
|
||||
jdjInfoDao.delete(id);
|
||||
}
|
||||
public void removeJdjInfoBatch(List<JdjInfo> entity) {
|
||||
super.deleteBatch(entity, JdjInfoDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,637 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigGroupRelation;
|
||||
import com.nis.domain.restful.IpRegion;
|
||||
import com.nis.domain.restful.NumRegion;
|
||||
import com.nis.domain.restful.StrRegion;
|
||||
import com.nis.util.Configurations;
|
||||
import com.thoughtworks.xstream.core.util.Fields;
|
||||
|
||||
/**
|
||||
* jdbc测试批量插入
|
||||
*
|
||||
* @author RenKaiGe-Office
|
||||
*
|
||||
*/
|
||||
public class SaveCompileByJDBCThread implements Runnable {
|
||||
private static Logger logger = Logger.getLogger(SaveCompileByJDBCThread.class);
|
||||
private static Long start;
|
||||
private CountDownLatch latch;
|
||||
private Boolean isStrongStr;
|
||||
private String tableName;
|
||||
private Connection conn;
|
||||
private List<ConfigCompile> compileList;
|
||||
private List<ConfigGroupRelation> groupList;
|
||||
private List<IpRegion> ipRegionList;
|
||||
private List<NumRegion> numRegionList;
|
||||
private List<StrRegion> strRegionList;
|
||||
|
||||
|
||||
private Method method = null;
|
||||
public SaveCompileByJDBCThread() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SaveCompileByJDBCThread(Connection conn, CountDownLatch latch, Long start) {
|
||||
super();
|
||||
this.conn = conn;
|
||||
this.latch = latch;
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public SaveCompileByJDBCThread(String tableName, Connection conn, CountDownLatch latch, Long start) {
|
||||
super();
|
||||
this.tableName = tableName;
|
||||
this.conn = conn;
|
||||
this.latch = latch;
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public SaveCompileByJDBCThread(boolean isStrongStr, String tableName, Connection conn, CountDownLatch latch,
|
||||
Long start) {
|
||||
super();
|
||||
this.isStrongStr = isStrongStr;
|
||||
this.tableName = tableName;
|
||||
this.conn = conn;
|
||||
this.latch = latch;
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public Long getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public void setStart(Long start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public CountDownLatch getLatch() {
|
||||
return latch;
|
||||
}
|
||||
|
||||
public void setLatch(CountDownLatch latch) {
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public Boolean getIsStrongStr() {
|
||||
return isStrongStr;
|
||||
}
|
||||
|
||||
public void setIsStrongStr(Boolean isStrongStr) {
|
||||
this.isStrongStr = isStrongStr;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public Connection getConn() {
|
||||
return conn;
|
||||
}
|
||||
|
||||
public void setConn(Connection conn) {
|
||||
this.conn = conn;
|
||||
}
|
||||
|
||||
public List<ConfigCompile> getCompileList() {
|
||||
return compileList;
|
||||
}
|
||||
|
||||
public void setCompileList(List<ConfigCompile> compileList) {
|
||||
this.compileList = compileList;
|
||||
}
|
||||
|
||||
public List<ConfigGroupRelation> getGroupList() {
|
||||
return groupList;
|
||||
}
|
||||
|
||||
public void setGroupList(List<ConfigGroupRelation> groupList) {
|
||||
this.groupList = groupList;
|
||||
}
|
||||
|
||||
public List<IpRegion> getIpRegionList() {
|
||||
return ipRegionList;
|
||||
}
|
||||
|
||||
public void setIpRegionList(List<IpRegion> ipRegionList) {
|
||||
this.ipRegionList = ipRegionList;
|
||||
}
|
||||
|
||||
public List<NumRegion> getNumRegionList() {
|
||||
return numRegionList;
|
||||
}
|
||||
|
||||
public void setNumRegionList(List<NumRegion> numRegionList) {
|
||||
this.numRegionList = numRegionList;
|
||||
}
|
||||
|
||||
public List<StrRegion> getStrRegionList() {
|
||||
return strRegionList;
|
||||
}
|
||||
|
||||
public void setStrRegionList(List<StrRegion> strRegionList) {
|
||||
this.strRegionList = strRegionList;
|
||||
}
|
||||
|
||||
public static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) {
|
||||
java.sql.Timestamp sqlDate = null;
|
||||
long t = udate.getTime();
|
||||
sqlDate = new java.sql.Timestamp(t);
|
||||
return sqlDate;
|
||||
|
||||
}
|
||||
|
||||
public static void saveCompile(List<ConfigCompile> compileList, Connection conn, List<Exception> msgList) {
|
||||
if (null != compileList && compileList.size() > 0) {
|
||||
try {
|
||||
String tabName = Configurations.getStringProperty("compileTabName", "CONFIG_COMPILE");
|
||||
String fieldName = Configurations.getStringProperty("compileFieldName", "COMPILE_ID");
|
||||
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(getSqlStr(tabName, fieldName));
|
||||
for (ConfigCompile compile : compileList) {
|
||||
setPsParams(fieldName.split(","),ps,compile);
|
||||
ps.addBatch();
|
||||
}
|
||||
|
||||
//zdx2017-10-25
|
||||
// sb.append(
|
||||
// "insert into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate)");
|
||||
// conn.setAutoCommit(false);
|
||||
// PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
// for (ConfigCompile compile : compileList) {
|
||||
// Object[] obj = new Object[] { compile.getCompileId(), compile.getService(), compile.getAction(),
|
||||
// compile.getContType(), compile.getAttrType(), compile.getContLabel(), compile.getTaskId(),
|
||||
// compile.getGuaranteeId(), compile.getAffAirId(), compile.getTopIcId(),
|
||||
// compile.getDoBlackList(), compile.getDoLog(), compile.getEffectiveRange(),
|
||||
// compile.getActiveSys(), compile.getConfigPercent(), compile.getConfigOption(),
|
||||
// compile.getStartTime(), compile.getEndTime(), compile.getUserRegion(), compile.getIsValid(),
|
||||
// compile.getGroupNum(), compile.getFatherCfgId(), compile.getOpTime() };
|
||||
//
|
||||
// for (int x = 0; x < obj.length; x++) {
|
||||
// if (x == 16) {
|
||||
// ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getStartTime()));
|
||||
// } else if (x == 17) {
|
||||
// ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getEndTime()));
|
||||
// } else if (x == 22) {
|
||||
// ps.setTimestamp(x + 1, utileDate2TimeStamp(compile.getOpTime()));
|
||||
// } else {
|
||||
// ps.setObject(x + 1, obj[x]);
|
||||
// }
|
||||
// }
|
||||
// ps.addBatch();
|
||||
// }
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveGroup(List<ConfigGroupRelation> groupList, Connection conn, List<Exception> msgList) {
|
||||
|
||||
if (null != groupList && groupList.size() > 0) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String tabName = Configurations.getStringProperty("groupTabName", "CONFIG_GROUP");
|
||||
String fieldName = Configurations.getStringProperty("groupFieldName", "ID");
|
||||
String groupSeqName = Configurations.getStringProperty("groupSeqName", "SEQ_CONFIG_GROUP");
|
||||
sb.append("insert into ").append(tabName);
|
||||
sb.append("(").append(fieldName);
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", LAST_UPDATE");
|
||||
}
|
||||
sb.append(") values ( ");
|
||||
conn.setAutoCommit(false);
|
||||
String fieldNameObj [] = fieldName.split(",");
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
//第一个字段必须是分组表主键
|
||||
if (i==0) {
|
||||
sb.append(groupSeqName).append(".nextval");
|
||||
}else{
|
||||
sb.append("?");
|
||||
}
|
||||
if (i+1<fieldNameObj.length) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", sysdate");
|
||||
}
|
||||
sb.append(")");
|
||||
conn.setAutoCommit(false);
|
||||
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
|
||||
for (ConfigGroupRelation group : groupList) {
|
||||
//setPsParams(fieldNameObj,ps,group);
|
||||
|
||||
Object[] obj = new Object[fieldNameObj.length] ;
|
||||
|
||||
for (int i = 1; i < fieldNameObj.length; i++) {
|
||||
String name = fieldNameObj[i].toLowerCase().trim();
|
||||
name = name.substring(0,1).toUpperCase()+name.substring(1);
|
||||
if (name.indexOf("_")>-1) {
|
||||
// name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2);
|
||||
// }
|
||||
|
||||
while (name.indexOf("_")>-1) {
|
||||
name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2);
|
||||
}
|
||||
}
|
||||
|
||||
Method method = group.getClass().getMethod("get"+name);
|
||||
obj[i]= method.invoke(group);
|
||||
}
|
||||
for (int x = 1; x < obj.length; x++) {
|
||||
|
||||
if (obj[x] instanceof Date) {
|
||||
ps.setObject(x, utileDate2TimeStamp((Date) obj[x]));
|
||||
}else {
|
||||
ps.setObject(x , obj[x]);
|
||||
}
|
||||
}
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
e.printStackTrace();
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//zdx2017-10-25
|
||||
// if (null != groupList && groupList.size() > 0) {
|
||||
// try {
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// sb.append(
|
||||
// "insert into CONFIG_GROUP (ID,GROUP_ID, COMPILE_ID, IS_VALID, LAST_UPDATE, OP_TIME ) values ( seq_config_group.nextval, ?, ?, ?, sysdate, ?) ");
|
||||
// conn.setAutoCommit(false);
|
||||
// PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
// for (ConfigGroupRelation group : groupList) {
|
||||
// Object[] obj = new Object[] { group.getGroupId(), group.getCompileId(), group.getIsValid(),
|
||||
// group.getOpTime() };
|
||||
// for (int x = 0; x < obj.length; x++) {
|
||||
// if (x == 3) {
|
||||
// ps.setTimestamp(x + 1, utileDate2TimeStamp(group.getOpTime()));
|
||||
// } else {
|
||||
// ps.setObject(x + 1, obj[x]);
|
||||
// }
|
||||
// }
|
||||
// ps.addBatch();
|
||||
// }
|
||||
// ps.executeBatch();
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e);
|
||||
// msgList.add(e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public static void saveIPRegion(String name, List<IpRegion> ipRegionList, Connection conn,
|
||||
List<Exception> msgList) {
|
||||
|
||||
if (null != ipRegionList && ipRegionList.size() > 0) {
|
||||
try {
|
||||
String fieldName = Configurations.getStringProperty("ipRegionFieldName", "REGION_ID");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName));
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
setPsParams(fieldName.split(","),ps,ipRegion);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//zdx2017-10-25
|
||||
// if (null != ipRegionList && ipRegionList.size() > 0) {
|
||||
// try {
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// sb.append("insert into ");
|
||||
// sb.append(name);
|
||||
// sb.append(
|
||||
// "(REGION_ID, GROUP_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT, DST_IP, MASK_DST_IP, DST_PORT, MASK_DST_PORT, PROTOCOL, DIRECTION, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
// conn.setAutoCommit(false);
|
||||
// PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
// for (IpRegion ipRegion : ipRegionList) {
|
||||
// Object[] obj = new Object[] { ipRegion.getRegionId(), ipRegion.getGroupId(), ipRegion.getAddrType(),
|
||||
// ipRegion.getSrcIp(), ipRegion.getMaskSrcIp(), ipRegion.getSrcPort(),
|
||||
// ipRegion.getMaskSrcPort(), ipRegion.getDstIp(), ipRegion.getMaskDstIp(),
|
||||
// ipRegion.getDstPort(), ipRegion.getMaskDstPort(), ipRegion.getProtocol(),
|
||||
// ipRegion.getDirection(), ipRegion.getIsValid(), ipRegion.getOpTime()
|
||||
//
|
||||
// };
|
||||
// for (int x = 0; x < obj.length; x++) {
|
||||
// if (x == 14) {
|
||||
// ps.setTimestamp(x + 1, utileDate2TimeStamp(ipRegion.getOpTime()));
|
||||
// } else {
|
||||
// ps.setObject(x + 1, obj[x]);
|
||||
// }
|
||||
// }
|
||||
// ps.addBatch();
|
||||
// }
|
||||
// ps.executeBatch();
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e);
|
||||
// msgList.add(e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public static void saveNumRegion(String name, List<NumRegion> numRegionList, Connection conn,
|
||||
List<Exception> msgList) {
|
||||
if (null != numRegionList && numRegionList.size() > 0) {
|
||||
try {
|
||||
String fieldName = Configurations.getStringProperty("numRegionFieldName", "REGION_ID");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName));
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
setPsParams(fieldName.split(","),ps,numRegion);
|
||||
ps.addBatch();
|
||||
}
|
||||
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//zdx2017-10-25
|
||||
// if (null != numRegionList && numRegionList.size() > 0) {
|
||||
// try {
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// sb.append("insert into ");
|
||||
// sb.append(name);
|
||||
// sb.append(
|
||||
// " (REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE) values(?, ?, ?, ?, ?, ?, sysdate)");
|
||||
// conn.setAutoCommit(false);
|
||||
// PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
// for (NumRegion numRegion : numRegionList) {
|
||||
// Object[] obj = new Object[] { numRegion.getRegionId(), numRegion.getGroupId(),
|
||||
// numRegion.getLowBoundary(), numRegion.getUpBoundary(), numRegion.getIsValid(),
|
||||
// numRegion.getOpTime() };
|
||||
// for (int x = 0; x < obj.length; x++) {
|
||||
// if (x == 5) {
|
||||
// ps.setTimestamp(x + 1, utileDate2TimeStamp(numRegion.getOpTime()));
|
||||
// } else {
|
||||
// ps.setObject(x + 1, obj[x]);
|
||||
// }
|
||||
// }
|
||||
// ps.addBatch();
|
||||
// }
|
||||
// ps.executeBatch();
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e);
|
||||
// msgList.add(e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public static void saveStrongStrRegion(String name, List<StrRegion> strRegionList, Connection conn,
|
||||
List<Exception> msgList) {
|
||||
|
||||
if (null != strRegionList && strRegionList.size() > 0) {
|
||||
try {
|
||||
String fieldName = Configurations.getStringProperty("strongStrRegionFieldName", "REGION_ID");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName));
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
setPsParams(fieldName.split(","),ps,strRegion);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//zdx2017-10-25
|
||||
// if (null != strRegionList && strRegionList.size() > 0) {
|
||||
// try {
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// sb.append("insert into ");
|
||||
// sb.append(name);
|
||||
// sb.append(
|
||||
// "(REGION_ID, GROUP_ID, DISTRICT, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
// conn.setAutoCommit(false);
|
||||
// PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
//
|
||||
// for (StrRegion strRegion : strRegionList) {
|
||||
// Object[] obj = new Object[] { strRegion.getRegionId(), strRegion.getGroupId(),
|
||||
// strRegion.getDistrict(), strRegion.getKeywords(), strRegion.getExprType(),
|
||||
// strRegion.getMatchMethod(), strRegion.getIsHexbin(), strRegion.getIsValid(),
|
||||
// strRegion.getOpTime() };
|
||||
// for (int x = 0; x < obj.length; x++) {
|
||||
// if (x == 8) {
|
||||
// ps.setTimestamp(x + 1, utileDate2TimeStamp(strRegion.getOpTime()));
|
||||
// } else {
|
||||
// ps.setObject(x + 1, obj[x]);
|
||||
// }
|
||||
// }
|
||||
// ps.addBatch();
|
||||
// }
|
||||
// ps.executeBatch();
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e);
|
||||
// msgList.add(e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public static void saveStrRegion(String name, List<StrRegion> strRegionList, Connection conn,
|
||||
List<Exception> msgList) {
|
||||
|
||||
if (null != strRegionList && strRegionList.size() > 0) {
|
||||
try {
|
||||
String fieldName = Configurations.getStringProperty("strRegionFieldName", "REGION_ID");
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(getSqlStr(name, fieldName));
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
setPsParams(fieldName.split(","),ps,strRegion);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//zdx2017-10-25
|
||||
// if (null != strRegionList && strRegionList.size() > 0) {
|
||||
// try {
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// sb.append("insert into ");
|
||||
// sb.append(name);
|
||||
// sb.append(
|
||||
// "(REGION_ID, GROUP_ID, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
// conn.setAutoCommit(false);
|
||||
// PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
//
|
||||
// for (StrRegion strRegion : strRegionList) {
|
||||
// Object[] obj = new Object[] { strRegion.getRegionId(), strRegion.getGroupId(),
|
||||
// strRegion.getKeywords(), strRegion.getExprType(), strRegion.getMatchMethod(),
|
||||
// strRegion.getIsHexbin(), strRegion.getIsValid(), strRegion.getOpTime() };
|
||||
// for (int x = 0; x < obj.length; x++) {
|
||||
// if (x == 7) {
|
||||
// ps.setTimestamp(x + 1, utileDate2TimeStamp(strRegion.getOpTime()));
|
||||
// } else {
|
||||
// ps.setObject(x + 1, obj[x]);
|
||||
// }
|
||||
// }
|
||||
// ps.addBatch();
|
||||
// }
|
||||
// ps.executeBatch();
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e);
|
||||
// msgList.add(e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @Description:根据表名和字段名称构建sql
|
||||
* @author (zdx)
|
||||
* @date 2017年10月26日 上午9:50:16
|
||||
* @param tabName
|
||||
* @param fieldName
|
||||
* @return
|
||||
*/
|
||||
private static String getSqlStr(String tabName,String fieldName){
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(tabName);
|
||||
sb.append("(").append(fieldName);
|
||||
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", LAST_UPDATE");
|
||||
}
|
||||
sb.append(") values (");
|
||||
|
||||
String fieldNameObj [] = fieldName.split(",");
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
sb.append("?");
|
||||
if (i+1<fieldNameObj.length) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", sysdate");
|
||||
}
|
||||
|
||||
sb.append(") ");
|
||||
return sb.toString();
|
||||
}
|
||||
/**
|
||||
* @Description: 向PreparedStatement设置参数
|
||||
* @author (zdx)
|
||||
* @date 2017年10月26日 上午9:47:33
|
||||
* @param fieldNameObj
|
||||
* @param ps
|
||||
* @param object
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void setPsParams(String [] fieldNameObj,PreparedStatement ps,Object object) throws Exception{
|
||||
Object[] obj = new Object[fieldNameObj.length] ;
|
||||
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
String name = fieldNameObj[i].toLowerCase().trim();
|
||||
name = name.substring(0,1).toUpperCase()+name.substring(1);
|
||||
if (name.indexOf("_")>-1) {
|
||||
// name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2);
|
||||
// }
|
||||
|
||||
while (name.indexOf("_")>-1) {
|
||||
name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2);
|
||||
}
|
||||
}
|
||||
|
||||
//需要特殊处理字段名
|
||||
if (name.equals("DoBlacklist")) {
|
||||
name = "DoBlackList";
|
||||
}else if (name.equals("AffairId")) {
|
||||
name = "AffAirId";
|
||||
}else if (name.equals("TopicId")) {
|
||||
name = "TopIcId";
|
||||
}
|
||||
|
||||
Method method = object.getClass().getMethod("get"+name);
|
||||
obj[i]= method.invoke(object);
|
||||
}
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
|
||||
if (obj[x] instanceof Date) {
|
||||
ps.setObject(x + 1, utileDate2TimeStamp((Date) obj[x]));
|
||||
}else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
List<Exception> msgList = ConfigSourcesService.getMsgList();
|
||||
synchronized (msgList) {
|
||||
try {
|
||||
if (null != compileList && compileList.size() > 0) {
|
||||
saveCompile(compileList, conn, msgList);
|
||||
} else if (null != groupList && groupList.size() > 0) {
|
||||
saveGroup(groupList, conn, msgList);
|
||||
} else if (null != ipRegionList && ipRegionList.size() > 0) {
|
||||
saveIPRegion(tableName, ipRegionList, conn, msgList);
|
||||
} else if (null != strRegionList && strRegionList.size() > 0) {
|
||||
if (null != isStrongStr && isStrongStr) {
|
||||
saveStrongStrRegion(tableName, strRegionList, conn, msgList);
|
||||
} else {
|
||||
saveStrRegion(tableName, strRegionList, conn, msgList);
|
||||
}
|
||||
} else if (null != numRegionList && numRegionList.size() > 0) {
|
||||
saveNumRegion(tableName, numRegionList, conn, msgList);
|
||||
}
|
||||
latch.countDown();
|
||||
System.out.println("latchCount=======================" + latch.getCount());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
139
src/main/java/com/nis/web/service/restful/SpringJDBCTest.java
Normal file
139
src/main/java/com/nis/web/service/restful/SpringJDBCTest.java
Normal file
@@ -0,0 +1,139 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.jdbc.object.BatchSqlUpdate;
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigGroupRelation;
|
||||
import com.nis.domain.restful.IpRegion;
|
||||
import com.nis.domain.restful.NumRegion;
|
||||
import com.nis.domain.restful.StrRegion;
|
||||
|
||||
/**
|
||||
* jdbc测试批量插入
|
||||
*
|
||||
* @author RenKaiGe-Office
|
||||
*
|
||||
*/
|
||||
public class SpringJDBCTest {
|
||||
public static BatchSqlUpdate saveCompile(List<ConfigCompile> compileList, DataSource ds, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate)");
|
||||
|
||||
BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR,
|
||||
Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR,
|
||||
Types.INTEGER, Types.BIGINT, Types.INTEGER, Types.DATE, Types.DATE, Types.VARCHAR, Types.INTEGER,
|
||||
Types.INTEGER, Types.BIGINT, Types.DATE });
|
||||
for (ConfigCompile compile : compileList) {
|
||||
bsu.update(new Object[] { compile.getCompileId(), compile.getService(), compile.getAction(),
|
||||
compile.getContType(), compile.getAttrType(), compile.getContLabel(), compile.getTaskId(),
|
||||
compile.getGuaranteeId(), compile.getAffAirId(), compile.getTopIcId(), compile.getDoBlackList(),
|
||||
compile.getDoLog(), compile.getEffectiveRange(), compile.getActiveSys(), compile.getConfigPercent(),
|
||||
compile.getConfigOption(), compile.getStartTime(), compile.getEndTime(), compile.getUserRegion(),
|
||||
compile.getIsValid(), compile.getGroupNum(), compile.getFatherCfgId(), compile.getOpTime() });
|
||||
}
|
||||
// bsu.flush();
|
||||
return bsu;
|
||||
}
|
||||
|
||||
public static BatchSqlUpdate saveGroup(List<ConfigGroupRelation> groupList, DataSource ds, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_GROUP (ID,GROUP_ID, COMPILE_ID, IS_VALID, LAST_UPDATE, OP_TIME ) values ( seq_config_group.nextval, ?, ?, ?, sysdate, ?) ");
|
||||
BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.DATE });
|
||||
for (ConfigGroupRelation group : groupList) {
|
||||
bsu.update(
|
||||
new Object[] { group.getGroupId(), group.getCompileId(), group.getIsValid(), group.getOpTime() });
|
||||
}
|
||||
// bsu.flush();
|
||||
return bsu;
|
||||
}
|
||||
|
||||
public static BatchSqlUpdate saveIPRegion(String name, List<IpRegion> ipRegionList, DataSource ds, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT, DST_IP, MASK_DST_IP, DST_PORT, MASK_DST_PORT, PROTOCOL, DIRECTION, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
||||
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.DATE });
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
bsu.update(new Object[] { ipRegion.getRegionId(), ipRegion.getGroupId(), ipRegion.getAddrType(),
|
||||
ipRegion.getSrcIp(), ipRegion.getMaskSrcIp(), ipRegion.getSrcPort(), ipRegion.getMaskSrcPort(),
|
||||
ipRegion.getDstIp(), ipRegion.getMaskDstIp(), ipRegion.getDstPort(), ipRegion.getMaskDstPort(),
|
||||
ipRegion.getProtocol(), ipRegion.getDirection(), ipRegion.getIsValid(), ipRegion.getOpTime()
|
||||
|
||||
});
|
||||
}
|
||||
// bsu.flush();
|
||||
return bsu;
|
||||
}
|
||||
|
||||
public static BatchSqlUpdate saveNumRegion(String name, List<NumRegion> numRegionList, DataSource ds,
|
||||
int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
" (REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE) values(?, ?, ?, ?, ?, ?, sysdate)");
|
||||
BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.DATE });
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
bsu.update(new Object[] { numRegion.getRegionId(), numRegion.getGroupId(), numRegion.getLowBoundary(),
|
||||
numRegion.getUpBoundary(), numRegion.getIsValid(), numRegion.getOpTime() });
|
||||
}
|
||||
// bsu.flush();
|
||||
return bsu;
|
||||
}
|
||||
|
||||
public static BatchSqlUpdate saveStrongStrRegion(String name, List<StrRegion> strRegionList, DataSource ds,
|
||||
int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, DISTRICT, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.INTEGER, Types.DATE });
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
bsu.update(new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), strRegion.getDistrict(),
|
||||
strRegion.getKeywords(), strRegion.getExprType(), strRegion.getMatchMethod(),
|
||||
strRegion.getIsHexbin(), strRegion.getIsValid(), strRegion.getOpTime() });
|
||||
}
|
||||
// bsu.flush();
|
||||
return bsu;
|
||||
}
|
||||
|
||||
public static BatchSqlUpdate saveStrRegion(String name, List<StrRegion> strRegionList, DataSource ds,
|
||||
int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.DATE });
|
||||
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
bsu.update(new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), strRegion.getKeywords(),
|
||||
strRegion.getExprType(), strRegion.getMatchMethod(), strRegion.getIsHexbin(),
|
||||
strRegion.getIsValid(), strRegion.getOpTime() });
|
||||
}
|
||||
// bsu.flush();
|
||||
return bsu;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Types;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.jdbc.object.BatchSqlUpdate;
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigGroupRelation;
|
||||
import com.nis.domain.restful.IpRegion;
|
||||
import com.nis.domain.restful.NumRegion;
|
||||
import com.nis.domain.restful.StrRegion;
|
||||
|
||||
/**
|
||||
* jdbc测试批量插入
|
||||
*
|
||||
* @author RenKaiGe-Office
|
||||
*
|
||||
*/
|
||||
public class SpringJDBCThreadTest implements Runnable {
|
||||
private CountDownLatch latch;
|
||||
private Boolean isStrongStr;
|
||||
private String tableName;
|
||||
private int batchSize;
|
||||
private BatchSqlUpdate bsu;
|
||||
private List<ConfigCompile> compileList;
|
||||
private List<ConfigGroupRelation> groupList;
|
||||
private List<IpRegion> ipRegionList;
|
||||
private List<NumRegion> numRegionList;
|
||||
private List<StrRegion> strRegionList;
|
||||
|
||||
public SpringJDBCThreadTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SpringJDBCThreadTest(int batchSize, BatchSqlUpdate bsu, CountDownLatch latch) {
|
||||
super();
|
||||
this.batchSize = batchSize;
|
||||
this.bsu = bsu;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public SpringJDBCThreadTest(String tableName, int batchSize, BatchSqlUpdate bsu, CountDownLatch latch) {
|
||||
super();
|
||||
this.tableName = tableName;
|
||||
this.batchSize = batchSize;
|
||||
this.bsu = bsu;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public SpringJDBCThreadTest(boolean isStrongStr, String tableName, int batchSize, BatchSqlUpdate bsu,
|
||||
CountDownLatch latch) {
|
||||
super();
|
||||
this.isStrongStr = isStrongStr;
|
||||
this.tableName = tableName;
|
||||
this.batchSize = batchSize;
|
||||
this.bsu = bsu;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public int getBatchSize() {
|
||||
return batchSize;
|
||||
}
|
||||
|
||||
public void setBatchSize(int batchSize) {
|
||||
this.batchSize = batchSize;
|
||||
}
|
||||
|
||||
public BatchSqlUpdate getBsu() {
|
||||
return bsu;
|
||||
}
|
||||
|
||||
public void setBsu(BatchSqlUpdate bsu) {
|
||||
this.bsu = bsu;
|
||||
}
|
||||
|
||||
public CountDownLatch getLatch() {
|
||||
return latch;
|
||||
}
|
||||
|
||||
public void setLatch(CountDownLatch latch) {
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public Boolean getIsStrongStr() {
|
||||
return isStrongStr;
|
||||
}
|
||||
|
||||
public void setIsStrongStr(Boolean isStrongStr) {
|
||||
this.isStrongStr = isStrongStr;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public List<ConfigCompile> getCompileList() {
|
||||
return compileList;
|
||||
}
|
||||
|
||||
public void setCompileList(List<ConfigCompile> compileList) {
|
||||
this.compileList = compileList;
|
||||
}
|
||||
|
||||
public List<ConfigGroupRelation> getGroupList() {
|
||||
return groupList;
|
||||
}
|
||||
|
||||
public void setGroupList(List<ConfigGroupRelation> groupList) {
|
||||
this.groupList = groupList;
|
||||
}
|
||||
|
||||
public List<IpRegion> getIpRegionList() {
|
||||
return ipRegionList;
|
||||
}
|
||||
|
||||
public void setIpRegionList(List<IpRegion> ipRegionList) {
|
||||
this.ipRegionList = ipRegionList;
|
||||
}
|
||||
|
||||
public List<NumRegion> getNumRegionList() {
|
||||
return numRegionList;
|
||||
}
|
||||
|
||||
public void setNumRegionList(List<NumRegion> numRegionList) {
|
||||
this.numRegionList = numRegionList;
|
||||
}
|
||||
|
||||
public List<StrRegion> getStrRegionList() {
|
||||
return strRegionList;
|
||||
}
|
||||
|
||||
public void setStrRegionList(List<StrRegion> strRegionList) {
|
||||
this.strRegionList = strRegionList;
|
||||
}
|
||||
|
||||
public static void saveCompile(List<ConfigCompile> compileList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate)");
|
||||
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR,
|
||||
Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR,
|
||||
Types.INTEGER, Types.BIGINT, Types.INTEGER, Types.DATE, Types.DATE, Types.VARCHAR, Types.INTEGER,
|
||||
Types.INTEGER, Types.BIGINT, Types.DATE });
|
||||
for (ConfigCompile compile : compileList) {
|
||||
bsu.update(new Object[] { compile.getCompileId(), compile.getService(), compile.getAction(),
|
||||
compile.getContType(), compile.getAttrType(), compile.getContLabel(), compile.getTaskId(),
|
||||
compile.getGuaranteeId(), compile.getAffAirId(), compile.getTopIcId(), compile.getDoBlackList(),
|
||||
compile.getDoLog(), compile.getEffectiveRange(), compile.getActiveSys(), compile.getConfigPercent(),
|
||||
compile.getConfigOption(), compile.getStartTime(), compile.getEndTime(), compile.getUserRegion(),
|
||||
compile.getIsValid(), compile.getGroupNum(), compile.getFatherCfgId(), compile.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
public static void saveGroup(List<ConfigGroupRelation> groupList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_GROUP (ID,GROUP_ID, COMPILE_ID, IS_VALID, LAST_UPDATE, OP_TIME ) values ( seq_config_group.nextval, ?, ?, ?, sysdate, ?) ");
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.DATE });
|
||||
for (ConfigGroupRelation group : groupList) {
|
||||
bsu.update(
|
||||
new Object[] { group.getGroupId(), group.getCompileId(), group.getIsValid(), group.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
|
||||
}
|
||||
|
||||
public static void saveIPRegion(String name, List<IpRegion> ipRegionList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT, DST_IP, MASK_DST_IP, DST_PORT, MASK_DST_PORT, PROTOCOL, DIRECTION, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
||||
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.DATE });
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
bsu.update(new Object[] { ipRegion.getRegionId(), ipRegion.getGroupId(), ipRegion.getAddrType(),
|
||||
ipRegion.getSrcIp(), ipRegion.getMaskSrcIp(), ipRegion.getSrcPort(), ipRegion.getMaskSrcPort(),
|
||||
ipRegion.getDstIp(), ipRegion.getMaskDstIp(), ipRegion.getDstPort(), ipRegion.getMaskDstPort(),
|
||||
ipRegion.getProtocol(), ipRegion.getDirection(), ipRegion.getIsValid(), ipRegion.getOpTime()
|
||||
|
||||
});
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
public static void saveNumRegion(String name, List<NumRegion> numRegionList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
" (REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE) values(?, ?, ?, ?, ?, ?, sysdate)");
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.DATE });
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
bsu.update(new Object[] { numRegion.getRegionId(), numRegion.getGroupId(), numRegion.getLowBoundary(),
|
||||
numRegion.getUpBoundary(), numRegion.getIsValid(), numRegion.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
public static void saveStrongStrRegion(String name, List<StrRegion> strRegionList, BatchSqlUpdate bsu,
|
||||
int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, DISTRICT, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.INTEGER, Types.DATE });
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
bsu.update(new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), strRegion.getDistrict(),
|
||||
strRegion.getKeywords(), strRegion.getExprType(), strRegion.getMatchMethod(),
|
||||
strRegion.getIsHexbin(), strRegion.getIsValid(), strRegion.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
public static void saveStrRegion(String name, List<StrRegion> strRegionList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.DATE });
|
||||
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
bsu.update(new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), strRegion.getKeywords(),
|
||||
strRegion.getExprType(), strRegion.getMatchMethod(), strRegion.getIsHexbin(),
|
||||
strRegion.getIsValid(), strRegion.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (null != compileList && compileList.size() > 0) {
|
||||
saveCompile(compileList, bsu, batchSize);
|
||||
} else if (null != groupList && groupList.size() > 0) {
|
||||
saveGroup(groupList, bsu, batchSize);
|
||||
} else if (null != ipRegionList && ipRegionList.size() > 0) {
|
||||
saveIPRegion(tableName, ipRegionList, bsu, batchSize);
|
||||
} else if (null != strRegionList && strRegionList.size() > 0) {
|
||||
if (null != isStrongStr && isStrongStr) {
|
||||
saveStrongStrRegion(tableName, strRegionList, bsu, batchSize);
|
||||
} else {
|
||||
saveStrRegion(tableName, strRegionList, bsu, batchSize);
|
||||
}
|
||||
} else if (null != numRegionList && numRegionList.size() > 0) {
|
||||
saveNumRegion(tableName, numRegionList, bsu, batchSize);
|
||||
}
|
||||
latch.countDown();
|
||||
System.out.println("SpringJDBC--latchCount=======================" + latch.getCount());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Types;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.jdbc.object.BatchSqlUpdate;
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigGroupRelation;
|
||||
import com.nis.domain.restful.IpRegion;
|
||||
import com.nis.domain.restful.NumRegion;
|
||||
import com.nis.domain.restful.StrRegion;
|
||||
|
||||
/**
|
||||
* jdbc测试批量插入
|
||||
*
|
||||
* @author RenKaiGe-Office
|
||||
*
|
||||
*/
|
||||
public class SpringJDBCThreadTest2 implements Runnable {
|
||||
private CountDownLatch latch;
|
||||
private Boolean isStrongStr;
|
||||
private String tableName;
|
||||
private int batchSize;
|
||||
private BatchSqlUpdate bsu;
|
||||
private List<ConfigCompile> compileList;
|
||||
private List<ConfigGroupRelation> groupList;
|
||||
private List<IpRegion> ipRegionList;
|
||||
private List<NumRegion> numRegionList;
|
||||
private List<StrRegion> strRegionList;
|
||||
|
||||
public SpringJDBCThreadTest2() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SpringJDBCThreadTest2(int batchSize, BatchSqlUpdate bsu, CountDownLatch latch) {
|
||||
super();
|
||||
this.batchSize = batchSize;
|
||||
this.bsu = bsu;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public SpringJDBCThreadTest2(String tableName, int batchSize, BatchSqlUpdate bsu, CountDownLatch latch) {
|
||||
super();
|
||||
this.tableName = tableName;
|
||||
this.batchSize = batchSize;
|
||||
this.bsu = bsu;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public SpringJDBCThreadTest2(boolean isStrongStr, String tableName, int batchSize, BatchSqlUpdate bsu,
|
||||
CountDownLatch latch) {
|
||||
super();
|
||||
this.isStrongStr = isStrongStr;
|
||||
this.tableName = tableName;
|
||||
this.batchSize = batchSize;
|
||||
this.bsu = bsu;
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public int getBatchSize() {
|
||||
return batchSize;
|
||||
}
|
||||
|
||||
public void setBatchSize(int batchSize) {
|
||||
this.batchSize = batchSize;
|
||||
}
|
||||
|
||||
public BatchSqlUpdate getBsu() {
|
||||
return bsu;
|
||||
}
|
||||
|
||||
public void setBsu(BatchSqlUpdate bsu) {
|
||||
this.bsu = bsu;
|
||||
}
|
||||
|
||||
public CountDownLatch getLatch() {
|
||||
return latch;
|
||||
}
|
||||
|
||||
public void setLatch(CountDownLatch latch) {
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public Boolean getIsStrongStr() {
|
||||
return isStrongStr;
|
||||
}
|
||||
|
||||
public void setIsStrongStr(Boolean isStrongStr) {
|
||||
this.isStrongStr = isStrongStr;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public List<ConfigCompile> getCompileList() {
|
||||
return compileList;
|
||||
}
|
||||
|
||||
public void setCompileList(List<ConfigCompile> compileList) {
|
||||
this.compileList = compileList;
|
||||
}
|
||||
|
||||
public List<ConfigGroupRelation> getGroupList() {
|
||||
return groupList;
|
||||
}
|
||||
|
||||
public void setGroupList(List<ConfigGroupRelation> groupList) {
|
||||
this.groupList = groupList;
|
||||
}
|
||||
|
||||
public List<IpRegion> getIpRegionList() {
|
||||
return ipRegionList;
|
||||
}
|
||||
|
||||
public void setIpRegionList(List<IpRegion> ipRegionList) {
|
||||
this.ipRegionList = ipRegionList;
|
||||
}
|
||||
|
||||
public List<NumRegion> getNumRegionList() {
|
||||
return numRegionList;
|
||||
}
|
||||
|
||||
public void setNumRegionList(List<NumRegion> numRegionList) {
|
||||
this.numRegionList = numRegionList;
|
||||
}
|
||||
|
||||
public List<StrRegion> getStrRegionList() {
|
||||
return strRegionList;
|
||||
}
|
||||
|
||||
public void setStrRegionList(List<StrRegion> strRegionList) {
|
||||
this.strRegionList = strRegionList;
|
||||
}
|
||||
|
||||
public static void saveCompile(List<ConfigCompile> compileList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_COMPILE (COMPILE_ID ,SERVICE ,ACTION , CONT_TYPE, ATTR_TYPE, CONT_LABEL, Task_id, Guarantee_ID, AFFAIR_ID, TOPIC_ID, DO_BLACKLIST ,DO_LOG ,EFFECTIVE_RANGE , ACTIVE_SYS, CONFIG_PERCENT ,CONFIG_OPTION ,START_TIME ,END_TIME , USER_REGION, IS_VALID,GROUP_NUM,FATHER_CFG_ID ,OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate)");
|
||||
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR,
|
||||
Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR,
|
||||
Types.INTEGER, Types.BIGINT, Types.INTEGER, Types.DATE, Types.DATE, Types.VARCHAR, Types.INTEGER,
|
||||
Types.INTEGER, Types.BIGINT, Types.DATE });
|
||||
for (ConfigCompile compile : compileList) {
|
||||
bsu.update(new Object[] { compile.getCompileId(), compile.getService(), compile.getAction(),
|
||||
compile.getContType(), compile.getAttrType(), compile.getContLabel(), compile.getTaskId(),
|
||||
compile.getGuaranteeId(), compile.getAffAirId(), compile.getTopIcId(), compile.getDoBlackList(),
|
||||
compile.getDoLog(), compile.getEffectiveRange(), compile.getActiveSys(), compile.getConfigPercent(),
|
||||
compile.getConfigOption(), compile.getStartTime(), compile.getEndTime(), compile.getUserRegion(),
|
||||
compile.getIsValid(), compile.getGroupNum(), compile.getFatherCfgId(), compile.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
public static void saveGroup(List<ConfigGroupRelation> groupList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(
|
||||
"insert into CONFIG_GROUP (ID,GROUP_ID, COMPILE_ID, IS_VALID, LAST_UPDATE, OP_TIME ) values ( seq_config_group.nextval, ?, ?, ?, sysdate, ?) ");
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.DATE });
|
||||
for (ConfigGroupRelation group : groupList) {
|
||||
bsu.update(
|
||||
new Object[] { group.getGroupId(), group.getCompileId(), group.getIsValid(), group.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
|
||||
}
|
||||
|
||||
public static void saveIPRegion(String name, List<IpRegion> ipRegionList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, ADDR_TYPE, SRC_IP, MASK_SRC_IP, SRC_PORT, MASK_SRC_PORT, DST_IP, MASK_DST_IP, DST_PORT, MASK_DST_PORT, PROTOCOL, DIRECTION, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
||||
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.DATE });
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
bsu.update(new Object[] { ipRegion.getRegionId(), ipRegion.getGroupId(), ipRegion.getAddrType(),
|
||||
ipRegion.getSrcIp(), ipRegion.getMaskSrcIp(), ipRegion.getSrcPort(), ipRegion.getMaskSrcPort(),
|
||||
ipRegion.getDstIp(), ipRegion.getMaskDstIp(), ipRegion.getDstPort(), ipRegion.getMaskDstPort(),
|
||||
ipRegion.getProtocol(), ipRegion.getDirection(), ipRegion.getIsValid(), ipRegion.getOpTime()
|
||||
|
||||
});
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
public static void saveNumRegion(String name, List<NumRegion> numRegionList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
" (REGION_ID,GROUP_ID,LOW_BOUNDARY,UP_BOUNDARY,IS_VALID,OP_TIME,LAST_UPDATE) values(?, ?, ?, ?, ?, ?, sysdate)");
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.BIGINT, Types.INTEGER, Types.DATE });
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
bsu.update(new Object[] { numRegion.getRegionId(), numRegion.getGroupId(), numRegion.getLowBoundary(),
|
||||
numRegion.getUpBoundary(), numRegion.getIsValid(), numRegion.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
public static void saveStrongStrRegion(String name, List<StrRegion> strRegionList, BatchSqlUpdate bsu,
|
||||
int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, DISTRICT, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values(?, ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.INTEGER, Types.DATE });
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
bsu.update(new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), strRegion.getDistrict(),
|
||||
strRegion.getKeywords(), strRegion.getExprType(), strRegion.getMatchMethod(),
|
||||
strRegion.getIsHexbin(), strRegion.getIsValid(), strRegion.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
public static void saveStrRegion(String name, List<StrRegion> strRegionList, BatchSqlUpdate bsu, int batchSize) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("insert into ");
|
||||
sb.append(name);
|
||||
sb.append(
|
||||
"(REGION_ID, GROUP_ID, KEYWORDS, EXPR_TYPE, MATCH_METHOD , IS_HEXBIN, IS_VALID, OP_TIME,LAST_UPDATE ) values( ?, ?, ?, ?, ?, ?, ?, ?, sysdate) ");
|
||||
|
||||
// BatchSqlUpdate bsu = new BatchSqlUpdate(ds, sb.toString());
|
||||
bsu.setSql(sb.toString());
|
||||
bsu.setBatchSize(batchSize);
|
||||
bsu.setTypes(new int[] { Types.BIGINT, Types.BIGINT, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER,
|
||||
Types.INTEGER, Types.DATE });
|
||||
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
bsu.update(new Object[] { strRegion.getRegionId(), strRegion.getGroupId(), strRegion.getKeywords(),
|
||||
strRegion.getExprType(), strRegion.getMatchMethod(), strRegion.getIsHexbin(),
|
||||
strRegion.getIsValid(), strRegion.getOpTime() });
|
||||
}
|
||||
bsu.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (null != compileList && compileList.size() > 0) {
|
||||
saveCompile(compileList, bsu, batchSize);
|
||||
} else if (null != groupList && groupList.size() > 0) {
|
||||
saveGroup(groupList, bsu, batchSize);
|
||||
} else if (null != ipRegionList && ipRegionList.size() > 0) {
|
||||
saveIPRegion(tableName, ipRegionList, bsu, batchSize);
|
||||
} else if (null != strRegionList && strRegionList.size() > 0) {
|
||||
if (null != isStrongStr && isStrongStr) {
|
||||
saveStrongStrRegion(tableName, strRegionList, bsu, batchSize);
|
||||
} else {
|
||||
saveStrRegion(tableName, strRegionList, bsu, batchSize);
|
||||
}
|
||||
} else if (null != numRegionList && numRegionList.size() > 0) {
|
||||
saveNumRegion(tableName, numRegionList, bsu, batchSize);
|
||||
}
|
||||
latch.countDown();
|
||||
System.out.println("SpringJDBC--latchCount=======================" + latch.getCount());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.restful.SystemFunStatus;
|
||||
import com.nis.web.dao.SystemFunStatusDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
@Service
|
||||
public class SystemFunStatusService extends CrudService<SystemFunStatusDao, SystemFunStatus> {
|
||||
|
||||
@Autowired
|
||||
public SystemFunStatusDao systemFunStatusDao;
|
||||
|
||||
public void saveSystemFunStatusBatch(List<SystemFunStatus> entity) {
|
||||
super.saveBatch(entity, SystemFunStatusDao.class);
|
||||
}
|
||||
|
||||
public void updateSystemFunStatusBatch(List<SystemFunStatus> entity) {
|
||||
super.updateBatch(entity, SystemFunStatusDao.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,463 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.nis.domain.restful.ConfigCompile;
|
||||
import com.nis.domain.restful.ConfigGroupRelation;
|
||||
import com.nis.domain.restful.IpRegion;
|
||||
import com.nis.domain.restful.NumRegion;
|
||||
import com.nis.domain.restful.StrRegion;
|
||||
import com.nis.util.Configurations;
|
||||
|
||||
/**
|
||||
* jdbc测试批量插入
|
||||
*
|
||||
* @author RenKaiGe-Office
|
||||
*
|
||||
*/
|
||||
public class UpdateCompileByJDBCThread implements Runnable {
|
||||
private static Logger logger = Logger.getLogger(SaveCompileByJDBCThread.class);
|
||||
private static Long start;
|
||||
private CountDownLatch latch;
|
||||
private String tableName;
|
||||
private Connection conn;
|
||||
private List<ConfigCompile> compileList;
|
||||
private List<ConfigGroupRelation> groupList;
|
||||
private List<IpRegion> ipRegionList;
|
||||
private List<NumRegion> numRegionList;
|
||||
private List<StrRegion> strRegionList;
|
||||
private Date opTime;
|
||||
|
||||
public UpdateCompileByJDBCThread() {
|
||||
super();
|
||||
}
|
||||
|
||||
public UpdateCompileByJDBCThread(Connection conn, CountDownLatch latch, Long start, Date opTime) {
|
||||
super();
|
||||
this.conn = conn;
|
||||
this.latch = latch;
|
||||
this.start = start;
|
||||
this.opTime = opTime;
|
||||
}
|
||||
|
||||
public UpdateCompileByJDBCThread(String tableName, Connection conn, CountDownLatch latch, Long start, Date opTime) {
|
||||
super();
|
||||
this.tableName = tableName;
|
||||
this.conn = conn;
|
||||
this.latch = latch;
|
||||
this.start = start;
|
||||
this.opTime = opTime;
|
||||
}
|
||||
|
||||
public Date getOpTime() {
|
||||
return opTime;
|
||||
}
|
||||
|
||||
public void setOpTime(Date opTime) {
|
||||
this.opTime = opTime;
|
||||
}
|
||||
|
||||
public Long getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
public void setStart(Long start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public CountDownLatch getLatch() {
|
||||
return latch;
|
||||
}
|
||||
|
||||
public void setLatch(CountDownLatch latch) {
|
||||
this.latch = latch;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
public Connection getConn() {
|
||||
return conn;
|
||||
}
|
||||
|
||||
public void setConn(Connection conn) {
|
||||
this.conn = conn;
|
||||
}
|
||||
|
||||
public List<ConfigCompile> getCompileList() {
|
||||
return compileList;
|
||||
}
|
||||
|
||||
public void setCompileList(List<ConfigCompile> compileList) {
|
||||
this.compileList = compileList;
|
||||
}
|
||||
|
||||
public List<ConfigGroupRelation> getGroupList() {
|
||||
return groupList;
|
||||
}
|
||||
|
||||
public void setGroupList(List<ConfigGroupRelation> groupList) {
|
||||
this.groupList = groupList;
|
||||
}
|
||||
|
||||
public List<IpRegion> getIpRegionList() {
|
||||
return ipRegionList;
|
||||
}
|
||||
|
||||
public void setIpRegionList(List<IpRegion> ipRegionList) {
|
||||
this.ipRegionList = ipRegionList;
|
||||
}
|
||||
|
||||
public List<NumRegion> getNumRegionList() {
|
||||
return numRegionList;
|
||||
}
|
||||
|
||||
public void setNumRegionList(List<NumRegion> numRegionList) {
|
||||
this.numRegionList = numRegionList;
|
||||
}
|
||||
|
||||
public List<StrRegion> getStrRegionList() {
|
||||
return strRegionList;
|
||||
}
|
||||
|
||||
public void setStrRegionList(List<StrRegion> strRegionList) {
|
||||
this.strRegionList = strRegionList;
|
||||
}
|
||||
|
||||
public synchronized static java.sql.Timestamp utileDate2TimeStamp(java.util.Date udate) {
|
||||
java.sql.Timestamp sqlDate = null;
|
||||
long t = udate.getTime();
|
||||
sqlDate = new java.sql.Timestamp(t);
|
||||
return sqlDate;
|
||||
|
||||
}
|
||||
|
||||
public static void updateCompile(List<ConfigCompile> compileList, Connection conn, Date opTime,
|
||||
List<Exception> msgList) {
|
||||
if (null != compileList && compileList.size() > 0) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String tabName = Configurations.getStringProperty("compileTabName", "CONFIG_COMPILE");
|
||||
String fieldName = Configurations.getStringProperty("updateFields", "IS_VALID");
|
||||
String condition= Configurations.getStringProperty("compileUpdateCondition", "COMPILE_ID");
|
||||
sb.append("update ").append(tabName).append(" set ");
|
||||
|
||||
String fieldNameObj [] = fieldName.split(",");
|
||||
//加上where条件的参数名称
|
||||
String newParamsStr = fieldName+","+condition;
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
sb.append(fieldNameObj[i]+"=?");
|
||||
if (i+1<fieldNameObj.length) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", LAST_UPDATE= sysdate");
|
||||
}
|
||||
sb.append(" where ");
|
||||
String [] condObjs = condition.split(",");
|
||||
for (int i = 0; i < condObjs.length; i++) {
|
||||
sb.append(condObjs[i]+"=?");
|
||||
if (i+1<condObjs.length) {
|
||||
sb.append(" and ");
|
||||
}
|
||||
}
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
|
||||
|
||||
for (ConfigCompile compile : compileList) {
|
||||
setPsParams(newParamsStr.split(","),ps,compile);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateGroup(List<ConfigGroupRelation> groupList, Connection conn, Date opTime,
|
||||
List<Exception> msgList) {
|
||||
if (null != groupList && groupList.size() > 0) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
String tabName = Configurations.getStringProperty("groupTabName", "CONFIG_GROUP");
|
||||
String fieldName = Configurations.getStringProperty("updateFields", "IS_VALID");
|
||||
String condition = Configurations.getStringProperty("groupUpdateCondition", "GROUP_ID");
|
||||
|
||||
sb.append(" update ").append(tabName);
|
||||
sb.append(" set ");
|
||||
String fieldNameObj [] = fieldName.split(",");
|
||||
//加上where条件的参数名称
|
||||
String newParamsStr = fieldName+","+condition;
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
sb.append(fieldNameObj[i]+"=?");
|
||||
if (i+1<fieldNameObj.length) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", LAST_UPDATE= sysdate");
|
||||
}
|
||||
// + "where GROUP_ID=? and COMPILE_ID=? ");
|
||||
sb.append(" where ");
|
||||
String [] condObjs = condition.split(",");
|
||||
for (int i = 0; i < condObjs.length; i++) {
|
||||
sb.append(condObjs[i]+"=?");
|
||||
if (i+1<condObjs.length) {
|
||||
sb.append(" and ");
|
||||
}
|
||||
}
|
||||
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
for (ConfigGroupRelation group : groupList) {
|
||||
setPsParams(newParamsStr.split(","), ps, group);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateIPRegion(String name, List<IpRegion> ipRegionList, Connection conn, Date opTime,
|
||||
List<Exception> msgList) {
|
||||
if (null != ipRegionList && ipRegionList.size() > 0) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
|
||||
String fieldName = Configurations.getStringProperty("updateFields", "IS_VALID");
|
||||
String condition = Configurations.getStringProperty("regionId", "REGION_ID");
|
||||
sb.append("update ");
|
||||
sb.append(name);
|
||||
sb.append(" set ");
|
||||
|
||||
String fieldNameObj [] = fieldName.split(",");
|
||||
//加上where条件的参数名称
|
||||
String newParamsStr = fieldName+","+condition;
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
sb.append(fieldNameObj[i]+"=?");
|
||||
if (i+1<fieldNameObj.length) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", LAST_UPDATE= sysdate");
|
||||
}
|
||||
// + "where GROUP_ID=? and COMPILE_ID=? ");
|
||||
sb.append(" where ");
|
||||
String [] condObjs = condition.split(",");
|
||||
for (int i = 0; i < condObjs.length; i++) {
|
||||
sb.append(condObjs[i]+"=?");
|
||||
if (i+1<condObjs.length) {
|
||||
sb.append(" and ");
|
||||
}
|
||||
}
|
||||
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
setPsParams(newParamsStr.split(","), ps, ipRegion);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateNumRegion(String name, List<NumRegion> numRegionList, Connection conn, Date opTime,
|
||||
List<Exception> msgList) {
|
||||
if (null != numRegionList && numRegionList.size() > 0) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String fieldName = Configurations.getStringProperty("updateFields", "IS_VALID");
|
||||
String condition = Configurations.getStringProperty("regionId", "REGION_ID");
|
||||
sb.append("update ");
|
||||
sb.append(name);
|
||||
sb.append(" set ");
|
||||
|
||||
String fieldNameObj [] = fieldName.split(",");
|
||||
//加上where条件的参数名称
|
||||
String newParamsStr = fieldName+","+condition;
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
sb.append(fieldNameObj[i]+"=?");
|
||||
if (i+1<fieldNameObj.length) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", LAST_UPDATE= sysdate");
|
||||
}
|
||||
// + "where GROUP_ID=? and COMPILE_ID=? ");
|
||||
sb.append(" where ");
|
||||
String [] condObjs = condition.split(",");
|
||||
for (int i = 0; i < condObjs.length; i++) {
|
||||
sb.append(condObjs[i]+"=?");
|
||||
if (i+1<condObjs.length) {
|
||||
sb.append(" and ");
|
||||
}
|
||||
}
|
||||
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
setPsParams(newParamsStr.split(","), ps, numRegion);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateStrRegion(String name, List<StrRegion> strRegionList, Connection conn, Date opTime,
|
||||
List<Exception> msgList) {
|
||||
if (null != strRegionList && strRegionList.size() > 0) {
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String fieldName = Configurations.getStringProperty("updateFields", "IS_VALID");
|
||||
String condition = Configurations.getStringProperty("regionId", "REGION_ID");
|
||||
sb.append("update ");
|
||||
sb.append(name);
|
||||
sb.append(" set ");
|
||||
|
||||
String fieldNameObj [] = fieldName.split(",");
|
||||
//加上where条件的参数名称
|
||||
String newParamsStr = fieldName+","+condition;
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
sb.append(fieldNameObj[i]+"=?");
|
||||
if (i+1<fieldNameObj.length) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
//是否包含更新时间字段 值为数据库当前时间
|
||||
if (Configurations.getBooleanProperty("hasLastUpdate", true)) {
|
||||
sb.append(", LAST_UPDATE= sysdate");
|
||||
}
|
||||
// + "where GROUP_ID=? and COMPILE_ID=? ");
|
||||
sb.append(" where ");
|
||||
String [] condObjs = condition.split(",");
|
||||
for (int i = 0; i < condObjs.length; i++) {
|
||||
sb.append(condObjs[i]+"=?");
|
||||
if (i+1<condObjs.length) {
|
||||
sb.append(" and ");
|
||||
}
|
||||
}
|
||||
|
||||
conn.setAutoCommit(false);
|
||||
PreparedStatement ps = conn.prepareStatement(sb.toString());
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
setPsParams(newParamsStr.split(","), ps, strRegion);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
msgList.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @Description: 向PreparedStatement设置参数
|
||||
* @author (zdx)
|
||||
* @date 2017年10月26日 上午9:47:33
|
||||
* @param fieldNameObj
|
||||
* @param ps
|
||||
* @param object
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void setPsParams(String [] fieldNameObj,PreparedStatement ps,Object object) throws Exception{
|
||||
Object[] obj = new Object[fieldNameObj.length] ;
|
||||
|
||||
for (int i = 0; i < fieldNameObj.length; i++) {
|
||||
String name = fieldNameObj[i].toLowerCase().trim();
|
||||
name = name.substring(0,1).toUpperCase()+name.substring(1);
|
||||
if (name.indexOf("_")>-1) {
|
||||
// name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2);
|
||||
// }
|
||||
|
||||
while (name.indexOf("_")>-1) {
|
||||
name = name.substring(0, name.indexOf("_"))+name.substring(name.indexOf("_")+1,name.indexOf("_")+2).toUpperCase()+name.substring(name.indexOf("_")+2);
|
||||
}
|
||||
}
|
||||
|
||||
//需要特殊处理字段名
|
||||
if (name.equals("DoBlacklist")) {
|
||||
name = "DoBlackList";
|
||||
}else if (name.equals("AffairId")) {
|
||||
name = "AffAirId";
|
||||
}else if (name.equals("TopicId")) {
|
||||
name = "TopIcId";
|
||||
}
|
||||
|
||||
Method method = object.getClass().getMethod("get"+name);
|
||||
obj[i]= method.invoke(object);
|
||||
}
|
||||
for (int x = 0; x < obj.length; x++) {
|
||||
|
||||
if (obj[x] instanceof Date) {
|
||||
ps.setObject(x + 1, utileDate2TimeStamp((Date) obj[x]));
|
||||
}else {
|
||||
ps.setObject(x + 1, obj[x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
List<Exception> msgList = ConfigSourcesService.getMsgList();
|
||||
synchronized (msgList) {
|
||||
try {
|
||||
if (null != compileList && compileList.size() > 0) {
|
||||
updateCompile(compileList, conn, opTime, msgList);
|
||||
} else if (null != groupList && groupList.size() > 0) {
|
||||
updateGroup(groupList, conn, opTime, msgList);
|
||||
} else if (null != ipRegionList && ipRegionList.size() > 0) {
|
||||
updateIPRegion(tableName, ipRegionList, conn, opTime, msgList);
|
||||
} else if (null != strRegionList && strRegionList.size() > 0) {
|
||||
updateStrRegion(tableName, strRegionList, conn, opTime, msgList);
|
||||
} else if (null != numRegionList && numRegionList.size() > 0) {
|
||||
updateNumRegion(tableName, numRegionList, conn, opTime, msgList);
|
||||
}
|
||||
latch.countDown();
|
||||
// System.out.println("latchCount=======================" +
|
||||
// latch.getCount());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
*@Title: DmbCkService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful.jk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.restful.jk.JkDmbCk;
|
||||
import com.nis.web.dao.jk.JkDmbCkDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: DmbCkService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JkDmbCkService extends CrudService<JkDmbCkDao, JkDmbCk> {
|
||||
@Autowired
|
||||
public JkDmbCkDao jkDmbCkDao;
|
||||
|
||||
public JkDmbCk findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveDmbCkBatch(List<JkDmbCk> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,JkDmbCkDao.class);
|
||||
}
|
||||
public void updateDmbCkBatch(List<JkDmbCk> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, JkDmbCkDao.class);
|
||||
}
|
||||
|
||||
public void removeDmbCk(long id) {
|
||||
jkDmbCkDao.delete(id);
|
||||
}
|
||||
public void removeDmbCkBatch(List<JkDmbCk> entity) {
|
||||
super.deleteBatch(entity, JkDmbCkDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
*@Title: JkFdZbService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful.jk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.jk.JkFdZb;
|
||||
import com.nis.web.dao.jk.JkFdZbDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: JkFdZbService.java
|
||||
* @Description: TODO
|
||||
* @author (DDM)
|
||||
* @date 2016年10月19日 下午21:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JkFdZbService extends CrudService<JkFdZbDao, JkFdZb> {
|
||||
@Autowired
|
||||
public JkFdZbDao dmbCkDao;
|
||||
public Page<JkFdZb> getJkFdZb(Page<JkFdZb> page, JkFdZb entity) {
|
||||
return findPage(page, entity);
|
||||
}
|
||||
|
||||
public JkFdZb findById(long zbId) {
|
||||
return get(zbId);
|
||||
}
|
||||
public void saveJkFdZbBatch(List<JkFdZb> entity) {
|
||||
super.saveBatch(entity,JkFdZbDao.class);
|
||||
}
|
||||
public void updateJkFdZbBatch(List<JkFdZb> entity) {
|
||||
super.updateBatch(entity, JkFdZbDao.class);
|
||||
}
|
||||
public void removeJkFdZb(long zbId) {
|
||||
dmbCkDao.delete(zbId);
|
||||
}
|
||||
public void removeJkFdZbBatch(List<JkFdZb> entity) {
|
||||
super.deleteBatch(entity, JkFdZbDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
*@Title: JkFfjInfoService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author (zbc)
|
||||
*@date 2016年10月19日 下午20:04:16
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful.jk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.jk.JkFdZb;
|
||||
import com.nis.domain.restful.jk.JkFfjInfo;
|
||||
import com.nis.web.dao.jk.JkFdZbDao;
|
||||
import com.nis.web.dao.jk.JkFfjInfoDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: JkFfjInfoService.java
|
||||
* @Description: TODO
|
||||
* @author (zbc)
|
||||
* @date 2016年10月19日 下午20:04:16
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JkFfjInfoService extends CrudService<JkFfjInfoDao, JkFfjInfo> {
|
||||
|
||||
@Autowired
|
||||
public JkFfjInfoDao jkFfjInfoDao;
|
||||
|
||||
public void saveJkFfjBatch(List<JkFfjInfo> entity) {
|
||||
super.saveBatch(entity, JkFfjInfoDao.class);
|
||||
}
|
||||
|
||||
|
||||
public void updateJkFfjBatch(List<JkFfjInfo> entity) {
|
||||
super.updateBatch(entity, JkFfjInfoDao.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
*@Title: JkFfjInfoService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author (zbc)
|
||||
*@date 2016年10月19日 下午20:04:16
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful.jk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.restful.jk.JkFwqInfo;
|
||||
import com.nis.web.dao.jk.JkFwqInfoDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* @ClassName: JkFfjInfoService.java
|
||||
* @Description: TODO
|
||||
* @author (zbc)
|
||||
* @date 2016年10月19日 下午20:04:16
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JkFwqInfoService extends CrudService<JkFwqInfoDao, JkFwqInfo> {
|
||||
|
||||
@Autowired
|
||||
public JkFwqInfoDao jkFwqInfoDao;
|
||||
|
||||
public void savejkFwqInfoBatch(List<JkFwqInfo> entity) {
|
||||
super.saveBatch(entity, JkFwqInfoDao.class);
|
||||
}
|
||||
|
||||
|
||||
public void updatejkFwqInfoBatch(List<JkFwqInfo> entity) {
|
||||
super.updateBatch(entity, JkFwqInfoDao.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
*@Title: JkLyqService.java
|
||||
*@Package com.nis.web.service.restful
|
||||
*@Description TODO
|
||||
*@author wx
|
||||
*@date 2016年9月7日 下午3:28:44
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.web.service.restful.jk;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.restful.jk.JkLyq;
|
||||
import com.nis.web.dao.jk.JkLyqDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
|
||||
/**
|
||||
* @ClassName: JkLyqService.java
|
||||
* @Description: TODO
|
||||
* @author (wx)
|
||||
* @date 2016年9月7日 下午3:28:44
|
||||
* @version V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JkLyqService extends CrudService<JkLyqDao, JkLyq> {
|
||||
@Autowired
|
||||
public JkLyqDao jkLyqDao;
|
||||
|
||||
public JkLyq findById(long id) {
|
||||
return get(id);
|
||||
}
|
||||
public void saveJkLyqBatch(List<JkLyq> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.saveBatch(entity,JkLyqDao.class);
|
||||
}
|
||||
public void updateJkLyqBatch(List<JkLyq> entity) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateBatch(entity, JkLyqDao.class);
|
||||
}
|
||||
public void removeJkLyq(long id) {
|
||||
jkLyqDao.delete(id);
|
||||
}
|
||||
public void removeJkLyqBatch(List<JkLyq> entity) {
|
||||
super.deleteBatch(entity, JkLyqDao.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user