2018-05-22 17:30:52 +08:00
|
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.Date;
|
2018-06-04 15:36:00 +08:00
|
|
|
|
import java.util.Iterator;
|
2018-05-22 17:30:52 +08:00
|
|
|
|
import java.util.List;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
2018-05-30 14:37:35 +08:00
|
|
|
|
import org.springframework.beans.BeanUtils;
|
2018-05-22 17:30:52 +08:00
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
2018-05-23 17:34:40 +08:00
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
2018-05-22 17:30:52 +08:00
|
|
|
|
|
|
|
|
|
|
import com.nis.domain.Page;
|
2018-05-29 18:31:43 +08:00
|
|
|
|
import com.nis.domain.configuration.AreaBean;
|
|
|
|
|
|
import com.nis.domain.configuration.AreaIpCfg;
|
2018-05-22 17:30:52 +08:00
|
|
|
|
import com.nis.domain.configuration.AvVoipAccountCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.AvVoipIpCfg;
|
2018-05-31 17:21:34 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-06-01 18:13:07 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseStringCfg;
|
2018-05-22 17:30:52 +08:00
|
|
|
|
import com.nis.domain.configuration.CfgIndexInfo;
|
2018-05-30 14:37:35 +08:00
|
|
|
|
import com.nis.domain.maat.MaatCfg;
|
|
|
|
|
|
import com.nis.domain.maat.ToMaatBean;
|
|
|
|
|
|
import com.nis.domain.maat.ToMaatResult;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.DigestCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.GroupCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.IpCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
|
|
|
|
|
import com.nis.domain.maat.MaatCfg.StringCfg;
|
2018-05-22 17:30:52 +08:00
|
|
|
|
import com.nis.exceptions.MaatConvertException;
|
|
|
|
|
|
import com.nis.util.ConfigServiceUtil;
|
2018-05-29 18:31:43 +08:00
|
|
|
|
import com.nis.util.Constants;
|
2018-05-24 16:04:16 +08:00
|
|
|
|
import com.nis.util.StringUtil;
|
2018-05-29 18:31:43 +08:00
|
|
|
|
import com.nis.util.StringUtils;
|
|
|
|
|
|
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
2018-05-22 17:30:52 +08:00
|
|
|
|
import com.nis.web.dao.configuration.AvContentCfgDao;
|
|
|
|
|
|
import com.nis.web.security.UserUtils;
|
|
|
|
|
|
import com.nis.web.service.BaseService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 音视频文本
|
|
|
|
|
|
* @author dell
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Service
|
|
|
|
|
|
public class AvContentCfgService extends BaseService{
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
protected AvContentCfgDao avContentCfgDao;
|
2018-05-29 18:31:43 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
protected AreaIpCfgDao areaIpCfgDao;
|
2018-05-22 17:30:52 +08:00
|
|
|
|
|
2018-05-31 17:21:34 +08:00
|
|
|
|
|
|
|
|
|
|
/********************************voip业务*********************************/
|
2018-05-22 17:30:52 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 查询分页数据
|
|
|
|
|
|
* @param page 分页对象
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Page<CfgIndexInfo> findPage(Page<CfgIndexInfo> page, CfgIndexInfo entity) {
|
2018-05-24 16:04:16 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
2018-05-22 17:30:52 +08:00
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
List<CfgIndexInfo> list=avContentCfgDao.findVoipList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据索引表信息获取voipIpCfg信息
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<AvVoipIpCfg> getVoipIpCfgList(CfgIndexInfo entity) {
|
|
|
|
|
|
return avContentCfgDao.findVoipIpCfgList(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据索引表信息获取voipAccountCfg信息
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<AvVoipAccountCfg> getVoipAccountCfgList(CfgIndexInfo entity) {
|
|
|
|
|
|
return avContentCfgDao.findVoipAccountCfgList(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据索引表信息获取voipAccountCfg信息
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity) {
|
|
|
|
|
|
CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity);
|
2018-05-23 18:39:29 +08:00
|
|
|
|
List<AvVoipAccountCfg> voipAccounts=new ArrayList<>();
|
|
|
|
|
|
voipAccounts=getVoipAccountCfgList(entity);
|
|
|
|
|
|
if(voipAccounts ==null || voipAccounts.size() <=0){
|
|
|
|
|
|
voipAccounts.add(new AvVoipAccountCfg());
|
|
|
|
|
|
}
|
|
|
|
|
|
List<AvVoipIpCfg> voipIps=new ArrayList<>();
|
|
|
|
|
|
voipIps=getVoipIpCfgList(entity);
|
|
|
|
|
|
if(voipIps ==null || voipIps.size() <=0){
|
|
|
|
|
|
voipIps.add(new AvVoipIpCfg());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-23 17:34:40 +08:00
|
|
|
|
cfg.setVoipAccounts(voipAccounts);
|
|
|
|
|
|
cfg.setVoipIps(voipIps);
|
2018-05-22 17:30:52 +08:00
|
|
|
|
|
|
|
|
|
|
return cfg;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-23 17:34:40 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-05-29 18:31:43 +08:00
|
|
|
|
public void saveOrUpdateAvVoip(CfgIndexInfo entity,String voipIpIds,String voipAccountIds,String areaCfgIds){
|
2018-05-23 17:34:40 +08:00
|
|
|
|
Date createTime=new Date();
|
2018-06-04 10:04:28 +08:00
|
|
|
|
//设置区域运营商信息
|
|
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-05-23 17:34:40 +08:00
|
|
|
|
//新增
|
|
|
|
|
|
if(entity.getCfgId()==null){
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
2018-05-24 16:04:16 +08:00
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-05-23 17:34:40 +08:00
|
|
|
|
//调用服务接口获取compileId
|
|
|
|
|
|
List<Integer> compileIds = new ArrayList<Integer>();
|
|
|
|
|
|
try {
|
2018-05-30 14:37:35 +08:00
|
|
|
|
compileIds = ConfigServiceUtil.getId(1,1);
|
2018-05-23 17:34:40 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
|
|
|
|
|
entity.setCompileId(compileIds.get(0));
|
|
|
|
|
|
//保存avVoipIp
|
|
|
|
|
|
if(entity.getVoipIps() != null && entity.getVoipIps().size() > 0){
|
|
|
|
|
|
for (AvVoipIpCfg voipIp : entity.getVoipIps()) {
|
|
|
|
|
|
entity.setVoipIp(voipIp);
|
|
|
|
|
|
avContentCfgDao.insertAvVoipIp(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//保存avVoipAccount
|
|
|
|
|
|
if(entity.getVoipAccounts() != null && entity.getVoipAccounts().size() > 0){
|
|
|
|
|
|
for (AvVoipAccountCfg voipAccount : entity.getVoipAccounts()) {
|
|
|
|
|
|
entity.setVoipAccount(voipAccount);
|
|
|
|
|
|
avContentCfgDao.insertAvVoipAccount(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-05-29 18:31:43 +08:00
|
|
|
|
//保存区域IP信息
|
|
|
|
|
|
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
2018-05-30 17:10:39 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType"});
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-05-23 17:34:40 +08:00
|
|
|
|
//保存cfgIndexInfo
|
|
|
|
|
|
avContentCfgDao.insertCfgIndexInfo(entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
|
|
|
}else{
|
2018-05-24 16:04:16 +08:00
|
|
|
|
Date editTime=new Date();
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
|
|
|
|
|
|
voipIpIds=!StringUtil.isEmpty(voipIpIds)? voipIpIds+",":"";
|
|
|
|
|
|
voipAccountIds=!StringUtil.isEmpty(voipAccountIds)? voipAccountIds+",":"";
|
2018-05-29 18:31:43 +08:00
|
|
|
|
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
|
2018-05-24 16:04:16 +08:00
|
|
|
|
|
|
|
|
|
|
//判断voip信息为新增还是修改,清楚voipIpIds修改的voipId记录,剩下即为需要删除的voipId
|
|
|
|
|
|
if(!StringUtil.isEmpty(entity.getVoipIps())){
|
|
|
|
|
|
for (AvVoipIpCfg voipIp : entity.getVoipIps()) {
|
|
|
|
|
|
if(!StringUtil.isEmpty(voipIp.getCfgId())){
|
|
|
|
|
|
if(voipIpIds.contains(","+voipIp.getCfgId()+",")){
|
|
|
|
|
|
voipIpIds=voipIpIds.replace(voipIp.getCfgId()+",", "");
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
entity.setVoipIp(voipIp);
|
|
|
|
|
|
avContentCfgDao.updateAvVoipIp(entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
//新增
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
entity.setVoipIp(voipIp);
|
|
|
|
|
|
avContentCfgDao.insertAvVoipIp(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(entity.getVoipAccounts())){
|
|
|
|
|
|
for (AvVoipAccountCfg voipAccount : entity.getVoipAccounts()) {
|
|
|
|
|
|
if(!StringUtil.isEmpty(voipAccount.getCfgId())){
|
|
|
|
|
|
if(voipAccountIds.contains(","+voipAccount.getCfgId()+",")){
|
|
|
|
|
|
voipAccountIds=voipAccountIds.replace(voipAccount.getCfgId()+",", "");
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
entity.setVoipAccount(voipAccount);
|
|
|
|
|
|
avContentCfgDao.updateAvVoipAccount(entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
//新增
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
entity.setVoipAccount(voipAccount);
|
|
|
|
|
|
avContentCfgDao.insertAvVoipAccount(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-05-30 17:10:39 +08:00
|
|
|
|
}
|
2018-05-29 18:31:43 +08:00
|
|
|
|
if(!StringUtil.isEmpty(entity.getAreaCfg())){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfg.getCfgId())){
|
|
|
|
|
|
if(areaCfgIds.contains(","+areaIpCfg.getCfgId()+",")){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.replace(areaIpCfg.getCfgId()+",", "");
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
2018-05-30 17:10:39 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
//新增
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
2018-05-30 17:10:39 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-05-25 09:01:23 +08:00
|
|
|
|
//delete 真是删除voipAccount信息
|
2018-05-24 16:04:16 +08:00
|
|
|
|
if(!StringUtil.isEmpty(voipAccountIds.replaceAll(",", ""))){
|
|
|
|
|
|
voipAccountIds=voipAccountIds.substring(1,voipAccountIds.length());
|
|
|
|
|
|
for (String cfgId : voipAccountIds.split(",")) {
|
|
|
|
|
|
CfgIndexInfo cfg=new CfgIndexInfo();
|
|
|
|
|
|
AvVoipAccountCfg voipAccountCfg=new AvVoipAccountCfg();
|
|
|
|
|
|
voipAccountCfg.setCfgId(Long.parseLong(cfgId));
|
|
|
|
|
|
cfg.setVoipAccount(voipAccountCfg);
|
2018-05-25 09:01:23 +08:00
|
|
|
|
avContentCfgDao.deleteAvVoipAccount(cfg);
|
2018-05-24 16:04:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 09:01:23 +08:00
|
|
|
|
//delete 真是删除voipAccount信息
|
2018-05-24 16:04:16 +08:00
|
|
|
|
if(!StringUtil.isEmpty(voipIpIds.replaceAll(",", ""))){
|
|
|
|
|
|
voipIpIds=voipIpIds.substring(1,voipIpIds.length());
|
|
|
|
|
|
for (String cfgId : voipIpIds.split(",")) {
|
|
|
|
|
|
CfgIndexInfo cfg=new CfgIndexInfo();
|
|
|
|
|
|
AvVoipIpCfg voipIpCfg=new AvVoipIpCfg();
|
|
|
|
|
|
voipIpCfg.setCfgId(Long.parseLong(cfgId));
|
|
|
|
|
|
cfg.setVoipIp(voipIpCfg);
|
2018-05-25 09:01:23 +08:00
|
|
|
|
avContentCfgDao.deleteAvVoipIp(cfg);
|
2018-05-24 16:04:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-05-29 18:31:43 +08:00
|
|
|
|
//delete 真是删除areaIpCfg信息
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length());
|
|
|
|
|
|
for (String cfgId : areaCfgIds.split(",")) {
|
|
|
|
|
|
CfgIndexInfo cfg=new CfgIndexInfo();
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
areaIpCfg.setCfgId(Long.parseLong(cfgId));
|
2018-05-30 17:10:39 +08:00
|
|
|
|
areaIpCfgDao.deleteAreaIpCfgByCfgId(areaIpCfg);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-24 16:04:16 +08:00
|
|
|
|
//修改
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
avContentCfgDao.updateCfgIndexInfo(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids compileIds
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void updateAvVoipValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
|
|
|
|
|
CfgIndexInfo entity = new CfgIndexInfo();
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
|
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
|
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
avContentCfgDao.updateAvVoipIp(entity);
|
|
|
|
|
|
avContentCfgDao.updateAvVoipAccount(entity);
|
|
|
|
|
|
avContentCfgDao.updateCfgIndexInfo(entity);
|
2018-05-30 17:10:39 +08:00
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg);
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
|
2018-05-23 17:34:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-05-25 09:01:23 +08:00
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids 编译Id
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
*/
|
2018-05-30 14:37:35 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void auditAvVoip(Integer isAudit,Integer isValid,Integer functionId,String compileId,Date auditTime){
|
2018-05-25 09:01:23 +08:00
|
|
|
|
CfgIndexInfo entity = new CfgIndexInfo();
|
2018-05-30 14:37:35 +08:00
|
|
|
|
|
2018-05-25 09:01:23 +08:00
|
|
|
|
List<CfgIndexInfo> list = new ArrayList();
|
|
|
|
|
|
List<AvVoipIpCfg> voipIpList = new ArrayList();
|
|
|
|
|
|
List<AvVoipAccountCfg> voipAccountList = new ArrayList();
|
2018-05-29 18:31:43 +08:00
|
|
|
|
List<AreaIpCfg> areaIpCfgList = new ArrayList();
|
2018-05-30 14:37:35 +08:00
|
|
|
|
|
2018-05-25 09:01:23 +08:00
|
|
|
|
CfgIndexInfo searchCfg=new CfgIndexInfo();
|
2018-05-30 14:37:35 +08:00
|
|
|
|
searchCfg.setCompileId(Integer.parseInt(compileId));
|
|
|
|
|
|
|
|
|
|
|
|
entity = avContentCfgDao.getCfgIndexInfo(searchCfg);
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(auditTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
avContentCfgDao.updateAvVoipIp(entity);
|
|
|
|
|
|
avContentCfgDao.updateAvVoipAccount(entity);
|
|
|
|
|
|
avContentCfgDao.updateCfgIndexInfo(entity);
|
2018-05-30 17:10:39 +08:00
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
2018-05-30 14:37:35 +08:00
|
|
|
|
|
|
|
|
|
|
voipIpList=avContentCfgDao.findVoipIpCfgList(entity);
|
|
|
|
|
|
voipAccountList=avContentCfgDao.findVoipAccountCfgList(entity);
|
2018-05-30 17:10:39 +08:00
|
|
|
|
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
2018-05-30 14:37:35 +08:00
|
|
|
|
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
MaatCfg maatCfg = new MaatCfg();
|
|
|
|
|
|
List<MaatCfg> configCompileList = new ArrayList();
|
|
|
|
|
|
List<GroupCfg> groupRelationList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> ipRegionList = new ArrayList();
|
|
|
|
|
|
List<StringCfg> strRegionList = new ArrayList();
|
|
|
|
|
|
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
|
|
|
|
|
List<DigestCfg> digestRegionList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> areaIpRegionList = new ArrayList();
|
|
|
|
|
|
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
if(!StringUtil.isEmpty(voipIpList)){
|
2018-06-04 15:36:00 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (AvVoipIpCfg ipCfg : voipIpList) {
|
|
|
|
|
|
ipCfg.setCfgType("MM_VOIP_IP");
|
|
|
|
|
|
}
|
2018-05-30 14:37:35 +08:00
|
|
|
|
Map<String,List> ipMap = cfgConvert(ipRegionList,voipIpList,1,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=ipMap.get("groupList");
|
|
|
|
|
|
ipRegionList=ipMap.get("dstList");
|
|
|
|
|
|
}
|
2018-05-25 09:01:23 +08:00
|
|
|
|
|
2018-05-30 14:37:35 +08:00
|
|
|
|
if(!StringUtil.isEmpty(voipAccountList)){
|
2018-06-04 15:36:00 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (AvVoipAccountCfg accountCfg : voipAccountList) {
|
|
|
|
|
|
accountCfg.setCfgType("MM_VOIP_ACCOUNT");
|
|
|
|
|
|
}
|
2018-05-30 14:37:35 +08:00
|
|
|
|
Map<String,List> accountMap = cfgConvert(strRegionList,voipAccountList,2,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=accountMap.get("groupList");
|
|
|
|
|
|
strRegionList=accountMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfgList)){
|
2018-06-08 14:30:20 +08:00
|
|
|
|
//TODO DELETE后期删除
|
2018-06-08 14:26:40 +08:00
|
|
|
|
for (AreaIpCfg areaIpCfga : areaIpCfgList) {
|
|
|
|
|
|
areaIpCfga.setCfgType("NTC_IP_RANGE");
|
|
|
|
|
|
}
|
2018-05-30 14:37:35 +08:00
|
|
|
|
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=areaMap.get("groupList");
|
|
|
|
|
|
areaIpRegionList=areaMap.get("dstList");
|
|
|
|
|
|
}
|
2018-05-25 09:01:23 +08:00
|
|
|
|
}
|
2018-05-30 14:37:35 +08:00
|
|
|
|
|
|
|
|
|
|
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
maatCfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, maatCfg);
|
|
|
|
|
|
maatCfg.setAction(entity.getAction());
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatCfg.setAuditTime(auditTime);
|
2018-05-30 14:37:35 +08:00
|
|
|
|
maatCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
maatCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
maatCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
maatCfg.setDigestRegionList(digestRegionList);
|
|
|
|
|
|
maatCfg.setGroupRelationList(groupRelationList);
|
|
|
|
|
|
maatCfg.setGroupNum(groupRelationList.size());
|
|
|
|
|
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
|
|
|
|
maatCfg.setIsValid(entity.getIsValid());
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-05-30 14:37:35 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
2018-05-25 09:01:23 +08:00
|
|
|
|
//调用服务接口下发配置数据
|
2018-05-30 14:37:35 +08:00
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("voip配置下发配置参数:"+json);
|
2018-05-25 09:01:23 +08:00
|
|
|
|
//调用服务接口下发配置
|
2018-05-30 14:37:35 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
|
|
|
|
logger.info("voip配置下发响应信息:"+result.getMsg());
|
|
|
|
|
|
|
2018-05-25 09:01:23 +08:00
|
|
|
|
}else if(isAudit==3){
|
2018-05-30 14:37:35 +08:00
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
|
|
|
|
|
maatCfg.setIsValid(0);//无效
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-05-30 14:37:35 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
2018-05-25 09:01:23 +08:00
|
|
|
|
//调用服务接口取消配置
|
2018-05-30 14:37:35 +08:00
|
|
|
|
String json=gsonToJson(maatBean);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
logger.info("voip配置下发配置参数:"+json);
|
2018-05-30 14:37:35 +08:00
|
|
|
|
//调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
logger.info("voip配置取消配置响应信息:"+result.getMsg());
|
2018-05-30 14:37:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-25 09:01:23 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
2018-05-31 17:21:34 +08:00
|
|
|
|
/********************************voip业务*********************************/
|
2018-05-29 18:31:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
2018-05-31 17:21:34 +08:00
|
|
|
|
/********************************contIp业务*********************************/
|
2018-05-29 18:31:43 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* contIp查询分页数据
|
|
|
|
|
|
* @param page 分页对象
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-05-31 17:21:34 +08:00
|
|
|
|
public Page<BaseIpCfg> findContIpPage(Page page, BaseIpCfg entity) {
|
2018-05-29 18:31:43 +08:00
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
|
|
|
|
|
entity.setPage(page);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
entity.setTableName("av_cont_ip_cfg");
|
|
|
|
|
|
List<BaseIpCfg> list=avContentCfgDao.findIpList(entity);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* contUp根据id查询contIpCfg信息
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2018-05-31 17:21:34 +08:00
|
|
|
|
public BaseIpCfg getContIpCfgById(BaseIpCfg entity) {
|
|
|
|
|
|
entity.setTableName("av_cont_ip_cfg");
|
|
|
|
|
|
return avContentCfgDao.findIpCfgById(entity);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-05-31 17:21:34 +08:00
|
|
|
|
public void saveOrUpdateContIp(BaseIpCfg entity,String areaCfgIds){
|
2018-05-29 18:31:43 +08:00
|
|
|
|
Date createTime=new Date();
|
2018-05-31 17:21:34 +08:00
|
|
|
|
entity.setTableName("av_cont_ip_cfg");
|
2018-06-04 10:04:28 +08:00
|
|
|
|
//设置区域运营商信息
|
|
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
//新增
|
|
|
|
|
|
if(entity.getCfgId()==null){
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
//调用服务接口获取compileId
|
|
|
|
|
|
List<Integer> compileIds = new ArrayList<Integer>();
|
|
|
|
|
|
try {
|
2018-05-30 14:37:35 +08:00
|
|
|
|
compileIds = ConfigServiceUtil.getId(1,1);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
|
|
|
|
|
entity.setCompileId(compileIds.get(0));
|
2018-05-30 17:10:39 +08:00
|
|
|
|
|
|
|
|
|
|
//保存区域IP信息
|
|
|
|
|
|
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
2018-05-31 17:21:34 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
2018-05-30 17:10:39 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-29 18:31:43 +08:00
|
|
|
|
//保存cfgIndexInfo
|
2018-05-31 17:21:34 +08:00
|
|
|
|
avContentCfgDao.insertIp(entity);
|
2018-05-29 18:31:43 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//修改
|
|
|
|
|
|
}else{
|
|
|
|
|
|
Date editTime=new Date();
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
2018-05-30 17:10:39 +08:00
|
|
|
|
|
|
|
|
|
|
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(entity.getAreaCfg())){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfg.getCfgId())){
|
|
|
|
|
|
if(areaCfgIds.contains(","+areaIpCfg.getCfgId()+",")){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.replace(areaIpCfg.getCfgId()+",", "");
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
2018-05-30 17:10:39 +08:00
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
//新增
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
2018-05-30 17:10:39 +08:00
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//delete 真是删除areaIpCfg信息
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length());
|
|
|
|
|
|
for (String cfgId : areaCfgIds.split(",")) {
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
areaIpCfg.setCfgId(Long.parseLong(cfgId));
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfgByCfgId(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-29 18:31:43 +08:00
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
avContentCfgDao.updateIp(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids compileIds
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void updateContIpValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
|
|
|
|
|
BaseIpCfg entity = new BaseIpCfg();
|
|
|
|
|
|
entity.setTableName("av_cont_ip_cfg");
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
2018-06-06 14:27:37 +08:00
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
2018-05-31 17:21:34 +08:00
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
avContentCfgDao.updateIp(entity);
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg);
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids cfgId
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void auditContIp(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
|
|
|
|
|
BaseIpCfg entity = new BaseIpCfg();
|
|
|
|
|
|
entity.setTableName("av_cont_ip_cfg");
|
|
|
|
|
|
|
|
|
|
|
|
List<BaseIpCfg> list = new ArrayList();
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = new ArrayList();
|
|
|
|
|
|
|
2018-06-06 14:27:37 +08:00
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
2018-05-31 17:21:34 +08:00
|
|
|
|
entity = avContentCfgDao.findIpCfgById(entity);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
entity.setTableName("av_cont_ip_cfg");
|
2018-05-31 17:21:34 +08:00
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(auditTime);
|
|
|
|
|
|
|
|
|
|
|
|
avContentCfgDao.updateIp(entity);
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
|
|
|
|
|
|
list=avContentCfgDao.getIpList(entity);
|
|
|
|
|
|
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
MaatCfg maatCfg = new MaatCfg();
|
|
|
|
|
|
List<MaatCfg> configCompileList = new ArrayList();
|
|
|
|
|
|
List<GroupCfg> groupRelationList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> ipRegionList = new ArrayList();
|
|
|
|
|
|
List<StringCfg> strRegionList = new ArrayList();
|
|
|
|
|
|
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
|
|
|
|
|
List<DigestCfg> digestRegionList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> areaIpRegionList = new ArrayList();
|
|
|
|
|
|
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
if(!StringUtil.isEmpty(list)){
|
2018-06-04 15:36:00 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (BaseIpCfg ipCfg : list) {
|
|
|
|
|
|
ipCfg.setCfgType("MM_AV_IP");
|
|
|
|
|
|
}
|
2018-05-31 17:21:34 +08:00
|
|
|
|
Map<String,List> ipMap = cfgConvert(ipRegionList,list,1,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=ipMap.get("groupList");
|
|
|
|
|
|
ipRegionList=ipMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfgList)){
|
2018-06-08 14:26:40 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (AreaIpCfg areaIpCfga : areaIpCfgList) {
|
|
|
|
|
|
areaIpCfga.setCfgType("NTC_IP_RANGE");
|
|
|
|
|
|
}
|
2018-05-31 17:21:34 +08:00
|
|
|
|
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=areaMap.get("groupList");
|
|
|
|
|
|
areaIpRegionList=areaMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
maatCfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, maatCfg);
|
|
|
|
|
|
maatCfg.setAction(entity.getAction());
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatCfg.setAuditTime(auditTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
maatCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
maatCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
maatCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
maatCfg.setDigestRegionList(digestRegionList);
|
|
|
|
|
|
maatCfg.setGroupRelationList(groupRelationList);
|
|
|
|
|
|
maatCfg.setGroupNum(groupRelationList.size());
|
|
|
|
|
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
|
|
|
|
maatCfg.setIsValid(entity.getIsValid());
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
//调用服务接口下发配置数据
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("contIp配置下发配置参数:"+json);
|
2018-06-04 10:04:28 +08:00
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
|
|
|
|
logger.info("contIp配置下发响应信息:"+result.getMsg());
|
2018-05-31 17:21:34 +08:00
|
|
|
|
|
|
|
|
|
|
}else if(isAudit==3){
|
|
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
|
|
|
|
|
maatCfg.setIsValid(0);//无效
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
|
|
|
|
|
//调用服务接口取消配置
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("contIp配置下发配置参数:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
2018-06-04 10:04:28 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
|
|
|
|
|
logger.info("contIp配置取消配置响应信息:"+result.getMsg());
|
2018-05-31 17:21:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/********************************contIp业务*********************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************picIp业务*********************************/
|
|
|
|
|
|
/**
|
|
|
|
|
|
* picIp查询分页数据
|
|
|
|
|
|
* @param page 分页对象
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Page<BaseIpCfg> findPicIpPage(Page page, BaseIpCfg entity) {
|
|
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
|
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
entity.setTableName("av_pic_ip_cfg");
|
|
|
|
|
|
List<BaseIpCfg> list=avContentCfgDao.findIpList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* picIp根据id查询contIpCfg信息
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public BaseIpCfg getPicIpCfgById(BaseIpCfg entity) {
|
|
|
|
|
|
entity.setTableName("av_pic_ip_cfg");
|
|
|
|
|
|
return avContentCfgDao.findIpCfgById(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void saveOrUpdatePicIp(BaseIpCfg entity,String areaCfgIds){
|
|
|
|
|
|
Date createTime=new Date();
|
|
|
|
|
|
entity.setTableName("av_pic_ip_cfg");
|
2018-06-04 10:04:28 +08:00
|
|
|
|
//设置区域运营商信息
|
|
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
//新增
|
|
|
|
|
|
if(entity.getCfgId()==null){
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
//调用服务接口获取compileId
|
|
|
|
|
|
List<Integer> compileIds = new ArrayList<Integer>();
|
|
|
|
|
|
try {
|
|
|
|
|
|
compileIds = ConfigServiceUtil.getId(1,1);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
|
|
|
|
|
entity.setCompileId(compileIds.get(0));
|
|
|
|
|
|
|
|
|
|
|
|
//保存区域IP信息
|
|
|
|
|
|
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//保存cfgIndexInfo
|
|
|
|
|
|
avContentCfgDao.insertIp(entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//修改
|
|
|
|
|
|
}else{
|
|
|
|
|
|
Date editTime=new Date();
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
|
|
|
|
|
|
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(entity.getAreaCfg())){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfg.getCfgId())){
|
|
|
|
|
|
if(areaCfgIds.contains(","+areaIpCfg.getCfgId()+",")){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.replace(areaIpCfg.getCfgId()+",", "");
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
//新增
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//delete 真是删除areaIpCfg信息
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length());
|
|
|
|
|
|
for (String cfgId : areaCfgIds.split(",")) {
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
areaIpCfg.setCfgId(Long.parseLong(cfgId));
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfgByCfgId(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
avContentCfgDao.updateIp(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids compileIds
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void updatePicIpValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
|
|
|
|
|
BaseIpCfg entity = new BaseIpCfg();
|
|
|
|
|
|
entity.setTableName("av_pic_ip_cfg");
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
2018-06-06 14:27:37 +08:00
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
2018-05-31 17:21:34 +08:00
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
avContentCfgDao.updateIp(entity);
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg);
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids cfgId
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void auditPicIp(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
|
|
|
|
|
BaseIpCfg entity = new BaseIpCfg();
|
|
|
|
|
|
entity.setTableName("av_pic_ip_cfg");
|
|
|
|
|
|
List<BaseIpCfg> list = new ArrayList();
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = new ArrayList();
|
|
|
|
|
|
|
2018-06-06 14:27:37 +08:00
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
2018-05-31 17:21:34 +08:00
|
|
|
|
entity = avContentCfgDao.findIpCfgById(entity);
|
2018-06-04 15:36:00 +08:00
|
|
|
|
entity.setTableName("av_pic_ip_cfg");
|
2018-05-31 17:21:34 +08:00
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(auditTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
avContentCfgDao.updateIp(entity);
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
,"ipType"
|
|
|
|
|
|
,"ipPattern"
|
|
|
|
|
|
,"srcIpAddress"
|
|
|
|
|
|
,"portPattern"
|
|
|
|
|
|
,"srcPort"
|
|
|
|
|
|
,"destPort"
|
|
|
|
|
|
,"protocol"
|
|
|
|
|
|
,"direction"
|
|
|
|
|
|
,"protocolId"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
|
|
|
|
|
|
list=avContentCfgDao.getIpList(entity);
|
|
|
|
|
|
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
MaatCfg maatCfg = new MaatCfg();
|
|
|
|
|
|
List<MaatCfg> configCompileList = new ArrayList();
|
|
|
|
|
|
List<GroupCfg> groupRelationList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> ipRegionList = new ArrayList();
|
|
|
|
|
|
List<StringCfg> strRegionList = new ArrayList();
|
|
|
|
|
|
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
|
|
|
|
|
List<DigestCfg> digestRegionList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> areaIpRegionList = new ArrayList();
|
|
|
|
|
|
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
if(!StringUtil.isEmpty(list)){
|
2018-06-04 15:36:00 +08:00
|
|
|
|
|
|
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (BaseIpCfg ipCfg : list) {
|
|
|
|
|
|
ipCfg.setCfgType("MM_PIC_IP");
|
|
|
|
|
|
}
|
2018-05-31 17:21:34 +08:00
|
|
|
|
Map<String,List> ipMap = cfgConvert(ipRegionList,list,1,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=ipMap.get("groupList");
|
|
|
|
|
|
ipRegionList=ipMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfgList)){
|
2018-06-08 14:26:40 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (AreaIpCfg areaIpCfga : areaIpCfgList) {
|
|
|
|
|
|
areaIpCfga.setCfgType("NTC_IP_RANGE");
|
|
|
|
|
|
}
|
2018-05-31 17:21:34 +08:00
|
|
|
|
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=areaMap.get("groupList");
|
|
|
|
|
|
areaIpRegionList=areaMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
maatCfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, maatCfg);
|
|
|
|
|
|
maatCfg.setAction(entity.getAction());
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatCfg.setAuditTime(auditTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
maatCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
maatCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
maatCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
maatCfg.setDigestRegionList(digestRegionList);
|
|
|
|
|
|
maatCfg.setGroupRelationList(groupRelationList);
|
|
|
|
|
|
maatCfg.setGroupNum(groupRelationList.size());
|
|
|
|
|
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
|
|
|
|
maatCfg.setIsValid(entity.getIsValid());
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
//调用服务接口下发配置数据
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
2018-06-04 10:04:28 +08:00
|
|
|
|
logger.info("picIp配置下发配置参数:"+json);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
//TODO 调用服务接口下发配置
|
2018-06-04 10:04:28 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
|
|
|
|
logger.info("picIp配置下发响应信息:"+result.getMsg());
|
2018-05-31 17:21:34 +08:00
|
|
|
|
|
|
|
|
|
|
}else if(isAudit==3){
|
|
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
|
|
|
|
|
maatCfg.setIsValid(0);//无效
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
|
|
|
|
|
//调用服务接口取消配置
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
2018-06-04 10:04:28 +08:00
|
|
|
|
logger.info("picIp配置下发配置参数:"+json);
|
2018-05-31 17:21:34 +08:00
|
|
|
|
//调用服务接口下发配置
|
2018-06-04 10:04:28 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
|
|
|
|
|
logger.info("picIp配置取消配置响应信息:"+result.getMsg());
|
2018-05-29 18:31:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-06-01 18:13:07 +08:00
|
|
|
|
/********************************picIp业务*********************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************contUrl业务*********************************/
|
|
|
|
|
|
/**
|
|
|
|
|
|
* picIp查询分页数据
|
|
|
|
|
|
* @param page 分页对象
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Page<BaseStringCfg> findContUrlPage(Page page, BaseStringCfg entity) {
|
|
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
|
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
entity.setTableName("av_cont_url_cfg");
|
|
|
|
|
|
List<BaseStringCfg> list=avContentCfgDao.findStringList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* ContUrl根据id查询contIpCfg信息
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public BaseStringCfg getContUrlCfgById(BaseStringCfg entity) {
|
|
|
|
|
|
entity.setTableName("av_cont_url_cfg");
|
|
|
|
|
|
return avContentCfgDao.findStringCfgById(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public void saveOrUpdateContUrl(BaseStringCfg<BaseStringCfg> entity,String areaCfgIds){
|
2018-06-01 18:13:07 +08:00
|
|
|
|
Date createTime=new Date();
|
|
|
|
|
|
entity.setTableName("av_cont_url_cfg");
|
2018-06-04 10:04:28 +08:00
|
|
|
|
//设置区域运营商信息
|
|
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
//新增
|
|
|
|
|
|
if(entity.getCfgId()==null){
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
//调用服务接口获取compileId
|
|
|
|
|
|
List<Integer> compileIds = new ArrayList<Integer>();
|
|
|
|
|
|
try {
|
|
|
|
|
|
compileIds = ConfigServiceUtil.getId(1,1);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
|
|
|
|
|
entity.setCompileId(compileIds.get(0));
|
|
|
|
|
|
|
|
|
|
|
|
//保存区域IP信息
|
|
|
|
|
|
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//保存cfgIndexInfo
|
|
|
|
|
|
avContentCfgDao.insertString(entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//修改
|
|
|
|
|
|
}else{
|
|
|
|
|
|
Date editTime=new Date();
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
|
|
|
|
|
|
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(entity.getAreaCfg())){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfg.getCfgId())){
|
|
|
|
|
|
if(areaCfgIds.contains(","+areaIpCfg.getCfgId()+",")){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.replace(areaIpCfg.getCfgId()+",", "");
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
//新增
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//delete 真是删除areaIpCfg信息
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length());
|
|
|
|
|
|
for (String cfgId : areaCfgIds.split(",")) {
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
areaIpCfg.setCfgId(Long.parseLong(cfgId));
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfgByCfgId(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
entity.setTableName("av_cont_url_cfg");
|
|
|
|
|
|
avContentCfgDao.updateString(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids compileIds
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void updateContUrlValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
|
|
|
|
|
BaseStringCfg entity = new BaseStringCfg();
|
|
|
|
|
|
entity.setTableName("av_cont_url_cfg");
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
2018-06-06 14:27:37 +08:00
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
2018-06-01 18:13:07 +08:00
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
avContentCfgDao.updateString(entity);
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg);
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids cfgId
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void auditContUrl(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
|
|
|
|
|
BaseStringCfg entity = new BaseStringCfg();
|
|
|
|
|
|
entity.setTableName("av_cont_url_cfg");
|
|
|
|
|
|
List<BaseStringCfg> list = new ArrayList();
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = new ArrayList();
|
|
|
|
|
|
|
2018-06-06 14:27:37 +08:00
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
2018-06-01 18:13:07 +08:00
|
|
|
|
entity = avContentCfgDao.findStringCfgById(entity);
|
|
|
|
|
|
entity.setTableName("av_cont_url_cfg");
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(auditTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
avContentCfgDao.updateString(entity);
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
|
|
|
|
|
|
list=avContentCfgDao.getStringList(entity);
|
|
|
|
|
|
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
MaatCfg maatCfg = new MaatCfg();
|
|
|
|
|
|
List<MaatCfg> configCompileList = new ArrayList();
|
|
|
|
|
|
List<GroupCfg> groupRelationList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> ipRegionList = new ArrayList();
|
|
|
|
|
|
List<StringCfg> strRegionList = new ArrayList();
|
|
|
|
|
|
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
|
|
|
|
|
List<DigestCfg> digestRegionList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> areaIpRegionList = new ArrayList();
|
|
|
|
|
|
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
if(!StringUtil.isEmpty(list)){
|
2018-06-04 15:36:00 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (BaseStringCfg strCfg : list) {
|
2018-06-05 11:34:48 +08:00
|
|
|
|
strCfg.setCfgType("MM_AV_URL");
|
2018-06-04 15:36:00 +08:00
|
|
|
|
}
|
2018-06-01 18:13:07 +08:00
|
|
|
|
Map<String,List> strMap = cfgConvert(strRegionList,list,2,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=strMap.get("groupList");
|
|
|
|
|
|
strRegionList=strMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfgList)){
|
2018-06-08 14:26:40 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (AreaIpCfg areaIpCfga : areaIpCfgList) {
|
|
|
|
|
|
areaIpCfga.setCfgType("NTC_IP_RANGE");
|
|
|
|
|
|
}
|
2018-06-01 18:13:07 +08:00
|
|
|
|
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=areaMap.get("groupList");
|
|
|
|
|
|
areaIpRegionList=areaMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
maatCfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, maatCfg);
|
|
|
|
|
|
maatCfg.setAction(entity.getAction());
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatCfg.setAuditTime(auditTime);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
maatCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
maatCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
maatCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
maatCfg.setDigestRegionList(digestRegionList);
|
|
|
|
|
|
maatCfg.setGroupRelationList(groupRelationList);
|
|
|
|
|
|
maatCfg.setGroupNum(groupRelationList.size());
|
|
|
|
|
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
|
|
|
|
maatCfg.setIsValid(entity.getIsValid());
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
//调用服务接口下发配置数据
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
2018-06-04 10:04:28 +08:00
|
|
|
|
logger.info("contUrl配置下发配置参数:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
|
|
|
|
logger.info("contUrl配置下发响应信息:"+result.getMsg());
|
2018-06-01 18:13:07 +08:00
|
|
|
|
|
|
|
|
|
|
}else if(isAudit==3){
|
|
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
|
|
|
|
|
maatCfg.setIsValid(0);//无效
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
|
|
|
|
|
//调用服务接口取消配置
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
2018-06-04 10:04:28 +08:00
|
|
|
|
logger.info("contUrl配置下发配置参数:"+json);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
//调用服务接口下发配置
|
2018-06-04 10:04:28 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
|
|
|
|
|
logger.info("contUrl配置取消配置响应信息:"+result.getMsg());
|
2018-06-01 18:13:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/********************************contUrl业务*********************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************picUrl业务*********************************/
|
|
|
|
|
|
/**
|
|
|
|
|
|
* picIp查询分页数据
|
|
|
|
|
|
* @param page 分页对象
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Page<BaseStringCfg> findPicUrlPage(Page page, BaseStringCfg entity) {
|
|
|
|
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
|
|
|
|
|
entity.setPage(page);
|
|
|
|
|
|
entity.setTableName("av_pic_url_cfg");
|
|
|
|
|
|
List<BaseStringCfg> list=avContentCfgDao.findStringList(entity);
|
|
|
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* PicUrl根据id查询picIpCfg信息
|
|
|
|
|
|
* @param entity
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public BaseStringCfg getPicUrlCfgById(BaseStringCfg entity) {
|
|
|
|
|
|
entity.setTableName("av_pic_url_cfg");
|
|
|
|
|
|
return avContentCfgDao.findStringCfgById(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-06-29 12:44:33 +08:00
|
|
|
|
public void saveOrUpdatePicUrl(BaseStringCfg<BaseStringCfg> entity,String areaCfgIds){
|
2018-06-01 18:13:07 +08:00
|
|
|
|
Date createTime=new Date();
|
|
|
|
|
|
entity.setTableName("av_pic_url_cfg");
|
2018-06-04 10:04:28 +08:00
|
|
|
|
//设置区域运营商信息
|
|
|
|
|
|
setAreaEffectiveIds(entity);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
//新增
|
|
|
|
|
|
if(entity.getCfgId()==null){
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
//调用服务接口获取compileId
|
|
|
|
|
|
List<Integer> compileIds = new ArrayList<Integer>();
|
|
|
|
|
|
try {
|
|
|
|
|
|
compileIds = ConfigServiceUtil.getId(1,1);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
logger.info("获取编译ID出错");
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
|
|
|
|
|
entity.setCompileId(compileIds.get(0));
|
|
|
|
|
|
|
|
|
|
|
|
//保存区域IP信息
|
|
|
|
|
|
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//保存cfgIndexInfo
|
|
|
|
|
|
avContentCfgDao.insertString(entity);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//修改
|
|
|
|
|
|
}else{
|
|
|
|
|
|
Date editTime=new Date();
|
|
|
|
|
|
entity.setIsValid(0);
|
|
|
|
|
|
entity.setIsAudit(0);
|
|
|
|
|
|
|
|
|
|
|
|
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(entity.getAreaCfg())){
|
|
|
|
|
|
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfg.getCfgId())){
|
|
|
|
|
|
if(areaCfgIds.contains(","+areaIpCfg.getCfgId()+",")){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.replace(areaIpCfg.getCfgId()+",", "");
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
//新增
|
|
|
|
|
|
entity.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setCreateTime(createTime);
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//delete 真是删除areaIpCfg信息
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){
|
|
|
|
|
|
areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length());
|
|
|
|
|
|
for (String cfgId : areaCfgIds.split(",")) {
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
areaIpCfg.setCfgId(Long.parseLong(cfgId));
|
|
|
|
|
|
areaIpCfgDao.deleteAreaIpCfgByCfgId(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(editTime);
|
|
|
|
|
|
entity.setTableName("av_pic_url_cfg");
|
|
|
|
|
|
avContentCfgDao.updateString(entity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids compileIds
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void updatePicUrlValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
|
|
|
|
|
BaseStringCfg entity = new BaseStringCfg();
|
|
|
|
|
|
entity.setTableName("av_pic_url_cfg");
|
|
|
|
|
|
String[] idArray = ids.split(",");
|
|
|
|
|
|
for(String id :idArray){
|
2018-06-06 14:27:37 +08:00
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
2018-06-01 18:13:07 +08:00
|
|
|
|
entity.setFunctionId(functionId);
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setEditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setEditTime(new Date());
|
|
|
|
|
|
avContentCfgDao.updateString(entity);
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg);
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param isAudit
|
|
|
|
|
|
* @param isValid
|
|
|
|
|
|
* @param ids cfgId
|
|
|
|
|
|
* @param functionId
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
|
|
|
|
|
public void auditPicUrl(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
|
|
|
|
|
BaseStringCfg entity = new BaseStringCfg();
|
|
|
|
|
|
entity.setTableName("av_pic_url_cfg");
|
|
|
|
|
|
List<BaseStringCfg> list = new ArrayList();
|
|
|
|
|
|
List<AreaIpCfg> areaIpCfgList = new ArrayList();
|
|
|
|
|
|
|
2018-06-06 14:27:37 +08:00
|
|
|
|
entity.setCompileId(Integer.parseInt(id));
|
2018-06-01 18:13:07 +08:00
|
|
|
|
entity = avContentCfgDao.findStringCfgById(entity);
|
|
|
|
|
|
entity.setTableName("av_pic_url_cfg");
|
|
|
|
|
|
entity.setIsAudit(isAudit);
|
|
|
|
|
|
entity.setIsValid(isValid);
|
|
|
|
|
|
entity.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
|
entity.setAuditTime(auditTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
avContentCfgDao.updateString(entity);
|
|
|
|
|
|
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
|
|
|
|
|
,"cfgType"
|
|
|
|
|
|
,"cfgId"
|
|
|
|
|
|
});
|
|
|
|
|
|
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
|
|
|
|
|
|
|
|
|
|
|
list=avContentCfgDao.getStringList(entity);
|
|
|
|
|
|
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
|
|
|
|
|
|
|
|
|
|
|
ToMaatBean maatBean = new ToMaatBean();
|
|
|
|
|
|
MaatCfg maatCfg = new MaatCfg();
|
|
|
|
|
|
List<MaatCfg> configCompileList = new ArrayList();
|
|
|
|
|
|
List<GroupCfg> groupRelationList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> ipRegionList = new ArrayList();
|
|
|
|
|
|
List<StringCfg> strRegionList = new ArrayList();
|
|
|
|
|
|
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
|
|
|
|
|
List<DigestCfg> digestRegionList = new ArrayList();
|
|
|
|
|
|
List<IpCfg> areaIpRegionList = new ArrayList();
|
|
|
|
|
|
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
if(!StringUtil.isEmpty(list)){
|
2018-06-04 15:36:00 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (BaseStringCfg strCfg : list) {
|
|
|
|
|
|
strCfg.setCfgType("MM_PIC_URL");
|
|
|
|
|
|
}
|
2018-06-01 18:13:07 +08:00
|
|
|
|
Map<String,List> strMap = cfgConvert(strRegionList,list,2,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=strMap.get("groupList");
|
|
|
|
|
|
strRegionList=strMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(areaIpCfgList)){
|
2018-06-08 14:26:40 +08:00
|
|
|
|
//TODO DELETE后期删除
|
|
|
|
|
|
for (AreaIpCfg areaIpCfga : areaIpCfgList) {
|
|
|
|
|
|
areaIpCfga.setCfgType("NTC_IP_RANGE");
|
|
|
|
|
|
}
|
2018-06-01 18:13:07 +08:00
|
|
|
|
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
|
|
|
|
|
groupRelationList=areaMap.get("groupList");
|
|
|
|
|
|
areaIpRegionList=areaMap.get("dstList");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
|
|
|
|
|
if(isAudit==1){
|
|
|
|
|
|
maatCfg.initDefaultValue();
|
|
|
|
|
|
BeanUtils.copyProperties(entity, maatCfg);
|
|
|
|
|
|
maatCfg.setAction(entity.getAction());
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatCfg.setAuditTime(auditTime);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
maatCfg.setIpRegionList(ipRegionList);
|
|
|
|
|
|
maatCfg.setStrRegionList(strRegionList);
|
|
|
|
|
|
maatCfg.setNumRegionList(numRegionList);
|
|
|
|
|
|
maatCfg.setDigestRegionList(digestRegionList);
|
|
|
|
|
|
maatCfg.setGroupRelationList(groupRelationList);
|
|
|
|
|
|
maatCfg.setGroupNum(groupRelationList.size());
|
|
|
|
|
|
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
|
|
|
|
|
maatCfg.setIsValid(entity.getIsValid());
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.INSERT_ACTION);
|
|
|
|
|
|
//调用服务接口下发配置数据
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("picUrl配置下发配置参数:"+json);
|
2018-06-04 10:04:28 +08:00
|
|
|
|
// 调用服务接口下发配置
|
|
|
|
|
|
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
|
|
|
|
|
logger.info("picUrl配置下发响应信息:"+result.getMsg());
|
2018-06-01 18:13:07 +08:00
|
|
|
|
|
|
|
|
|
|
}else if(isAudit==3){
|
|
|
|
|
|
maatCfg.setCompileId(entity.getCompileId());
|
|
|
|
|
|
maatCfg.setServiceId(entity.getServiceId());
|
|
|
|
|
|
maatCfg.setIsValid(0);//无效
|
|
|
|
|
|
configCompileList.add(maatCfg);
|
|
|
|
|
|
maatBean.setConfigCompileList(configCompileList);
|
2018-06-07 16:31:14 +08:00
|
|
|
|
maatBean.setAuditTime(auditTime);
|
2018-06-01 18:13:07 +08:00
|
|
|
|
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
|
|
|
|
|
maatBean.setVersion(Constants.MAAT_VERSION);
|
|
|
|
|
|
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
|
|
|
|
|
//调用服务接口取消配置
|
|
|
|
|
|
String json=gsonToJson(maatBean);
|
|
|
|
|
|
logger.info("picUrl配置下发配置参数:"+json);
|
|
|
|
|
|
//调用服务接口下发配置
|
2018-06-04 10:04:28 +08:00
|
|
|
|
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
|
|
|
|
|
logger.info("picUrl配置取消配置响应信息:"+result.getMsg());
|
2018-06-01 18:13:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/********************************picUrl业务*********************************/
|
2018-05-22 17:30:52 +08:00
|
|
|
|
}
|