补充上次提交.
This commit is contained in:
@@ -70,6 +70,7 @@ import com.nis.domain.configuration.IpReusePolicyCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCert;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
@@ -1650,7 +1651,7 @@ public abstract class BaseService {
|
||||
this.saveAppComplexFeatureBatch(regionDict,serviceDict,listPage,send);
|
||||
}else if("AppTopicDomain".equals(type)) {// 主题网站
|
||||
List<AppTopicDomainCfg> listPage = (List<AppTopicDomainCfg>) list;
|
||||
this.saveTopicDomainCfgBatch(listPage);
|
||||
this.saveTopicDomainCfgBatch(regionDict,serviceDict,listPage,send);
|
||||
}else if("BaseStringCfg".equals(type)) {
|
||||
List<BaseStringCfg<?>> listPage = (List<BaseStringCfg<?>>) list;
|
||||
// 调用对应配置的service
|
||||
@@ -1932,25 +1933,69 @@ public abstract class BaseService {
|
||||
|
||||
/**
|
||||
* 导入配置时数据批量入库
|
||||
* @param serviceDict
|
||||
* @param regionDict
|
||||
* @param data
|
||||
* @param send
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveTopicDomainCfgBatch(List<AppTopicDomainCfg> 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++){
|
||||
AppTopicDomainCfg cfg = data.get(index);
|
||||
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppTopicDomainCfgBatch(cfg);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
public void saveTopicDomainCfgBatch(FunctionRegionDict regionDict, FunctionServiceDict serviceDict, List<AppTopicDomainCfg> data, boolean send) {
|
||||
if (regionDict != null) {
|
||||
Integer regionType = regionDict.getRegionType();
|
||||
if (2 == regionType.intValue()) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
AppCfgDao appCfgDao = SpringContextHolder.getBean(AppCfgDao.class);
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
AppTopicDomainCfg cfg = data.get(index);
|
||||
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppTopicDomainCfgBatch(cfg);
|
||||
if (send) {
|
||||
if(regionDict.getIsMaat().intValue()==1) {
|
||||
MaatCfg maatCfg=convertMaatCfg(cfg,2);
|
||||
//userRegion处理
|
||||
WebsiteDomainTopic websiteDomainTopic = new WebsiteDomainTopic();
|
||||
websiteDomainTopic.setDomain(cfg.getCfgKeywords());
|
||||
List<WebsiteDomainTopic> domainDict = appCfgDao.getDomainDict(websiteDomainTopic);
|
||||
Long domainId = domainDict.get(0).getId();
|
||||
maatCfg.setUserRegion("WEB_ID=" + domainId);
|
||||
configCompileList.add(maatCfg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (send && configCompileList.size() > 0) {
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(new Date());
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
// 调用服务接口下发配置数据
|
||||
String json = BaseService.gsonToJson(maatBean);
|
||||
if(configCompileList.size()>10) {
|
||||
logger.info("APP主题网站配置下发配置参数:" + configCompileList.size());
|
||||
}else {
|
||||
logger.info("APP主题网站配置下发配置参数:" + json);
|
||||
}
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("APP主题网站配置下发响应信息:" + result.getMsg());
|
||||
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user