1.导入配置数据入库优化 2.修复VoIP配置 无IP域配置数据不显示BUG
This commit is contained in:
@@ -1772,63 +1772,91 @@ public class BaseController {
|
||||
}else if("BaseStringCfg".equals(type)) {
|
||||
List<BaseStringCfg<?>> listPage = (List<BaseStringCfg<?>>) list;
|
||||
// 调用对应配置的service
|
||||
// ip_payload
|
||||
if (regionDict.getDictId().intValue() == 167) {
|
||||
interceptCfgService.saveInterceptCfg(listPage);
|
||||
// interceptCfgService.saveInterceptCfg(listPage);
|
||||
interceptCfgService.saveStringCfgBatch(listPage, "intercept_pkt_bin");
|
||||
}
|
||||
// http url
|
||||
if (regionDict.getDictId().intValue() == 9||regionDict.getDictId().intValue() == 15 || regionDict.getDictId().intValue() == 596) {
|
||||
// websiteCfgService.saveHttpUrlCfg(listPage);
|
||||
websiteCfgService.saveStringCfgBatch(listPage, WebsiteCfgDao.class,"http_url_cfg");
|
||||
websiteCfgService.saveStringCfgBatch(listPage, "http_url_cfg");
|
||||
}
|
||||
// FTP url/content
|
||||
if (regionDict.getDictId().intValue() == 36||regionDict.getDictId().intValue() == 37) {
|
||||
fileTransferCfgService.saveFtpCfg(listPage);
|
||||
// fileTransferCfgService.saveFtpCfg(listPage);
|
||||
fileTransferCfgService.saveStringCfgBatch(listPage, "ftp_keyword_cfg");
|
||||
}
|
||||
if (regionDict.getFunctionId().equals(510)) { // P2p hash
|
||||
/*
|
||||
* if("p2p_hash".equals(regionDict.getConfigServiceType())) {
|
||||
* fileTransferCfgService.saveP2pHashCfg(stringCfgs); }else {
|
||||
*/
|
||||
fileTransferCfgService.saveP2pCfg(listPage);
|
||||
/* } */
|
||||
|
||||
// P2P eMule Keyword
|
||||
if(regionDict.getDictId().intValue() == 158){
|
||||
fileTransferCfgService.saveStringCfgBatch(listPage, "p2p_keyword_cfg");
|
||||
}
|
||||
// P2P File Marking
|
||||
if(regionDict.getDictId().intValue() == 159){
|
||||
// fileTransferCfgService.saveP2pCfg(listPage);
|
||||
fileTransferCfgService.saveStringCfgBatch(listPage, "p2p_hash_cfg");
|
||||
}
|
||||
// BGP AS
|
||||
if (regionDict.getFunctionId().equals(61)) {
|
||||
bgpCfgService.saveBgpAsCfg(listPage);
|
||||
// bgpCfgService.saveBgpAsCfg(listPage);
|
||||
bgpCfgService.saveStringCfgBatch(listPage, "ntc_bgp_as_cfg");
|
||||
}
|
||||
// SSL SNI/SAN/CN
|
||||
if (regionDict.getFunctionId().intValue() == 34) {
|
||||
websiteCfgService.saveSslCfg(listPage);
|
||||
// websiteCfgService.saveSslCfg(listPage);
|
||||
websiteCfgService.saveStringCfgBatch(listPage, "ssl_keyword_cfg");
|
||||
}
|
||||
// HTTP 请求/应答内容
|
||||
if(regionDict.getDictId().intValue()==12||regionDict.getDictId().intValue()==13||regionDict.getDictId().intValue()==601||regionDict.getDictId().intValue()==602) {
|
||||
websiteCfgService.saveHttpBodyCfg(listPage);
|
||||
// websiteCfgService.saveHttpBodyCfg(listPage);
|
||||
websiteCfgService.saveStringCfgBatch(listPage, "http_body_cfg");
|
||||
}
|
||||
// 流媒体协议
|
||||
if(regionDict.getDictId().intValue()==25){
|
||||
avContentCfgService.saveContUrlCfg(listPage);
|
||||
// avContentCfgService.saveContUrlCfg(listPage);
|
||||
avContentCfgService.saveStringCfgBatch(listPage, "av_cont_url_cfg");
|
||||
}
|
||||
// Voip Account
|
||||
if(regionDict.getDictId().intValue()==16){
|
||||
avContentCfgService.saveVoIpAccountCfg(listPage);
|
||||
// avContentCfgService.saveVoIpAccountCfg(listPage);
|
||||
avContentCfgService.saveStringCfgBatch(listPage, "av_voip_account_cfg");
|
||||
}
|
||||
// APP域名特征
|
||||
if(regionDict.getDictId().intValue()==64){
|
||||
appCfgService.saveAppDomainCfg(listPage);
|
||||
// appCfgService.saveAppDomainCfg(listPage);
|
||||
appCfgService.saveAppDomainCfgBatch(listPage);
|
||||
}
|
||||
}else if("ComplexkeywordCfg".equals(type)) {
|
||||
List<ComplexkeywordCfg> listPage = (List<ComplexkeywordCfg>) list;
|
||||
// DNS
|
||||
if (regionDict.getDictId().intValue() == 28) {
|
||||
websiteCfgService.saveDnsCfg(listPage);
|
||||
// websiteCfgService.saveDnsCfg(listPage);
|
||||
websiteCfgService.saveComplexkeywordCfgBatch(listPage, "dns_domain_cfg");
|
||||
}
|
||||
// Mail
|
||||
if (regionDict.getDictId().intValue() == 30 || regionDict.getDictId().intValue() == 31||regionDict.getDictId().intValue() == 599) {
|
||||
mailCfgService.saveMailCfg(listPage);
|
||||
// mailCfgService.saveMailCfg(listPage);
|
||||
mailCfgService.saveComplexkeywordCfgBatch(listPage, "mail_keyword_cfg");
|
||||
}
|
||||
// HTTP请求头域
|
||||
if(regionDict.getDictId().intValue()==10) {
|
||||
websiteCfgService.saveHttpReqHeadCfg(listPage);
|
||||
// websiteCfgService.saveHttpReqHeadCfg(listPage);
|
||||
websiteCfgService.saveComplexkeywordCfgBatch(listPage, "http_req_head_cfg");
|
||||
}
|
||||
// HTTP响应头域
|
||||
if(regionDict.getDictId().intValue()==11) {
|
||||
websiteCfgService.saveHttpResHeadCfg(listPage);
|
||||
// websiteCfgService.saveHttpResHeadCfg(listPage);
|
||||
websiteCfgService.saveComplexkeywordCfgBatch(listPage, "http_res_head_cfg");
|
||||
}
|
||||
// APP http特征
|
||||
if(regionDict.getDictId().intValue()==63) {
|
||||
appCfgService.saveAppHttpCfg(listPage);
|
||||
// appCfgService.saveAppHttpCfg(listPage);
|
||||
appCfgService.saveAppHttpCfgBatch(listPage);
|
||||
}
|
||||
}else if("DnsResStrategy".equals(type)) {
|
||||
List<DnsResStrategy> listPage = (List<DnsResStrategy>) list;
|
||||
dnsResStrategyService.saveDnsResStrategies(listPage);
|
||||
// dnsResStrategyService.saveDnsResStrategies(listPage);// dns_res_strategy
|
||||
dnsResStrategyService.saveDnsResStrategyCfgBatch(listPage);
|
||||
}
|
||||
}
|
||||
if (cfgIndexInfos != null && cfgIndexInfos.size() > 0) {
|
||||
|
||||
@@ -126,7 +126,7 @@ public class AvContentController extends BaseController {
|
||||
@RequestMapping(value = {"/voipList"})
|
||||
public String voipCfgList(Model model,HttpServletRequest request ,HttpServletResponse response ,@ModelAttribute("cfg")CfgIndexInfo entity
|
||||
,RedirectAttributes redirectAttributes){
|
||||
if(entity.getIpPort()== null){
|
||||
/*if(entity.getIpPort()== null){
|
||||
entity.setIpPort(new IpPortCfg());
|
||||
}
|
||||
if(entity.getVoipAccount()== null){
|
||||
@@ -134,7 +134,7 @@ public class AvContentController extends BaseController {
|
||||
}
|
||||
if(entity.getNtcSubscribeIdCfg()==null){
|
||||
entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg());
|
||||
}
|
||||
}*/
|
||||
Page<CfgIndexInfo> page = avContentCfgService.findPage(new Page<CfgIndexInfo>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
|
||||
@@ -100,4 +100,8 @@ public interface AppCfgDao {
|
||||
public List<WebsiteDomainTopic> getDomainDict(WebsiteDomainTopic websiteDomainTopic);
|
||||
public void saveDomainDict(WebsiteDomainTopic websiteDomainTopic);
|
||||
public List<AppIpCfg> getAppIpCfgBySpecServiceId(Integer specServiceId);
|
||||
|
||||
// 导入配置时数据批量入库使用
|
||||
public void insertAppDomainCfgBatch(AppDomainCfg cfg);
|
||||
public void insertAppHttpCfgBatch(AppHttpCfg cfg);
|
||||
}
|
||||
|
||||
@@ -1752,6 +1752,19 @@
|
||||
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertAppHttpCfgBatch" parameterType="com.nis.domain.configuration.AppHttpCfg" >
|
||||
insert into app_http_cfg (
|
||||
APP_CODE,BEHAV_CODE,SPEC_SERVICE_ID,CFG_DESC,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,RATELIMIT,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE,
|
||||
DISTRICT,CFG_KEYWORDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG
|
||||
)values (
|
||||
<include refid="AppCommonCfg_Value_List" />,
|
||||
#{district,jdbcType=VARCHAR},#{cfgKeywords,jdbcType=VARCHAR},
|
||||
#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertAppDomainCfg" parameterType="com.nis.domain.configuration.AppDomainCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
@@ -1768,6 +1781,19 @@
|
||||
#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertAppDomainCfgBatch" parameterType="com.nis.domain.configuration.AppDomainCfg" >
|
||||
insert into app_domain_cfg (
|
||||
APP_CODE,BEHAV_CODE,SPEC_SERVICE_ID,CFG_DESC,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,RATELIMIT,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE,
|
||||
DOMAIN,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG
|
||||
)values (
|
||||
<include refid="AppCommonCfg_Value_List" />,
|
||||
#{domain,jdbcType=VARCHAR},#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<!-- 主题网站新增 -->
|
||||
<insert id="insertAppTopicDomainCfg" parameterType="com.nis.domain.configuration.AppTopicDomainCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
|
||||
@@ -395,6 +395,15 @@
|
||||
</if>
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<if test="voipAccount != null">
|
||||
AND r.compile_id in (SELECT s.compile_id FROM av_voip_account_cfg s
|
||||
<where>
|
||||
<if test="voipAccount.cfgKeywords != null and voipAccount.cfgKeywords != ''">
|
||||
REPLACE(s.cfg_keywords,'***and***','|') LIKE concat(concat('%',#{voipAccount.cfgKeywords,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
@@ -48,4 +49,8 @@ public interface StringCfgDao extends CrudDao<BaseStringCfg>{
|
||||
public void saveSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg);
|
||||
public void updateSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg);
|
||||
public void deleteSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg);
|
||||
|
||||
// 导入配置时数据批量入库使用
|
||||
public void saveStringCfgBatch(BaseStringCfg cfg);
|
||||
public void saveComplexkeywordCfgBatch(ComplexkeywordCfg cfg);
|
||||
}
|
||||
|
||||
@@ -732,4 +732,128 @@
|
||||
</where>
|
||||
</delete>
|
||||
<!-- =====================NtcSubscribeIdCfg end======================== -->
|
||||
|
||||
<insert id="saveStringCfgBatch" parameterType="com.nis.domain.configuration.BaseStringCfg" >
|
||||
insert into ${tableName} (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
cfg_keywords,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{cfgKeywords,jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="saveComplexkeywordCfgBatch" parameterType="com.nis.domain.configuration.ComplexkeywordCfg" >
|
||||
insert into ${tableName} (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
district,
|
||||
cfg_keywords,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{district,jdbcType=VARCHAR},
|
||||
#{cfgKeywords,jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -67,6 +67,4 @@ public interface WebsiteCfgDao extends CrudDao<CfgIndexInfo>{
|
||||
public void deleteSslIpCfg(CfgIndexInfo entity);
|
||||
public void deleteSslKeywordCfg(CfgIndexInfo entity);
|
||||
|
||||
public void saveWebsiteCfgForBatch(BaseStringCfg cfg);
|
||||
|
||||
}
|
||||
|
||||
@@ -793,73 +793,8 @@
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<!-- insert http_url_cfg表信息 -->
|
||||
<insert id="saveWebsiteCfgForBatch" parameterType="com.nis.domain.configuration.BaseStringCfg" >
|
||||
insert into ${tableName} (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
IS_AUDIT,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
EDITOR_ID,
|
||||
EDIT_TIME,
|
||||
AUDITOR_ID,
|
||||
AUDIT_TIME,
|
||||
SERVICE_ID,
|
||||
REQUEST_ID,
|
||||
COMPILE_ID,
|
||||
IS_AREA_EFFECTIVE,
|
||||
CLASSIFY,
|
||||
ATTRIBUTE,
|
||||
LABLE,
|
||||
AREA_EFFECTIVE_IDS,
|
||||
function_id,
|
||||
cfg_keywords,
|
||||
cfg_type,
|
||||
cfg_region_code,
|
||||
expr_type,
|
||||
match_method,
|
||||
is_hexbin,
|
||||
user_region1,
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{editorId,jdbcType=INTEGER},
|
||||
#{editTime,jdbcType=TIMESTAMP},
|
||||
#{auditorId,jdbcType=INTEGER},
|
||||
#{auditTime,jdbcType=TIMESTAMP},
|
||||
#{serviceId,jdbcType=INTEGER},
|
||||
#{requestId,jdbcType=INTEGER},
|
||||
#{compileId,jdbcType=INTEGER},
|
||||
#{isAreaEffective,jdbcType=INTEGER},
|
||||
#{classify,jdbcType=VARCHAR},
|
||||
#{attribute,jdbcType=VARCHAR},
|
||||
#{lable,jdbcType=VARCHAR},
|
||||
#{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{cfgKeywords,jdbcType=VARCHAR},
|
||||
#{cfgType,jdbcType=VARCHAR},
|
||||
#{cfgRegionCode,jdbcType=INTEGER},
|
||||
#{exprType,jdbcType=INTEGER},
|
||||
#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER},
|
||||
#{userRegion1,jdbcType=VARCHAR},
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- insert http_url_cfg表信息 -->
|
||||
<insert id="saveHttpUrlCfg" parameterType="com.nis.domain.configuration.HttpUrlCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
|
||||
@@ -12,9 +12,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
@@ -44,6 +48,7 @@ import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCert;
|
||||
@@ -58,6 +63,7 @@ import com.nis.util.Constants;
|
||||
import com.nis.util.IpUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
|
||||
/**
|
||||
* Service基类
|
||||
@@ -1217,4 +1223,29 @@ public abstract class BaseService {
|
||||
logger.warn("convert data finish,cost:"+(end-start));
|
||||
return maatIpList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入配置时数据批量入库(字符串配置)
|
||||
* @param data
|
||||
* @param tableName
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveStringCfgBatch(List<BaseStringCfg<?>> data, String tableName) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
BaseStringCfg<?> cfg = data.get(index);
|
||||
cfg.setTableName(tableName);
|
||||
((StringCfgDao) batchSqlSession.getMapper(StringCfgDao.class)).saveStringCfgBatch(cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,18 @@ 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.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.dao.configuration.WebsiteCfgDao;
|
||||
|
||||
/**
|
||||
@@ -92,6 +95,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
public void delete(T entity) {
|
||||
dao.delete(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* saveBatch(批量全部保存数据)
|
||||
@@ -101,8 +105,8 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
* @author wx
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveBatch(List<T> data,@SuppressWarnings("rawtypes")Class mClass) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
@@ -126,17 +130,22 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public void saveStringCfgBatch(List<BaseStringCfg<?>> listPage,@SuppressWarnings("rawtypes")Class mClass, String tableName) {
|
||||
|
||||
/**
|
||||
* 导入配置时数据批量入库(增强字符串配置)
|
||||
* @param data
|
||||
* @param tableName
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveComplexkeywordCfgBatch(List<ComplexkeywordCfg> data, String tableName) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
//Object obj = mClass.newInstance();
|
||||
for(int index = 0; index < listPage.size();index++){
|
||||
BaseStringCfg<?> cfg = listPage.get(index);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
ComplexkeywordCfg cfg = data.get(index);
|
||||
cfg.setTableName(tableName);
|
||||
((WebsiteCfgDao) batchSqlSession.getMapper(mClass)).saveWebsiteCfgForBatch(cfg);
|
||||
((StringCfgDao) batchSqlSession.getMapper(StringCfgDao.class)).saveComplexkeywordCfgBatch(cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
|
||||
@@ -2127,4 +2127,52 @@ public class AppCfgService extends BaseService {
|
||||
appCfgDao.saveDomainDict(websiteDomainTopic);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入配置时数据批量入库
|
||||
* @param listPage
|
||||
*/
|
||||
public void saveAppDomainCfgBatch(List<BaseStringCfg<?>> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
BaseStringCfg<?> entity = data.get(index);
|
||||
AppDomainCfg cfg=new AppDomainCfg();
|
||||
BeanUtils.copyProperties(entity, cfg);
|
||||
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppDomainCfgBatch(cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入配置时数据批量入库
|
||||
* @param listPage
|
||||
*/
|
||||
public void saveAppHttpCfgBatch(List<ComplexkeywordCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
ComplexkeywordCfg entity = data.get(index);
|
||||
AppHttpCfg cfg=new AppHttpCfg();
|
||||
BeanUtils.copyProperties(entity, cfg);
|
||||
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppHttpCfgBatch(cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,20 +5,26 @@ 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 org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.NtcDnsResStrategy;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.DnsResStrategyDao;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
|
||||
|
||||
@@ -186,6 +192,28 @@ public class DnsResStrategyService extends BaseService{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入配置时数据批量入库
|
||||
* @param data
|
||||
*/
|
||||
public void saveDnsResStrategyCfgBatch(List<DnsResStrategy> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
DnsResStrategy cfg = data.get(index);
|
||||
((DnsResStrategyDao) batchSqlSession.getMapper(DnsResStrategyDao.class)).insert(cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user