(1)IP类配置页面修改,支持多选的删除,审核,操作按钮上移
(2)修复验证方法ipCheck影响多个IP配置的bug
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
*@Title: HttpsContentReplaceConfig.java
|
||||
*@Package com.nis.domain.restful
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年2月6日 上午10:30:46
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
/**
|
||||
* @ClassName: HttpsContentReplaceConfig.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2018年2月6日 上午10:30:46
|
||||
* @version V1.0
|
||||
*/
|
||||
public class HttpsContentReplaceCfg extends BaseStringCfg {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = -116828220692786004L;
|
||||
/**
|
||||
* 网站名称
|
||||
*/
|
||||
private String webName;
|
||||
/**
|
||||
* 源内容
|
||||
*/
|
||||
private String srcContent;
|
||||
/**
|
||||
* 替换内容
|
||||
*/
|
||||
private String destContent;
|
||||
/**
|
||||
* webName
|
||||
* @return webName
|
||||
*/
|
||||
|
||||
public String getWebName() {
|
||||
return webName;
|
||||
}
|
||||
/**
|
||||
* @param webName the webName to set
|
||||
*/
|
||||
public void setWebName(String webName) {
|
||||
this.webName = webName;
|
||||
}
|
||||
/**
|
||||
* srcContent
|
||||
* @return srcContent
|
||||
*/
|
||||
|
||||
public String getSrcContent() {
|
||||
return srcContent;
|
||||
}
|
||||
/**
|
||||
* @param srcContent the srcContent to set
|
||||
*/
|
||||
public void setSrcContent(String srcContent) {
|
||||
this.srcContent = srcContent;
|
||||
}
|
||||
/**
|
||||
* destContent
|
||||
* @return destContent
|
||||
*/
|
||||
|
||||
public String getDestContent() {
|
||||
return destContent;
|
||||
}
|
||||
/**
|
||||
* @param destContent the destContent to set
|
||||
*/
|
||||
public void setDestContent(String destContent) {
|
||||
this.destContent = destContent;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.nis.domain.configuration.BaseStringCfg#initDefaultValue()
|
||||
*/
|
||||
@Override
|
||||
public void initDefaultValue() {
|
||||
// TODO Auto-generated method stub
|
||||
super.initDefaultValue();
|
||||
this.exprType=0;
|
||||
this.matchMethod=3;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,19 +19,20 @@ import java.util.Map;
|
||||
* @version V1.0
|
||||
*/
|
||||
public class MultipleCfg extends BaseCfg<MultipleCfg> {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = -8369567908781421920L;
|
||||
/**
|
||||
* 配置关系表,一个compileId 中有哪些表存了数据
|
||||
*/
|
||||
private MultipleCfgRelation relation;
|
||||
private String mainTable;
|
||||
private String mainTableType;
|
||||
private String mainTableDesc;
|
||||
private List<TableBean> otherTables;//key 表名,value 类型
|
||||
// private BaseCfg mainCfg;
|
||||
//ip配置
|
||||
private Map<String,BaseIpCfg> ipCfg;
|
||||
//字符串配置
|
||||
@@ -168,4 +169,18 @@ public class MultipleCfg extends BaseCfg<MultipleCfg> {
|
||||
public void setMainTableDesc(String mainTableDesc) {
|
||||
this.mainTableDesc = mainTableDesc;
|
||||
}
|
||||
/**
|
||||
* relation
|
||||
* @return relation
|
||||
*/
|
||||
|
||||
public MultipleCfgRelation getRelation() {
|
||||
return relation;
|
||||
}
|
||||
/**
|
||||
* @param relation the relation to set
|
||||
*/
|
||||
public void setRelation(MultipleCfgRelation relation) {
|
||||
this.relation = relation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
*@Title: MultipleCfgRelation.java
|
||||
*@Package com.nis.domain.configuration
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年4月10日 上午11:11:53
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName: MultipleCfgRelation.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2018年4月10日 上午11:11:53
|
||||
* @version V1.0
|
||||
*/
|
||||
public class MultipleCfgRelation implements Serializable{
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = -615924510840736781L;
|
||||
private int compileId;
|
||||
private String tableName;
|
||||
private int isValid;
|
||||
/**
|
||||
* compileId
|
||||
* @return compileId
|
||||
*/
|
||||
|
||||
public int getCompileId() {
|
||||
return compileId;
|
||||
}
|
||||
/**
|
||||
* @param compileId the compileId to set
|
||||
*/
|
||||
public void setCompileId(int compileId) {
|
||||
this.compileId = compileId;
|
||||
}
|
||||
/**
|
||||
* tableName
|
||||
* @return tableName
|
||||
*/
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
/**
|
||||
* @param tableName the tableName to set
|
||||
*/
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
/**
|
||||
* isValid
|
||||
* @return isValid
|
||||
*/
|
||||
|
||||
public int getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
/**
|
||||
* @param isValid the isValid to set
|
||||
*/
|
||||
public void setIsValid(int isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,6 +8,7 @@ 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.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -31,12 +33,9 @@ import com.nis.web.controller.BaseController;
|
||||
public class IpCfgController extends BaseController{
|
||||
/**
|
||||
*
|
||||
* ipCfgList(配置列表与审核列表,需要根据参数判断是哪个列表,以便显示隐藏对应的界面菜单,按钮)
|
||||
* cfgList(配置列表)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param model
|
||||
* @param audit
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cfgName
|
||||
* @param ipCfg
|
||||
* @param request
|
||||
@@ -46,7 +45,32 @@ public class IpCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// @RequestMapping(value = {"cfgList"})
|
||||
// @RequiresPermissions("cfg:ip:edit")
|
||||
// public String cfgList(Model model,String cfgName,@ModelAttribute("ipCfg")BaseIpCfg ipCfg,HttpServletRequest request,HttpServletResponse response){
|
||||
// return ipCfgList(model,Constants.CFG_PAGE,cfgName,ipCfg,request,response);
|
||||
// }
|
||||
/**
|
||||
*
|
||||
* auditList(审核列表)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param model
|
||||
* @param cfgName
|
||||
* @param ipCfg
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// @RequestMapping(value = {"auditList"})
|
||||
// @RequiresPermissions("cfg:ip:audit")
|
||||
// public String auditList(Model model,String cfgName,@ModelAttribute("ipCfg")BaseIpCfg ipCfg,HttpServletRequest request,HttpServletResponse response){
|
||||
// return ipCfgList(model,Constants.AUDIT_PAGE,cfgName,ipCfg,request,response);
|
||||
// }
|
||||
@RequestMapping(value = {"list"})
|
||||
@RequiresPermissions(value={"cfg:ip:add","cfg:ip:edit","cfg:ip:delete","cfg:ip:audit"},logical=Logical.OR)
|
||||
public String ipCfgList(Model model,Integer audit,String cfgName,@ModelAttribute("ipCfg")BaseIpCfg ipCfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", audit);
|
||||
@@ -61,7 +85,21 @@ public class IpCfgController extends BaseController{
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
ipCfg.setTableName(tableName);
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(new Page<BaseIpCfg>(request,response,"r"), ipCfg);
|
||||
Page<BaseIpCfg> searchPage=new Page<BaseIpCfg>(request,response,"r");
|
||||
String addWhrere=null;
|
||||
if(audit==Constants.CFG_PAGE){//
|
||||
addWhrere="r.is_audit in ("+Constants.AUDIT_NOT_YET+","+Constants.AUDIT_NO+")";
|
||||
}else if(audit==Constants.AUDIT_PAGE){
|
||||
addWhrere="r.is_audit in ("+Constants.AUDIT_NOT_YET+","+Constants.AUDIT_YES+")";
|
||||
}
|
||||
if(addWhrere!=null){
|
||||
if(StringUtils.isNotBlank(searchPage.getWhere())){
|
||||
searchPage.setWhere(searchPage.getWhere()+" AND "+addWhrere);
|
||||
}else{
|
||||
searchPage.setWhere(addWhrere);
|
||||
}
|
||||
}
|
||||
Page<BaseIpCfg> page = ipCfgService.findPage(searchPage, ipCfg);
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("action", ipCfg.getAction());
|
||||
model.addAttribute("tableName", tableName);
|
||||
@@ -72,7 +110,6 @@ public class IpCfgController extends BaseController{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "/cfg/ipCfgList";
|
||||
}
|
||||
|
||||
@@ -92,6 +129,7 @@ public class IpCfgController extends BaseController{
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"form"})
|
||||
@RequiresPermissions("cfg:ip:add")
|
||||
public String ipCfgForm(int action,String cfgName,Integer serviceId,Model model,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
@@ -152,9 +190,9 @@ public class IpCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequiresPermissions("sys:cfg:edit")
|
||||
@RequiresPermissions("cfg:ip:edit")
|
||||
@RequestMapping(value = {"updateForm"})
|
||||
public String updateIpCfgForm(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model) {
|
||||
public String updateIpCfgForm(String tableName,int action,int compileId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
@@ -169,9 +207,9 @@ public class IpCfgController extends BaseController{
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
BaseIpCfg searchBean=new BaseIpCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
searchBean.setCompileId(compileId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseIpCfg ipCfg=ipCfgService.getIpCfgById(searchBean);
|
||||
BaseIpCfg ipCfg=ipCfgService.get(searchBean);
|
||||
model.addAttribute("_cfg", ipCfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
initUpdateFormCondition(model,ipCfg);
|
||||
@@ -194,6 +232,7 @@ public class IpCfgController extends BaseController{
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"saveOrUpdateCfg"})
|
||||
@RequiresPermissions(value={"cfg:ip:add","cfg:ip:edit"},logical=Logical.OR)
|
||||
public String saveOrUpdateIpCfg(String cfgName,Model model, BaseIpCfg ipCfg,String areaCfgIds) {
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
@@ -220,50 +259,65 @@ public class IpCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"auditCfg"})
|
||||
public String auditIpCfg(String cfgName,BaseIpCfg ipCfg,Model model) {
|
||||
@RequestMapping(value = {"audit"})
|
||||
@RequiresPermissions("cfg:ip:audit")
|
||||
public String auditIpCfg(String cfgName,int serviceId,int isAudit,int action,String tableName,String ids,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
model.addAttribute("serviceId", ipCfg.getServiceId());
|
||||
model.addAttribute("action", ipCfg.getAction());
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
try{
|
||||
String tableName=ipCfg.getTableName();
|
||||
String maatTable=null;
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(ipCfg.getServiceId());
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
ipCfg.setTableName(tableName);
|
||||
}
|
||||
maatTable=serviceConfigInfo.getMaatTable();
|
||||
}
|
||||
BaseIpCfg bean=ipCfgService.getIpCfgById(ipCfg);
|
||||
bean.setTableName(tableName);
|
||||
int audit=bean.getIsAudit().intValue();
|
||||
if(audit==Constants.AUDIT_YES&&ipCfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
ipCfg.setAuditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setAuditTime(new Date());
|
||||
bean.setIsAudit(ipCfg.getIsAudit());
|
||||
if(ipCfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
ipCfg.setIsValid(Constants.VALID_NO);
|
||||
bean.setIsValid(Constants.VALID_NO);
|
||||
bean.setMaatTable(maatTable);
|
||||
}else if(ipCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
ipCfg.setIsValid(Constants.VALID_YES);
|
||||
bean.setIsValid(Constants.VALID_YES);
|
||||
bean.setMaatTable(maatTable);
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
List<BaseIpCfg> beans=ipCfgService.getList(tableName,ids);
|
||||
List<BaseIpCfg> auditBeans=new ArrayList<>();
|
||||
List<AreaIpCfg> auditAreaBeans=new ArrayList<>();
|
||||
Date date=new Date();
|
||||
for(BaseIpCfg bean:beans){
|
||||
BaseIpCfg auditBean=new BaseIpCfg();
|
||||
auditBean.setTableName(tableName);
|
||||
auditBean.setCfgId(bean.getCfgId());
|
||||
bean.setTableName(tableName);
|
||||
int audit=bean.getIsAudit().intValue();
|
||||
if(audit==Constants.AUDIT_YES&&isAudit!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
addMessage(model, "audit_failed");
|
||||
return "/cfg/resultPage";
|
||||
}else{
|
||||
auditBean.setAuditorId(bean.getCurrentUser().getId());
|
||||
auditBean.setAuditTime(date);
|
||||
auditBean.setIsAudit(isAudit);
|
||||
bean.setAuditorId(bean.getCurrentUser().getId());
|
||||
bean.setAuditTime(date);
|
||||
bean.setIsAudit(isAudit);
|
||||
if(isAudit==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
auditBean.setIsValid(Constants.VALID_NO);
|
||||
auditBean.setMaatTable(maatTable);
|
||||
bean.setIsValid(Constants.VALID_NO);
|
||||
bean.setMaatTable(maatTable);
|
||||
}else if(isAudit==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
auditBean.setIsValid(Constants.VALID_YES);
|
||||
auditBean.setMaatTable(maatTable);
|
||||
bean.setIsValid(Constants.VALID_YES);
|
||||
bean.setMaatTable(maatTable);
|
||||
}
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(bean.getCompileId());
|
||||
bean.setAreaCfg(areaCfg);
|
||||
auditAreaBeans.addAll(areaCfg);
|
||||
}
|
||||
auditBeans.add(auditBean);
|
||||
}
|
||||
int result=ipCfgService.auditIpCfg(bean,ipCfg);
|
||||
if(result!=0){
|
||||
addMessage(model,"audit_success");
|
||||
}else{
|
||||
addMessage(model, "audit_failed");
|
||||
}
|
||||
|
||||
ipCfgService.auditIpCfg(isAudit,auditBeans,auditAreaBeans,beans);
|
||||
}
|
||||
addMessage(model,"audit_success");
|
||||
}catch(Exception e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(model, "audit_failed");
|
||||
@@ -272,16 +326,16 @@ public class IpCfgController extends BaseController{
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditIpCfg(删除IP配置,逻辑删除)
|
||||
* deleteIpCfg(删除IP配置,逻辑删除)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequiresPermissions("sys:cfg:edit")
|
||||
@RequestMapping(value = {"deleteCfg"})
|
||||
public String deleteIpCfg(String tableName,int action,long cfgId,int compileId,String cfgName,Integer serviceId,Model model) {
|
||||
@RequiresPermissions("cfg:ip:edit")
|
||||
@RequestMapping(value = {"delete"})
|
||||
public String deleteIpCfg(String tableName,int action,String ids,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
@@ -296,31 +350,58 @@ public class IpCfgController extends BaseController{
|
||||
}
|
||||
}
|
||||
model.addAttribute("tableName", tableName);
|
||||
int audit=ipCfgService.getIsAudit(tableName,cfgId);
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(compileId);
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
List<BaseIpCfg> ipCfgs=new ArrayList<BaseIpCfg>();
|
||||
List<AreaIpCfg> areaCfgs=new ArrayList<AreaIpCfg>();
|
||||
Date date =new Date();
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
for(String compileIdStr:ids.split(",")){
|
||||
if(StringUtils.isNotBlank(compileIdStr)){
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(Integer.parseInt(compileIdStr));
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
c.setEditorId(c.getCurrentUser().getId());
|
||||
c.setEditTime(date);
|
||||
}
|
||||
}
|
||||
areaCfgs.addAll(areaCfg);
|
||||
BaseIpCfg ipCfg=new BaseIpCfg();
|
||||
ipCfg.setCompileId(Integer.parseInt(compileIdStr));
|
||||
ipCfg.setTableName(tableName);
|
||||
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setEditTime(date);
|
||||
ipCfg.setIsValid(Constants.VALID_DEL);
|
||||
ipCfgs.add(ipCfg);
|
||||
}
|
||||
}
|
||||
// int audit=ipCfgService.getIsAudit(tableName,cfgId);
|
||||
// List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(compileId);
|
||||
// if(areaCfg!=null&&areaCfg.size()>0){
|
||||
// for(AreaIpCfg c:areaCfg){
|
||||
// c.setTableName(AreaIpCfg.getTablename());
|
||||
// }
|
||||
// }
|
||||
//未审核时可删除
|
||||
// if(audit!=Constants.AUDIT_YES&&audit!=Constants.AUDIT_NOT_YES){
|
||||
// BaseIpCfg ipCfg=new BaseIpCfg();
|
||||
// ipCfg.setCfgId(cfgId);
|
||||
// ipCfg.setTableName(tableName);
|
||||
// ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
// ipCfg.setEditTime(new Date());
|
||||
// ipCfg.setIsValid(Constants.VALID_DEL);
|
||||
// int result=ipCfgService.deleteIpCfg(ipCfg,areaCfg);
|
||||
// if(result==0){
|
||||
// addMessage(model,"delete_failed");
|
||||
// }else{
|
||||
// addMessage(model,"delete_success");
|
||||
// }
|
||||
// }else{
|
||||
// logger.error("通过审核/取消审核通过的配置不能删除!");
|
||||
// addMessage(model,"delete_failed");
|
||||
// }
|
||||
}
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES&&audit!=Constants.AUDIT_NOT_YES){
|
||||
BaseIpCfg ipCfg=new BaseIpCfg();
|
||||
ipCfg.setCfgId(cfgId);
|
||||
ipCfg.setTableName(tableName);
|
||||
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setEditTime(new Date());
|
||||
ipCfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=ipCfgService.deleteIpCfg(ipCfg,areaCfg);
|
||||
if(result==0){
|
||||
addMessage(model,"delete_failed");
|
||||
}else{
|
||||
addMessage(model,"delete_success");
|
||||
}
|
||||
}else{
|
||||
logger.error("通过审核/取消审核通过的配置不能删除!");
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
ipCfgService.deleteIpCfg(ipCfgs,areaCfgs);
|
||||
addMessage(model,"delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"delete_failed");
|
||||
|
||||
@@ -61,5 +61,15 @@ public interface CrudDao<T> {
|
||||
* @return
|
||||
*/
|
||||
public int delete(T entity);
|
||||
|
||||
/**
|
||||
* audit(审核数据)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param t
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int audit(T entity);
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ public interface IpCfgDao extends CrudDao<BaseIpCfg>{
|
||||
public BaseIpCfg getById(@Param("tableName")String tableName,@Param("cfgId")Long id) ;
|
||||
public BaseIpCfg get(BaseIpCfg entity) ;
|
||||
public List<BaseIpCfg> findList(BaseIpCfg entity) ;
|
||||
public List<BaseIpCfg> getList(@Param("tableName")String tableName,@Param("ids")String ids) ;
|
||||
public int insert(BaseIpCfg entity) ;
|
||||
public int updateByPrimaryKeySelective(BaseIpCfg entity) ;
|
||||
public int updateValid(BaseIpCfg entity) ;
|
||||
|
||||
@@ -161,6 +161,11 @@
|
||||
AND IS_VALID!=-1
|
||||
</trim>
|
||||
</select>
|
||||
<select id="getList" resultMap="BaseIpMap" >
|
||||
SELECT
|
||||
<include refid="BaseIpCfg_Column_List_with_id" />
|
||||
FROM ${tableName} WHERE IS_VALID!=-1 AND COMPILE_ID in (${ids})
|
||||
</select>
|
||||
<select id="findList" resultMap="BaseIpMapWithUser">
|
||||
select
|
||||
<!--<choose>
|
||||
@@ -538,7 +543,7 @@
|
||||
<update id="updateValid" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="audit" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
<update id="audit">
|
||||
update ${tableName} set is_audit = #{isAudit,jdbcType=INTEGER}, auditor_id = #{auditorId,jdbcType=INTEGER}, audit_time = #{auditTime,jdbcType=TIMESTAMP}
|
||||
<if test="isValid != null" >
|
||||
,is_valid = #{isValid,jdbcType=INTEGER}
|
||||
@@ -554,7 +559,15 @@
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="delete" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
update ${tableName} set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
update ${tableName} set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP}
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="cfgId !=null ">
|
||||
AND cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="compileId !=null ">
|
||||
AND compile_id = #{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</trim>
|
||||
</update>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
update ${tableName} set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER}
|
||||
|
||||
@@ -123,15 +123,21 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
((CrudDao<T>) batchSqlSession.getMapper(mClass)).insert(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* saveIpBatch(非Ip类配置调用,批量新增区域IP)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param areaIpCfgs
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void saveIpBatch(List<AreaIpCfg> areaIpCfgs) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
@@ -142,9 +148,6 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
((CrudDao<BaseIpCfg>) batchSqlSession.getMapper(IpCfgDao.class)).insert(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
@@ -171,16 +174,21 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
((CrudDao<T>) batchSqlSession.getMapper(mClass)).update(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
/**
|
||||
*
|
||||
* updateIpBatch(非IP类配置调用,批量更新区域IP)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param areaCfg
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void updateIpBatch(List<AreaIpCfg> areaCfg) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
@@ -191,9 +199,6 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
((CrudDao<BaseIpCfg>) batchSqlSession.getMapper(IpCfgDao.class)).update(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
@@ -221,15 +226,72 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
((CrudDao<T>) batchSqlSession.getMapper(mClass)).delete(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditBatch(批量审核)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param data 数据集合
|
||||
* @param mClass 传入的dao.xml里的mapper
|
||||
* @author wx
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void auditBatch(List<T> data,@SuppressWarnings("rawtypes") Class mClass) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
T t = data.get(index);
|
||||
((CrudDao<T>) batchSqlSession.getMapper(mClass)).audit(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditIpBatch(非IP类配置用,审核区域IP)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param data
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void auditIpBatch(List<AreaIpCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
BaseIpCfg t = data.get(index);
|
||||
((CrudDao<BaseIpCfg>) batchSqlSession.getMapper(IpCfgDao.class)).audit(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* deleteIpBatch(非IP类配置调用,批量删除区域IP)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param data
|
||||
*void
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public void deleteIpBatch(List<AreaIpCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
@@ -240,15 +302,238 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
((CrudDao<BaseIpCfg>) batchSqlSession.getMapper(IpCfgDao.class)).delete(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* sendToMaatConvertorBatch(批量转换配置到maat转换工具)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param operation
|
||||
* @param cfgs
|
||||
* @return
|
||||
* @throws Exception
|
||||
*boolean
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean sendToMaatConvertorBatch(int operation,List<BaseCfg[]> cfgs) throws Exception{
|
||||
if(cfgs==null){
|
||||
throw new RuntimeException("转换出错,配置为空");
|
||||
}
|
||||
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
||||
/*.setPrettyPrinting().serializeNulls()*/
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
if(Constants.AUDIT_NOT_YES==operation){
|
||||
List<ToMaatUnAuditBean> beans=new ArrayList<ToMaatUnAuditBean>();
|
||||
for(BaseCfg[] cfg:cfgs){
|
||||
ToMaatUnAuditBean toMaatUnAuditBean=new ToMaatUnAuditBean();
|
||||
toMaatUnAuditBean.setServiceCfg(new ArrayList<UnAuditBean>());
|
||||
for(BaseCfg c:cfg){
|
||||
if(c.getCompileId()==null||c.getCompileId()==0){
|
||||
throw new RuntimeException("转换出错,未获取到正确的compileId");
|
||||
}
|
||||
if(StringUtils.isBlank(c.getMaatTable())){
|
||||
throw new RuntimeException("转换出错,未获取到正确的maatTalbe");
|
||||
}
|
||||
//针对含有多个maatTable的表
|
||||
if(c.getMaatTable().contains(",")){
|
||||
for(String maatTable:c.getMaatTable().split(",")){
|
||||
UnAuditBean bean=new UnAuditBean();
|
||||
bean.setCompileId(c.getCompileId());
|
||||
bean.setMaatTable(maatTable);
|
||||
toMaatUnAuditBean.getServiceCfg().add(bean);
|
||||
}
|
||||
}else{
|
||||
UnAuditBean bean=new UnAuditBean();
|
||||
bean.setCompileId(c.getCompileId());
|
||||
bean.setMaatTable(c.getMaatTable());
|
||||
toMaatUnAuditBean.getServiceCfg().add(bean);
|
||||
}
|
||||
|
||||
}
|
||||
beans.add(toMaatUnAuditBean);
|
||||
}
|
||||
String json=gson.toJson(beans);
|
||||
logger.info("to maat json:"+json);
|
||||
//发送至maat,待完成
|
||||
return new ConvertTool().setConfigInValid(json);
|
||||
}else{
|
||||
List<ToMaatBean> beans=new ArrayList<ToMaatBean>();
|
||||
for(BaseCfg[] cfg:cfgs){
|
||||
int compileId=0;
|
||||
ToMaatBean toMaatBean=new ToMaatBean();
|
||||
toMaatBean.setServiceCfg(new ArrayList<MaatCfg>());
|
||||
MaatCfg maatCfg=new MaatCfg();
|
||||
for(BaseCfg c:cfg){
|
||||
if(c instanceof BaseIpCfg){
|
||||
compileId=compileId==0?c.getCompileId():compileId;
|
||||
int protocolId= ((BaseIpCfg) c).getProtocolId().intValue();
|
||||
String maatTable=c.getMaatTable();
|
||||
if(maatTable.contains(",")){
|
||||
if(protocolId!=0){
|
||||
for(String _maatTable:maatTable.split(",")){
|
||||
if(_maatTable.toLowerCase().indexOf("ip")>-1){
|
||||
BaseIpCfg ipCfg=(BaseIpCfg)c.clone();
|
||||
ipCfg.setMaatTable(_maatTable);
|
||||
if(maatCfg.getIpCfg()==null){
|
||||
List<BaseIpCfg> list=new ArrayList<>();
|
||||
list.add(ipCfg);
|
||||
maatCfg.setIpCfg(list);
|
||||
}else{
|
||||
List<BaseIpCfg> list=maatCfg.getIpCfg();
|
||||
list.add(ipCfg);
|
||||
}
|
||||
}else{
|
||||
NumBoundaryCfg numCfg=new NumBoundaryCfg();
|
||||
numCfg.initDefaultValue();
|
||||
numCfg.setLowBounadry((long)protocolId);
|
||||
numCfg.setUpBoundary((long)protocolId);
|
||||
numCfg.setMaatTable(_maatTable);
|
||||
if(maatCfg.getNumCfg()==null){
|
||||
List<NumBoundaryCfg> numlist=new ArrayList<>();
|
||||
numlist.add(numCfg);
|
||||
maatCfg.setNumCfg(numlist);
|
||||
}else{
|
||||
List<NumBoundaryCfg> numlist=maatCfg.getNumCfg();
|
||||
numlist.add(numCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("protocolId等于0,却对应两个maat_table "+maatTable);
|
||||
}
|
||||
}else{
|
||||
if(maatCfg.getIpCfg()==null){
|
||||
List<BaseIpCfg> list=new ArrayList<>();
|
||||
list.add((BaseIpCfg)c);
|
||||
maatCfg.setIpCfg(list);
|
||||
}else{
|
||||
List<BaseIpCfg> list=maatCfg.getIpCfg();
|
||||
list.add((BaseIpCfg)c);
|
||||
}
|
||||
}
|
||||
}else if(c instanceof BaseStringCfg){
|
||||
compileId=compileId==0?c.getCompileId():compileId;
|
||||
String maatTable=c.getMaatTable();
|
||||
if(maatTable.contains(",")){
|
||||
for(String _maatTable:maatTable.split(",")){
|
||||
BaseStringCfg strCfg=(BaseStringCfg)c.clone();
|
||||
strCfg.setMaatTable(_maatTable);
|
||||
if(maatCfg.getStrCfg()==null){
|
||||
List<BaseStringCfg> list=new ArrayList<BaseStringCfg>();
|
||||
list.add(strCfg);
|
||||
maatCfg.setStrCfg(list);
|
||||
}else{
|
||||
List<BaseStringCfg> list=maatCfg.getStrCfg();
|
||||
list.add(strCfg);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(maatCfg.getStrCfg()==null){
|
||||
List<BaseStringCfg> list=new ArrayList<BaseStringCfg>();
|
||||
list.add((BaseStringCfg)c);
|
||||
maatCfg.setStrCfg(list);
|
||||
}else{
|
||||
List<BaseStringCfg> list=maatCfg.getStrCfg();
|
||||
list.add((BaseStringCfg)c);
|
||||
}
|
||||
}
|
||||
}else if(c instanceof ComplexkeywordCfg){
|
||||
compileId=compileId==0?c.getCompileId():compileId;
|
||||
String maatTable=c.getMaatTable();
|
||||
if(maatTable.contains(",")){
|
||||
for(String _maatTable:maatTable.split(",")){
|
||||
ComplexkeywordCfg complexCfg=(ComplexkeywordCfg)c.clone();
|
||||
complexCfg.setMaatTable(_maatTable);
|
||||
if(maatCfg.getComplexStrCfg()==null){
|
||||
List<ComplexkeywordCfg> list=new ArrayList<ComplexkeywordCfg>();
|
||||
list.add(complexCfg);
|
||||
maatCfg.setComplexStrCfg(list);
|
||||
}else{
|
||||
List<ComplexkeywordCfg> list=maatCfg.getComplexStrCfg();
|
||||
list.add(complexCfg);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(maatCfg.getComplexStrCfg()==null){
|
||||
List<ComplexkeywordCfg> list=new ArrayList<ComplexkeywordCfg>();
|
||||
list.add((ComplexkeywordCfg)c);
|
||||
maatCfg.setComplexStrCfg(list);
|
||||
}else{
|
||||
List<ComplexkeywordCfg> list=maatCfg.getComplexStrCfg();
|
||||
list.add((ComplexkeywordCfg)c);
|
||||
}
|
||||
}
|
||||
|
||||
}else if(c instanceof NumBoundaryCfg){
|
||||
compileId=compileId==0?c.getCompileId():compileId;
|
||||
if(maatCfg.getNumCfg()==null){
|
||||
List<NumBoundaryCfg> list=new ArrayList<NumBoundaryCfg>();
|
||||
list.add((NumBoundaryCfg)c);
|
||||
maatCfg.setNumCfg(list);
|
||||
}else{
|
||||
List<NumBoundaryCfg> list=maatCfg.getNumCfg();
|
||||
list.add((NumBoundaryCfg)c);
|
||||
}
|
||||
}
|
||||
if(c.getAreaCfg()!=null){
|
||||
if(toMaatBean.getAreaCfg()!=null){
|
||||
toMaatBean.getAreaCfg().addAll(c.getAreaCfg());
|
||||
}else{
|
||||
toMaatBean.setAreaCfg(new ArrayList<AreaIpCfg>());
|
||||
toMaatBean.getAreaCfg().addAll(c.getAreaCfg());
|
||||
}
|
||||
}
|
||||
}
|
||||
toMaatBean.getServiceCfg().add(maatCfg);
|
||||
BaseCfg baseCfg=(BaseCfg)cfg[0];
|
||||
if(compileId==0){
|
||||
throw new RuntimeException("转换出错,未获取到正确的compileId");
|
||||
}else{
|
||||
toMaatBean.setCompileId(compileId);
|
||||
}
|
||||
if(baseCfg.getAction()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的action");
|
||||
}else{
|
||||
toMaatBean.setAction(baseCfg.getAction());
|
||||
}
|
||||
if(baseCfg.getIsAreaEffective()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的isAreaEffective");
|
||||
}else{
|
||||
toMaatBean.setIsAreaEffective(baseCfg.getIsAreaEffective());
|
||||
}
|
||||
if(baseCfg.getIsValid()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的isValid");
|
||||
}else{
|
||||
toMaatBean.setIsValid(baseCfg.getIsValid());
|
||||
}
|
||||
if(baseCfg.getRequestId()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的requestId");
|
||||
}else{
|
||||
toMaatBean.setRequestId(baseCfg.getRequestId());
|
||||
}
|
||||
if(baseCfg.getServiceId()==null){
|
||||
throw new RuntimeException("转换出错,未获取到正确的serviceId");
|
||||
}else{
|
||||
toMaatBean.setServiceId(baseCfg.getServiceId());
|
||||
}
|
||||
toMaatBean.setAreaEffectiveIds(baseCfg.getAreaEffectiveIds()==null?"":baseCfg.getAreaEffectiveIds());
|
||||
toMaatBean.setAttribute(baseCfg.getAttribute()==null?"":baseCfg.getAttribute());
|
||||
toMaatBean.setClassify(baseCfg.getClassify()==null?"":baseCfg.getClassify());
|
||||
toMaatBean.setLable(baseCfg.getLable()==null?"":baseCfg.getLable());
|
||||
beans.add(toMaatBean);
|
||||
}
|
||||
String json=gson.toJson(beans);
|
||||
logger.info("to maat json:"+json);
|
||||
//发送至maat,待完成
|
||||
return new ConvertTool().saveConfig(json);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* sendToMaatConvertor(转换配置为Maat格式)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -7,6 +8,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||
@@ -76,17 +78,28 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int auditIpCfg(BaseIpCfg sendCfg,BaseIpCfg baseIpCfg) throws Exception{
|
||||
if(Constants.AUDIT_NOT_YES==baseIpCfg.getIsAudit().intValue()||
|
||||
Constants.AUDIT_YES==baseIpCfg.getIsAudit().intValue()){//审核通过,取消审核通过需要发到maat
|
||||
if(sendToMaatConvertor(baseIpCfg.getIsAudit(),null,sendCfg)){
|
||||
return ipCfgDao.audit(baseIpCfg);
|
||||
public void auditIpCfg(int isAduit,List<BaseIpCfg> auditCfg,List<AreaIpCfg> areaCfg,List<BaseIpCfg> sendCfg) throws Exception{
|
||||
List<BaseCfg[]> sendCfgs=new ArrayList<BaseCfg[]>();
|
||||
for(BaseIpCfg c:sendCfg){
|
||||
BaseCfg[] cArr=new BaseCfg[1];
|
||||
cArr[0]=c;
|
||||
sendCfgs.add(cArr);
|
||||
}
|
||||
if(Constants.AUDIT_NOT_YES==isAduit||
|
||||
Constants.AUDIT_YES==isAduit){//审核通过,取消审核通过需要发到maat
|
||||
if(sendToMaatConvertorBatch(isAduit,sendCfgs)){
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
this.auditIpBatch(areaCfg);
|
||||
}
|
||||
this.auditBatch(auditCfg, IpCfgDao.class);
|
||||
}
|
||||
}else{
|
||||
return ipCfgDao.audit(baseIpCfg);
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
this.auditIpBatch(areaCfg);
|
||||
}
|
||||
this.auditBatch(auditCfg, IpCfgDao.class);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -99,11 +112,16 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteIpCfg(BaseIpCfg baseIpCfg, List<AreaIpCfg> areaCfg){
|
||||
public void deleteIpCfg(List<BaseIpCfg> baseIpCfg, List<AreaIpCfg> areaCfg){
|
||||
List<BaseIpCfg> cfgs=new ArrayList<>();
|
||||
cfgs.addAll(areaCfg);
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
this.deleteIpBatch(areaCfg);
|
||||
this.deleteBatch(cfgs,IpCfgDao.class);
|
||||
}
|
||||
return ipCfgDao.updateValid(baseIpCfg);
|
||||
if(baseIpCfg!=null&&baseIpCfg.size()>0){
|
||||
this.deleteBatch(baseIpCfg, IpCfgDao.class);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -134,4 +152,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
public List<AreaIpCfg> getAreaCfgByCompileId(int compileId){
|
||||
return areaIpCfgDao.getByCompileId(compileId);
|
||||
}
|
||||
public List<BaseIpCfg> getList(String tableName,String ids){
|
||||
return ipCfgDao.getList(tableName,ids);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user