contip、conturl、picip、picurl功能提交
areainfo界面区域和运营商修改为二选一的
This commit is contained in:
@@ -17,6 +17,7 @@ import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.AvVoipAccountCfg;
|
||||
import com.nis.domain.configuration.AvVoipIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
@@ -118,10 +119,12 @@ public class AvContentCfgService extends BaseService{
|
||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
||||
for(int i=0;i<areaIsps.size();i++){
|
||||
if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(areaIsps.get(i).getArea())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
||||
}else{
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}
|
||||
if(i!=areaIsps.size()-1){
|
||||
areaEffectiveIds.append(",");
|
||||
@@ -481,10 +484,12 @@ public class AvContentCfgService extends BaseService{
|
||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
||||
for(int i=0;i<areaIsps.size();i++){
|
||||
if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}else{
|
||||
if(StringUtils.isBlank(areaIsps.get(i).getArea())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
||||
}else if(StringUtils.isBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
||||
}else{
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}
|
||||
if(i!=areaIsps.size()-1){
|
||||
areaEffectiveIds.append(",");
|
||||
@@ -647,12 +652,12 @@ public class AvContentCfgService extends BaseService{
|
||||
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity = avContentCfgDao.findIpCfgById(entity);
|
||||
entity.setTableName("av_cont_ip_cfg");
|
||||
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"
|
||||
@@ -785,10 +790,12 @@ public class AvContentCfgService extends BaseService{
|
||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
||||
for(int i=0;i<areaIsps.size();i++){
|
||||
if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(areaIsps.get(i).getArea())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
||||
}else{
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}
|
||||
if(i!=areaIsps.size()-1){
|
||||
areaEffectiveIds.append(",");
|
||||
@@ -950,6 +957,7 @@ public class AvContentCfgService extends BaseService{
|
||||
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity = avContentCfgDao.findIpCfgById(entity);
|
||||
entity.setTableName("av_cont_ip_cfg");
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
@@ -1045,5 +1053,546 @@ public class AvContentCfgService extends BaseService{
|
||||
//logger.info("http配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
/********************************contIp业务*********************************/
|
||||
/********************************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)
|
||||
public void saveOrUpdateContUrl(BaseStringCfg entity,String areaCfgIds){
|
||||
Date createTime=new Date();
|
||||
entity.setTableName("av_cont_url_cfg");
|
||||
//区域IPsetAreaEffectiveIds设置
|
||||
List<AreaIpCfg> areaCfg=entity.getAreaCfg();
|
||||
List<AreaBean> areaIsps=entity.getAreaIsp();
|
||||
if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){
|
||||
entity.setAreaEffectiveIds("");
|
||||
entity.setAreaType(null);
|
||||
}else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){
|
||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
||||
for(int i=0;i<areaIsps.size();i++){
|
||||
if(StringUtils.isNotBlank(areaIsps.get(i).getArea())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
||||
}else{
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}
|
||||
if(i!=areaIsps.size()-1){
|
||||
areaEffectiveIds.append(",");
|
||||
}
|
||||
}
|
||||
entity.setAreaEffectiveIds(areaEffectiveIds.toString());
|
||||
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==entity.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
|
||||
entity.setAreaEffectiveIds("");
|
||||
}
|
||||
}
|
||||
|
||||
//新增
|
||||
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){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
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();
|
||||
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
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)){
|
||||
Map<String,List> strMap = cfgConvert(strRegionList,list,2,entity,groupRelationList);
|
||||
groupRelationList=strMap.get("groupList");
|
||||
strRegionList=strMap.get("dstList");
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||
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());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
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);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("contIp配置下发配置参数:"+json);
|
||||
//TODO 调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
//logger.info("contIp配置下发响应信息:"+result.getMsg());
|
||||
|
||||
}else if(isAudit==3){
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("contIp配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
//logger.info("http配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
/********************************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)
|
||||
public void saveOrUpdatePicUrl(BaseStringCfg entity,String areaCfgIds){
|
||||
Date createTime=new Date();
|
||||
entity.setTableName("av_pic_url_cfg");
|
||||
//区域IPsetAreaEffectiveIds设置
|
||||
List<AreaIpCfg> areaCfg=entity.getAreaCfg();
|
||||
List<AreaBean> areaIsps=entity.getAreaIsp();
|
||||
if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){
|
||||
entity.setAreaEffectiveIds("");
|
||||
entity.setAreaType(null);
|
||||
}else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){
|
||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
||||
for(int i=0;i<areaIsps.size();i++){
|
||||
if(StringUtils.isNotBlank(areaIsps.get(i).getArea())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
||||
}else{
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}
|
||||
if(i!=areaIsps.size()-1){
|
||||
areaEffectiveIds.append(",");
|
||||
}
|
||||
}
|
||||
entity.setAreaEffectiveIds(areaEffectiveIds.toString());
|
||||
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==entity.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
|
||||
entity.setAreaEffectiveIds("");
|
||||
}
|
||||
}
|
||||
|
||||
//新增
|
||||
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){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
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();
|
||||
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
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)){
|
||||
Map<String,List> strMap = cfgConvert(strRegionList,list,2,entity,groupRelationList);
|
||||
groupRelationList=strMap.get("groupList");
|
||||
strRegionList=strMap.get("dstList");
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||
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());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
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);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("picUrl配置下发配置参数:"+json);
|
||||
//TODO 调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
//logger.info("picUrl配置下发响应信息:"+result.getMsg());
|
||||
|
||||
}else if(isAudit==3){
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("picUrl配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
//logger.info("http配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
/********************************picUrl业务*********************************/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user