Http Url导入配置入库优化.
This commit is contained in:
@@ -92,6 +92,7 @@ import com.nis.util.excel.CheckStringFormatThread;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportBigExcel;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.dao.configuration.WebsiteCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.ArchiveServcie;
|
||||
import com.nis.web.service.AreaService;
|
||||
@@ -1795,7 +1796,8 @@ public class BaseController {
|
||||
interceptCfgService.saveInterceptCfg(listPage);
|
||||
}
|
||||
if (regionDict.getDictId().intValue() == 9||regionDict.getDictId().intValue() == 15 || regionDict.getDictId().intValue() == 596) {
|
||||
websiteCfgService.saveHttpUrlCfg(listPage);
|
||||
//websiteCfgService.saveHttpUrlCfg(listPage);
|
||||
websiteCfgService.saveStringCfgBatch(listPage, WebsiteCfgDao.class,"http_url_cfg");
|
||||
}
|
||||
if (regionDict.getDictId().intValue() == 36||regionDict.getDictId().intValue() == 37) {
|
||||
fileTransferCfgService.saveFtpCfg(listPage);
|
||||
|
||||
@@ -67,4 +67,6 @@ public interface WebsiteCfgDao extends CrudDao<CfgIndexInfo>{
|
||||
public void deleteSslIpCfg(CfgIndexInfo entity);
|
||||
public void deleteSslKeywordCfg(CfgIndexInfo entity);
|
||||
|
||||
public void saveWebsiteCfgForBatch(BaseStringCfg cfg);
|
||||
|
||||
}
|
||||
|
||||
@@ -794,6 +794,72 @@
|
||||
)
|
||||
</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 id="saveHttpUrlCfg" parameterType="com.nis.domain.configuration.HttpUrlCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
|
||||
@@ -14,9 +14,11 @@ 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.web.dao.CrudDao;
|
||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.dao.configuration.WebsiteCfgDao;
|
||||
|
||||
/**
|
||||
* Service基类
|
||||
@@ -124,6 +126,26 @@ 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) {
|
||||
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);
|
||||
cfg.setTableName(tableName);
|
||||
((WebsiteCfgDao) batchSqlSession.getMapper(mClass)).saveWebsiteCfgForBatch(cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* saveIpBatch(非Ip类配置调用,批量新增区域IP)
|
||||
|
||||
Reference in New Issue
Block a user