(1)ip管控提交
(2)delRow.tag修改,删除的时候将编译ID也传过去 (3)配置取消修改,请求应当是put请求
This commit is contained in:
@@ -255,7 +255,7 @@ public class ConfigServiceUtil {
|
||||
WebTarget wt = ClientUtil.getWebTarger(url);
|
||||
//获取响应结果
|
||||
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
||||
Response response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||
Response response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||
if( response.getStatus() == 200){
|
||||
result= response.readEntity(String.class);
|
||||
JSONObject resObject = JSONObject.fromObject(result);
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/iplist")
|
||||
public class IpController extends BaseController{
|
||||
@RequestMapping(value = {"list"})
|
||||
@RequiresPermissions(value={"iplist:config","iplist:audit"},logical=Logical.OR)
|
||||
public String list(Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
Page<BaseIpCfg> searchPage=new Page<BaseIpCfg>(request,response,"r");
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/iplist/list";
|
||||
}
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions(value={"iplist:config"})
|
||||
public String form(Model model,String ids,BaseIpCfg entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = ipCfgService.getIpCfgById(IpPortCfg.getTablename(),Long.parseLong(ids));
|
||||
}
|
||||
if(entity.getCfgId()!=null){
|
||||
List<BaseIpCfg> areaCfg=ipCfgService.getListByComileId(AreaIpCfg.getTablename(), String.valueOf(entity.getCompileId()));
|
||||
model.addAttribute("areaCfgs", areaCfg);
|
||||
model.addAttribute("_cfg", entity);
|
||||
initUpdateFormCondition(model,entity);
|
||||
}else{
|
||||
IpPortCfg cfg=new IpPortCfg();
|
||||
cfg.initDefaultValueImpl();
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
cfg.setProtocolId(entity.getProtocolId());
|
||||
model.addAttribute("_cfg", cfg);
|
||||
initFormCondition(model,entity);
|
||||
}
|
||||
|
||||
return "/cfg/iplist/form";
|
||||
}
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
public String saveOrUpdate(RedirectAttributes model, IpPortCfg cfg) {
|
||||
Date date=new Date();
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
logger.info("saveOrUpdateIp loaded");
|
||||
try{
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
if(cfg.getCfgId()==null){//新增
|
||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
cfg.setCreateTime(date);
|
||||
ipCfgService.addIpCfg(cfg);
|
||||
}else{//修改
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
ipCfgService.updateIpCfg(cfg);
|
||||
}
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败",e);
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"delete"})
|
||||
@RequiresPermissions("iplist:config")
|
||||
public String delete(String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
try{
|
||||
ipCfgService.deleteIp(ids,compileIds,functionId.intValue());
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId;
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,8 @@ import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
|
||||
/**
|
||||
* 白名单
|
||||
@@ -105,11 +100,11 @@ public class WhiteListController extends BaseController{
|
||||
if(cfg.getCfgId()==null){//新增
|
||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
cfg.setCreateTime(date);
|
||||
ipCfgService.addIpCfg((BaseIpCfg)cfg,null);
|
||||
ipCfgService.addIpCfg(cfg);
|
||||
}else{//修改
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
ipCfgService.updateIpCfg((BaseIpCfg)cfg,null,null,null);
|
||||
ipCfgService.updateIpCfg(cfg);
|
||||
}
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
@@ -147,7 +142,7 @@ public class WhiteListController extends BaseController{
|
||||
@RequiresPermissions("whitelist:config")
|
||||
public String deleteIp(String ids,Integer functionId,RedirectAttributes model) {
|
||||
try{
|
||||
ipCfgService.deleteWhiteIp(ids);
|
||||
ipCfgService.deleteIp(ids,null,functionId.intValue());
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
|
||||
@@ -501,7 +501,7 @@
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
FUNCTION_ID=#{functionId,jdbcType=INTEGER}
|
||||
|
||||
@@ -126,13 +126,13 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void saveIpBatch(List<BaseIpCfg> areaIpCfgs) {
|
||||
public void saveIpBatch(List<AreaIpCfg> areaIpCfgs) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < areaIpCfgs.size();index++){
|
||||
BaseIpCfg t = areaIpCfgs.get(index);
|
||||
AreaIpCfg t = areaIpCfgs.get(index);
|
||||
((CrudDao<BaseIpCfg>) batchSqlSession.getMapper(IpCfgDao.class)).insert(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addStringCfg(ComplexkeywordCfg cfg,List<BaseIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
// this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
return complexStringCfgDao.insert(cfg);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateStringCfg(ComplexkeywordCfg cfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
// this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
||||
this.updateIpBatch(updateAreaCfg);
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
@@ -52,10 +53,10 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addIpCfg(BaseIpCfg baseIpCfg,List<BaseIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
public void addIpCfg(BaseIpCfg cfg){
|
||||
//区域IPsetAreaEffectiveIds设置
|
||||
List<AreaIpCfg> areaCfg=cfg.getAreaCfg();
|
||||
List<AreaBean> areaIsps=cfg.getAreaIsp();
|
||||
//调用服务接口获取compileId
|
||||
Integer compileId = 0;
|
||||
try {
|
||||
@@ -69,12 +70,71 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
if(compileId!=0){
|
||||
baseIpCfg.setCompileId(compileId);
|
||||
return ipCfgDao.insert(baseIpCfg);
|
||||
cfg.setCompileId(compileId);
|
||||
if(Constants.IS_AREA_EFFECTIVE_NO==cfg.getIsAreaEffective()){
|
||||
cfg.setAreaEffectiveIds("0");
|
||||
cfg.setAreaType(null);
|
||||
}else if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()){
|
||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==cfg.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())&&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).getArea());
|
||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
||||
}
|
||||
if(i!=areaIsps.size()-1){
|
||||
areaEffectiveIds.append(",");
|
||||
}
|
||||
}
|
||||
cfg.setAreaEffectiveIds(areaEffectiveIds.toString());
|
||||
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==cfg.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
|
||||
cfg.setAreaEffectiveIds("0");
|
||||
}
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
for(AreaIpCfg c:cfg.getAreaCfg()){
|
||||
c.initDefaultValue();
|
||||
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
|
||||
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
|
||||
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
}
|
||||
this.saveIpBatch(cfg.getAreaCfg());
|
||||
}
|
||||
}
|
||||
|
||||
ipCfgDao.insert(cfg);
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void addIpCfg(BaseIpCfg baseIpCfg,List<BaseIpCfg> areaIpCfgs){
|
||||
// if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
// this.saveIpBatch(areaIpCfgs);
|
||||
// }
|
||||
// //调用服务接口获取compileId
|
||||
// Integer compileId = 0;
|
||||
// try {
|
||||
// List<Integer> compileIds = ConfigServiceUtil.getId(1,1);
|
||||
// if(!StringUtil.isEmpty(compileIds)){
|
||||
// compileId = compileIds.get(0);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// logger.info("获取编译ID出错");
|
||||
// throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
// }
|
||||
// if(compileId!=0){
|
||||
// baseIpCfg.setCompileId(compileId);
|
||||
// return ipCfgDao.insert(baseIpCfg);
|
||||
// }else{
|
||||
// throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
// }
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -87,17 +147,71 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateIpCfg(BaseIpCfg baseIpCfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
public void updateIpCfg(BaseIpCfg cfg){
|
||||
AreaIpCfg area=new AreaIpCfg();
|
||||
area.setCompileId(cfg.getCompileId());
|
||||
area.setFunctionId(cfg.getFunctionId());
|
||||
areaIpCfgDao.deleteAreaIpCfg(area);
|
||||
//区域IPsetAreaEffectiveIds设置
|
||||
List<AreaIpCfg> areaCfg=cfg.getAreaCfg();
|
||||
List<AreaBean> areaIsps=cfg.getAreaIsp();
|
||||
if(Constants.IS_AREA_EFFECTIVE_NO==cfg.getIsAreaEffective()){
|
||||
cfg.setAreaEffectiveIds("0");
|
||||
cfg.setAreaType(null);
|
||||
}else if(Constants.IS_AREA_EFFECTIVE_YES==cfg.getIsAreaEffective()){
|
||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==cfg.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())&&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).getArea());
|
||||
}else if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getIsp());
|
||||
}
|
||||
if(i!=areaIsps.size()-1){
|
||||
areaEffectiveIds.append(",");
|
||||
}
|
||||
}
|
||||
cfg.setAreaEffectiveIds(areaEffectiveIds.toString());
|
||||
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==cfg.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
|
||||
cfg.setAreaEffectiveIds("0");
|
||||
}
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
for(AreaIpCfg c:cfg.getAreaCfg()){
|
||||
c.initDefaultValue();
|
||||
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
|
||||
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
|
||||
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
}
|
||||
this.saveIpBatch(cfg.getAreaCfg());
|
||||
}
|
||||
}
|
||||
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
||||
this.updateIpBatch(updateAreaCfg);
|
||||
}
|
||||
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
||||
this.deleteIpBatch(deleteAreaCfgs);
|
||||
}
|
||||
return ipCfgDao.update(baseIpCfg);
|
||||
ipCfgDao.update(cfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* updateIpCfg(更新IP类配置)
|
||||
* (继承BaseIpCfg这个类方可使用)
|
||||
* @param baseIpCfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void updateIpCfg(BaseIpCfg baseIpCfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
// if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
// this.saveIpBatch(addAreaCfg);
|
||||
// }
|
||||
// if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
||||
// this.updateIpBatch(updateAreaCfg);
|
||||
// }
|
||||
// if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
||||
// this.deleteIpBatch(deleteAreaCfgs);
|
||||
// }
|
||||
// return ipCfgDao.update(baseIpCfg);
|
||||
}
|
||||
public void auditWhiteIp(BaseIpCfg cfg) throws Exception{
|
||||
List<BaseIpCfg> beans=new ArrayList<>();
|
||||
@@ -160,11 +274,11 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(beans);
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("IP白名单配置参数:"+json);
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 1);
|
||||
logger.info("IP白名单取消配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -250,8 +364,36 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
}
|
||||
|
||||
}
|
||||
// @Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
// public void deleteWhiteIp(String ids){
|
||||
// List<BaseIpCfg> ipCfgs=new ArrayList<BaseIpCfg>();
|
||||
// Date date =new Date();
|
||||
// if(StringUtils.isNotBlank(ids)){
|
||||
// for(String idStr:ids.split(",")){
|
||||
// if(StringUtils.isNotBlank(idStr)){
|
||||
// BaseIpCfg cfg=new BaseIpCfg();
|
||||
// cfg.setCfgId(Long.parseLong(idStr));
|
||||
// cfg.setTableName(IpPortCfg.getTablename());
|
||||
// cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
// cfg.setEditTime(date);
|
||||
// cfg.setIsValid(Constants.VALID_DEL);
|
||||
// ipCfgs.add(cfg);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// this.deleteBatch(ipCfgs, IpCfgDao.class);
|
||||
// }
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deleteWhiteIp(String ids){
|
||||
public void deleteIp(String ids,String compileIds,int functionId){
|
||||
if(StringUtils.isNotBlank(compileIds)){
|
||||
for(String compileId:compileIds.split(",")){
|
||||
AreaIpCfg area=new AreaIpCfg();
|
||||
area.setCompileId(Integer.parseInt(compileId));
|
||||
area.setFunctionId(functionId);
|
||||
area.setIsValid(Constants.VALID_DEL);
|
||||
areaIpCfgDao.updateValid(area);
|
||||
}
|
||||
}
|
||||
List<BaseIpCfg> ipCfgs=new ArrayList<BaseIpCfg>();
|
||||
Date date =new Date();
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
|
||||
@@ -81,7 +81,7 @@ public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearc
|
||||
if(cfg.getAreaCfg()!=null&&cfg.getAreaCfg().size()>0){
|
||||
List<BaseIpCfg> areaCfg=new ArrayList<>();
|
||||
areaCfg.addAll(cfg.getAreaCfg());
|
||||
this.saveIpBatch(areaCfg);
|
||||
// this.saveIpBatch(areaCfg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearc
|
||||
}
|
||||
}
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
// this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
||||
this.updateIpBatch(updateAreaCfg);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class NumCfgService extends CrudService<NumCfgDao,NumBoundaryCfg> {
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addNumCfg(NumBoundaryCfg cfg,List<BaseIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
// this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
return numCfgDao.insert(cfg);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class NumCfgService extends CrudService<NumCfgDao,NumBoundaryCfg> {
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateNumCfg(NumBoundaryCfg cfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
// this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
||||
this.updateIpBatch(updateAreaCfg);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addStringCfg(BaseStringCfg baseStringCfg,List<BaseIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
// this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
//调用服务接口获取compileId
|
||||
Integer compileId = 0;
|
||||
@@ -88,7 +88,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateStringCfg(BaseStringCfg baseStringCfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
// this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
||||
this.updateIpBatch(updateAreaCfg);
|
||||
|
||||
Reference in New Issue
Block a user