(1)删除配置时级联删除配置相关的区域IP
(2)修复ip配置删除完成跳转到审核菜单的bug
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
package com.nis.persistence.interceptor;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.ibatis.executor.ErrorContext;
|
||||
import org.apache.ibatis.executor.ExecutorException;
|
||||
import org.apache.ibatis.logging.Log;
|
||||
@@ -28,19 +36,9 @@ import com.nis.persistence.dialect.OracleDialect;
|
||||
import com.nis.persistence.dialect.PostgreSQLDialect;
|
||||
import com.nis.persistence.dialect.SQLServer2005Dialect;
|
||||
import com.nis.persistence.dialect.SybaseDialect;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Reflections;
|
||||
import com.nis.util.StringUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* SQL工具类
|
||||
*
|
||||
@@ -202,7 +200,7 @@ public class SQLHelper {
|
||||
}
|
||||
return count;
|
||||
} finally {
|
||||
logger.info("oracle查询count结束----"+System.currentTimeMillis());
|
||||
logger.info("查询count结束----"+System.currentTimeMillis());
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
@@ -220,7 +222,7 @@ public class ComplexStringCfgController extends BaseController{
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"deleteCfg"})
|
||||
public String deleteStringCfg(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model) {
|
||||
public String deleteStringCfg(String tableName,int action,long cfgId,int compileId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
@@ -233,19 +235,30 @@ public class ComplexStringCfgController extends BaseController{
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
List<AreaIpCfg> areaCfg=ipCfgService.getAreaCfgByCompileId(compileId);
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
for(AreaIpCfg c:areaCfg){
|
||||
c.setTableName(AreaIpCfg.getTablename());
|
||||
}
|
||||
}
|
||||
int audit=complexStringCfgService.getIsAudit(tableName,cfgId);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
if(audit!=Constants.AUDIT_YES&&audit!=Constants.AUDIT_NOT_YES){
|
||||
ComplexkeywordCfg cfg=new ComplexkeywordCfg();
|
||||
cfg.setCfgId(cfgId);
|
||||
cfg.setTableName(tableName);
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
cfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=complexStringCfgService.deleteStringCfg(cfg);
|
||||
addMessage(model,"delete_success");
|
||||
int result=complexStringCfgService.deleteStringCfg(cfg,areaCfg);
|
||||
if(result==0){
|
||||
addMessage(model,"delete_failed");
|
||||
}else{
|
||||
addMessage(model,"delete_success");
|
||||
}
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
logger.error("通过审核/取消审核通过的配置不能删除!");
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
@@ -279,12 +281,13 @@ public class IpCfgController extends BaseController{
|
||||
*/
|
||||
@RequiresPermissions("sys:cfg:edit")
|
||||
@RequestMapping(value = {"deleteCfg"})
|
||||
public String deleteIpCfg(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model) {
|
||||
public String deleteIpCfg(String tableName,int action,long cfgId,int compileId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
@@ -292,20 +295,30 @@ public class IpCfgController extends BaseController{
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
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);
|
||||
model.addAttribute("tableName", tableName);
|
||||
addMessage(model,"delete_success");
|
||||
int result=ipCfgService.deleteIpCfg(ipCfg,areaCfg);
|
||||
if(result==0){
|
||||
addMessage(model,"delete_failed");
|
||||
}else{
|
||||
addMessage(model,"delete_success");
|
||||
}
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
logger.error("通过审核/取消审核通过的配置不能删除!");
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -227,12 +229,13 @@ public class StringCfgController extends BaseController{
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"deleteCfg"})
|
||||
public String deleteStringCfg(String tableName,int action,long cfgId,String cfgName,Integer serviceId,Model model) {
|
||||
public String deleteStringCfg(String tableName,int action,long cfgId,int compileId,String cfgName,Integer serviceId,Model model) {
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType","string");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
@@ -240,19 +243,32 @@ public class StringCfgController extends BaseController{
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
model.addAttribute("tableName", tableName);
|
||||
int audit=stringCfgService.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){
|
||||
if(audit!=Constants.AUDIT_YES&&audit!=Constants.AUDIT_NOT_YES){
|
||||
BaseStringCfg stringCfg=new BaseStringCfg();
|
||||
stringCfg.setCfgId(cfgId);
|
||||
stringCfg.setTableName(tableName);
|
||||
stringCfg.setEditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setEditTime(new Date());
|
||||
stringCfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=stringCfgService.deleteStringCfg(stringCfg);
|
||||
addMessage(model,"delete_success");
|
||||
int result=stringCfgService.deleteStringCfg(stringCfg, areaCfg);
|
||||
if(result==0){
|
||||
addMessage(model,"delete_failed");
|
||||
}else{
|
||||
addMessage(model,"delete_success");
|
||||
}
|
||||
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
logger.error("通过审核/取消审核通过的配置不能删除!");
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
|
||||
@@ -95,7 +95,10 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteStringCfg(ComplexkeywordCfg cfg){
|
||||
public int deleteStringCfg(ComplexkeywordCfg cfg,List<AreaIpCfg> areaCfg){
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
this.deleteIpBatch(areaCfg);
|
||||
}
|
||||
return complexStringCfgDao.updateValid(cfg);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -99,7 +99,10 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteIpCfg(BaseIpCfg baseIpCfg){
|
||||
public int deleteIpCfg(BaseIpCfg baseIpCfg, List<AreaIpCfg> areaCfg){
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
this.deleteIpBatch(areaCfg);
|
||||
}
|
||||
return ipCfgDao.updateValid(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -95,7 +95,10 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteStringCfg(BaseStringCfg baseStringCfg){
|
||||
public int deleteStringCfg(BaseStringCfg baseStringCfg,List<AreaIpCfg> areaCfg){
|
||||
if(areaCfg!=null&&areaCfg.size()>0){
|
||||
this.deleteIpBatch(areaCfg);
|
||||
}
|
||||
return stringCfgDao.updateValid(baseStringCfg);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -360,7 +360,7 @@
|
||||
</c:when>
|
||||
<c:when test="${cfg.isAudit eq '0'}">
|
||||
<li><a href="${ctx}/cfg/complex/updateForm?serviceId=${cfg.serviceId}&action=${cfg.action}&tableName=${cfg.tableName}&cfgId=${cfg.cfgId}&cfgName=${cfgName}" onclick="javascript:return confirm('sure?', this.href)"><spring:message code="edit"></spring:message></a></li>
|
||||
<li><a href="${ctx}/cfg/complex/deleteCfg?serviceId=${cfg.serviceId}&action=${cfg.action}&tableName=${cfg.tableName}&cfgId=${cfg.cfgId}&cfgName=${cfgName}" onclick="return confirm('sure?', this.href)"><spring:message code="delete"></spring:message></a></li>
|
||||
<li><a href="${ctx}/cfg/complex/deleteCfg?serviceId=${cfg.serviceId}&action=${cfg.action}&tableName=${cfg.tableName}&cfgId=${cfg.cfgId}&cfgName=${cfgName}&compileId=${cfg.compileId}" onclick="return confirm('sure?', this.href)"><spring:message code="delete"></spring:message></a></li>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
|
||||
@@ -451,7 +451,7 @@
|
||||
</c:when>
|
||||
<c:when test="${ipCfg.isAudit eq '0'}">
|
||||
<li><a href="${ctx}/cfg/ip/updateForm?serviceId=${ipCfg.serviceId}&action=${ipCfg.action}&tableName=${ipCfg.tableName}&cfgId=${ipCfg.cfgId}&cfgName=${cfgName}" onclick="javascript:return confirm('sure?', this.href)"><spring:message code="edit"></spring:message></a></li>
|
||||
<li><a href="${ctx}/cfg/ip/deleteCfg?serviceId=${ipCfg.serviceId}&action=${ipCfg.action}&tableName=${ipCfg.tableName}&cfgId=${ipCfg.cfgId}&cfgName=${cfgName}" onclick="return confirm('sure?', this.href)"><spring:message code="delete"></spring:message></a></li>
|
||||
<li><a href="${ctx}/cfg/ip/deleteCfg?serviceId=${ipCfg.serviceId}&action=${ipCfg.action}&tableName=${ipCfg.tableName}&cfgId=${ipCfg.cfgId}&cfgName=${cfgName}&compileId=${ipCfg.compileId}" onclick="return confirm('sure?', this.href)"><spring:message code="delete"></spring:message></a></li>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
|
||||
@@ -377,7 +377,7 @@
|
||||
</c:when>
|
||||
<c:when test="${cfg.isAudit eq '0'}">
|
||||
<li><a href="${ctx}/cfg/string/updateForm?serviceId=${cfg.serviceId}&action=${cfg.action}&tableName=${cfg.tableName}&cfgId=${cfg.cfgId}&cfgName=${cfgName}" onclick="javascript:return confirm('sure?', this.href)"><spring:message code="edit"></spring:message></a></li>
|
||||
<li><a href="${ctx}/cfg/string/deleteCfg?serviceId=${cfg.serviceId}&action=${cfg.action}&tableName=${cfg.tableName}&cfgId=${cfg.cfgId}&cfgName=${cfgName}" onclick="return confirm('sure?', this.href)"><spring:message code="delete"></spring:message></a></li>
|
||||
<li><a href="${ctx}/cfg/string/deleteCfg?serviceId=${cfg.serviceId}&action=${cfg.action}&tableName=${cfg.tableName}&cfgId=${cfg.cfgId}&cfgName=${cfgName}&compileId=${cfg.compileId}" onclick="return confirm('sure?', this.href)"><spring:message code="delete"></spring:message></a></li>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
|
||||
Reference in New Issue
Block a user