(1)maat配置转换0.0.1版本jar提交,获取编译id可用,审核,取消审核部分报错,待凯歌修复完成测试通过之后更新版本。
(2)基础类配置精简后台代码,加入了从maat转换工具获取编译ID。审核,取消审核目前不可用,等jar包修复完成继续调整。 (3)编译ID字段改为int类型 (4)多域类配置后台提交。查询采用查一张主表,根据主表中的编译ID分开查其他表的方式关联。界面功能尚在调整。
This commit is contained in:
@@ -13,10 +13,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -74,44 +75,39 @@ public class ComplexStringCfgController extends BaseController{
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
logger.info("sercice id is "+serviceId);
|
||||
if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
String className=complexStringCfgService.getClassName(tableName);
|
||||
logger.info("class name is "+className);
|
||||
String packageName=ComplexkeywordCfg.class.getPackage().getName();
|
||||
try {
|
||||
//通过反射获得ComplexkeywordCfg的子类的实例,并调用子类的initDefaultValue初始化默认值
|
||||
Class clazz=Class.forName(packageName+"."+className);
|
||||
ComplexkeywordCfg cfg=(ComplexkeywordCfg)clazz.newInstance();
|
||||
cfg.setTableName(tableName);
|
||||
cfg.initDefaultValue();
|
||||
cfg.setAction(action);
|
||||
cfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("打开新增IP窗口失败",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
String className=complexStringCfgService.getClassName(tableName);
|
||||
logger.info("class name is "+className);
|
||||
String packageName=ComplexkeywordCfg.class.getPackage().getName();
|
||||
try {
|
||||
//通过反射获得ComplexkeywordCfg的子类的实例,并调用子类的initDefaultValue初始化默认值
|
||||
Class clazz=Class.forName(packageName+"."+className);
|
||||
ComplexkeywordCfg cfg=(ComplexkeywordCfg)clazz.newInstance();
|
||||
cfg.setTableName(tableName);
|
||||
cfg.initDefaultValue();
|
||||
cfg.setAction(action);
|
||||
cfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("打开新增IP窗口失败",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的serviceId");
|
||||
}
|
||||
|
||||
return "/cfg/complexCfgForm";
|
||||
}
|
||||
@RequestMapping(value = {"updateForm"})
|
||||
@@ -121,7 +117,13 @@ public class ComplexStringCfgController extends BaseController{
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("tableName", tableName);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
logger.info("table name is "+tableName);
|
||||
ComplexkeywordCfg searchBean=new ComplexkeywordCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
@@ -136,32 +138,9 @@ public class ComplexStringCfgController extends BaseController{
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
}else if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
ComplexkeywordCfg searchBean=new ComplexkeywordCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
searchBean.setTableName(tableName);
|
||||
ComplexkeywordCfg cfg=complexStringCfgService.getStringCfgById(searchBean);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的表名");
|
||||
}catch(Exception e){
|
||||
logger.error("发生异常", e);
|
||||
}
|
||||
|
||||
return "/cfg/complexCfgForm";
|
||||
}
|
||||
|
||||
@@ -179,15 +158,21 @@ public class ComplexStringCfgController extends BaseController{
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType","complex");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
model.addAttribute("serviceId",cfg.getServiceId());
|
||||
model.addAttribute("action",cfg.getAction());
|
||||
logger.info("saveOrUpdateStringCfg loaded");
|
||||
if(cfg==null){
|
||||
logger.error("无法保存空的配置!");
|
||||
addMessage(model,"保存失败!");
|
||||
}else if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
try {
|
||||
String tableName=cfg.getTableName();
|
||||
int serviceId=cfg.getServiceId();
|
||||
long compileId=getCompileId(cfg);
|
||||
// cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
// cfg.setCreateTime(new Date());
|
||||
if(StringUtils.isBlank(cfg.getTableName())){
|
||||
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
cfg.setTableName(tableName);
|
||||
}
|
||||
}
|
||||
int compileId = new ConvertTool().getCompileId();
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setCompileId(compileId);
|
||||
@@ -200,41 +185,13 @@ public class ComplexStringCfgController extends BaseController{
|
||||
cfg.setEditTime(new Date());
|
||||
complexStringCfgService.updateStringCfg(cfg);
|
||||
}
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
model.addAttribute("action",cfg.getAction());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}else if(cfg.getServiceId()!=null){
|
||||
int serviceId=cfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
long compileId=getCompileId(cfg);
|
||||
cfg.setTableName(tableName);
|
||||
// cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
// cfg.setCreateTime(new Date());
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setCompileId(compileId);
|
||||
if(cfg.getCfgId()==null){
|
||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
cfg.setCreateTime(new Date());
|
||||
complexStringCfgService.addStringCfg(cfg);
|
||||
}else{
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
complexStringCfgService.updateStringCfg(cfg);
|
||||
}
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
model.addAttribute("action",cfg.getAction());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("保存失败!",e);
|
||||
addMessage(model,"保存失败!");
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}
|
||||
return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+cfg.getServiceId()+"&action="+cfg.getAction()+"&cfgName="+cfgName);
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,53 +207,47 @@ public class ComplexStringCfgController extends BaseController{
|
||||
public String auditStringCfg(String cfgName,ComplexkeywordCfg cfg,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
if(cfg==null){
|
||||
logger.error("无法审核空的配置!");
|
||||
}else if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
int audit=complexStringCfgService.getIsAudit(cfg);
|
||||
model.addAttribute("serviceId", cfg.getServiceId());
|
||||
model.addAttribute("action", cfg.getAction());
|
||||
try{
|
||||
String tableName=cfg.getTableName();
|
||||
String maatTable=null;
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(cfg.getServiceId());
|
||||
if(serviceConfigInfo!=null){
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
cfg.setTableName(tableName);
|
||||
}
|
||||
maatTable=serviceConfigInfo.getMaatTable();
|
||||
}
|
||||
ComplexkeywordCfg bean=complexStringCfgService.getStringCfgById(cfg);
|
||||
bean.setTableName(tableName);
|
||||
int audit=bean.getIsAudit().intValue();
|
||||
if(audit==Constants.AUDIT_YES&&cfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
cfg.setAuditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setAuditTime(new Date());
|
||||
|
||||
bean.setIsAudit(cfg.getIsAudit());
|
||||
if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
bean.setIsValid(Constants.VALID_NO);
|
||||
bean.setMaatTable(maatTable);
|
||||
}else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
bean.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=complexStringCfgService.auditStringCfg(cfg);
|
||||
model.addAttribute("serviceId", cfg.getServiceId());
|
||||
model.addAttribute("action", cfg.getAction());
|
||||
}
|
||||
|
||||
}else if(cfg.getServiceId()!=null){
|
||||
int serviceId=cfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
cfg.setTableName(tableName);
|
||||
int audit=complexStringCfgService.getIsAudit(cfg);
|
||||
if(audit==Constants.AUDIT_YES&&cfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
cfg.setAuditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setAuditTime(new Date());
|
||||
|
||||
if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=complexStringCfgService.auditStringCfg(cfg);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", cfg.getAction());
|
||||
}
|
||||
int result=complexStringCfgService.auditStringCfg(bean,cfg);
|
||||
if(result!=0){
|
||||
addMessage(model,"审核成功!");
|
||||
}else{
|
||||
addMessage(model,"审核失败!");
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}catch(Exception e){
|
||||
logger.error("发生异常",e);
|
||||
addMessage(model,"审核失败!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/complex/list";
|
||||
}
|
||||
@@ -316,7 +267,13 @@ public class ComplexStringCfgController extends BaseController{
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType","complex");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
int audit=complexStringCfgService.getIsAudit(tableName,cfgId);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
@@ -332,29 +289,9 @@ public class ComplexStringCfgController extends BaseController{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
}
|
||||
|
||||
}else if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
ComplexkeywordCfg cfg=new ComplexkeywordCfg();
|
||||
cfg.setCfgId(cfgId);
|
||||
cfg.setTableName(tableName);
|
||||
int audit=complexStringCfgService.getIsAudit(cfg);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
cfg.setEditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setEditTime(new Date());
|
||||
cfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=complexStringCfgService.deleteStringCfg(cfg);
|
||||
addMessage(model,"删除成功,正在为您跳转页面...");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"删除失败!");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
@@ -367,7 +304,14 @@ public class ComplexStringCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected long getCompileId(BaseCfg cfg){
|
||||
return 0;
|
||||
protected long getCompileId(ComplexkeywordCfg cfg){
|
||||
long compileId=0l;
|
||||
try {
|
||||
compileId = cfg.getCompileId()==null?new ConvertTool().getCompileId():cfg.getCompileId();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return compileId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -123,7 +124,6 @@ public class IpCfgController extends BaseController{
|
||||
ipcfg.setAction(action);
|
||||
ipcfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", ipcfg);
|
||||
long compileId=this.getCompileId();
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
@@ -230,13 +230,21 @@ public class IpCfgController extends BaseController{
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
model.addAttribute("serviceId",ipCfg.getServiceId());
|
||||
model.addAttribute("action",ipCfg.getAction());
|
||||
model.addAttribute("tableName", ipCfg.getTableName());
|
||||
logger.info("saveOrUpdateIpCfg loaded");
|
||||
if(ipCfg==null){
|
||||
logger.error("无法保存空的配置!");
|
||||
addMessage(model,"保存失败!");
|
||||
}else if(!StringUtils.isBlank(ipCfg.getTableName())){
|
||||
try{
|
||||
String tableName=ipCfg.getTableName();
|
||||
int serviceId=ipCfg.getServiceId();
|
||||
long compileId=getCompileId();
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
ipCfg.setTableName(tableName);
|
||||
}
|
||||
}
|
||||
int compileId=new ConvertTool().getCompileId().intValue();
|
||||
ipCfg.setIsValid(Constants.VALID_NO);
|
||||
ipCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
ipCfg.setCompileId(compileId);
|
||||
@@ -249,42 +257,12 @@ public class IpCfgController extends BaseController{
|
||||
ipCfg.setEditTime(new Date());
|
||||
ipCfgService.updateIpCfg(ipCfg);
|
||||
}
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
model.addAttribute("action",ipCfg.getAction());
|
||||
model.addAttribute("tableName", ipCfg.getTableName());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}else if(ipCfg.getServiceId()!=null){
|
||||
int serviceId=ipCfg.getServiceId();
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
long compileId=getCompileId();
|
||||
ipCfg.setTableName(tableName);
|
||||
// ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
||||
// ipCfg.setCreateTime(new Date());
|
||||
ipCfg.setIsValid(Constants.VALID_NO);
|
||||
ipCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
ipCfg.setCompileId(compileId);
|
||||
if(ipCfg.getCfgId()==null){
|
||||
ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setCreateTime(new Date());
|
||||
}else{
|
||||
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setEditTime(new Date());
|
||||
ipCfgService.updateIpCfg(ipCfg);
|
||||
}
|
||||
model.addAttribute("action",ipCfg.getAction());
|
||||
model.addAttribute("tableName", ipCfg.getTableName());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败",e);
|
||||
addMessage(model,"保存失败!");
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}
|
||||
return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+ipCfg.getServiceId()+"&action="+ipCfg.getAction()+"&cfgName="+cfgName);
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,52 +278,47 @@ public class IpCfgController extends BaseController{
|
||||
public String auditIpCfg(String cfgName,BaseIpCfg ipCfg,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
if(ipCfg==null){
|
||||
logger.error("无法审核空的配置!");
|
||||
}else if(!StringUtils.isBlank(ipCfg.getTableName())){
|
||||
int audit=ipCfgService.getIsAudit(ipCfg);
|
||||
model.addAttribute("serviceId", ipCfg.getServiceId());
|
||||
model.addAttribute("action", ipCfg.getAction());
|
||||
try{
|
||||
String tableName=ipCfg.getTableName();
|
||||
String maatTable=null;
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(ipCfg.getServiceId());
|
||||
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);
|
||||
}
|
||||
int result=ipCfgService.auditIpCfg(ipCfg);
|
||||
model.addAttribute("serviceId", ipCfg.getServiceId());
|
||||
model.addAttribute("action", ipCfg.getAction());
|
||||
}
|
||||
}else if(ipCfg.getServiceId()!=null){
|
||||
int serviceId=ipCfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
ipCfg.setTableName(tableName);
|
||||
int audit=ipCfgService.getIsAudit(ipCfg);
|
||||
if(audit==Constants.AUDIT_YES&&ipCfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
ipCfg.setAuditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setAuditTime(new Date());
|
||||
|
||||
if(ipCfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
ipCfg.setIsValid(Constants.VALID_NO);
|
||||
}else if(ipCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
ipCfg.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=ipCfgService.auditIpCfg(ipCfg);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", ipCfg.getAction());
|
||||
}
|
||||
int result=ipCfgService.auditIpCfg(bean,ipCfg);
|
||||
if(result!=0){
|
||||
addMessage(model,"审核成功!");
|
||||
}else{
|
||||
addMessage(model, "审核失败");
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}catch(Exception e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(model, "审核失败");
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/ip/list";
|
||||
}
|
||||
@@ -366,7 +339,13 @@ public class IpCfgController extends BaseController{
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
int audit=ipCfgService.getIsAudit(tableName,cfgId);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
@@ -381,32 +360,11 @@ public class IpCfgController extends BaseController{
|
||||
addMessage(model,"删除成功,正在为您跳转页面...");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
addMessage(model,"删除失败!");
|
||||
}
|
||||
|
||||
}else if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
BaseIpCfg ipCfg=new BaseIpCfg();
|
||||
ipCfg.setCfgId(cfgId);
|
||||
ipCfg.setTableName(tableName);
|
||||
int audit=ipCfgService.getIsAudit(ipCfg);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
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,"删除成功,正在为您跳转页面...");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"删除失败!");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
@@ -419,7 +377,14 @@ public class IpCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected long getCompileId(){
|
||||
return 0;
|
||||
protected long getCompileId(BaseIpCfg cfg){
|
||||
long compileId=0l;
|
||||
try {
|
||||
compileId = cfg.getCompileId()==null?new ConvertTool().getCompileId():cfg.getCompileId();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return compileId;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,9 +13,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.NumBoundaryCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -27,7 +28,6 @@ import com.nis.web.controller.BaseController;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/cfg/num")
|
||||
public class NumCfgController extends BaseController{
|
||||
|
||||
@RequestMapping(value = {"list"})
|
||||
public String cfgList(Model model,Integer audit,Integer pageNo,Integer pageSize,String cfgName,@ModelAttribute("cfg")NumBoundaryCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
@@ -136,16 +136,11 @@ public class NumCfgController extends BaseController{
|
||||
model.addAttribute("cfgType","num");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
logger.info("saveOrUpdateStringCfg loaded");
|
||||
if(cfg==null){
|
||||
logger.error("无法保存空的配置!");
|
||||
addMessage(model,"保存失败!");
|
||||
}else if(cfg.getServiceId()!=null){
|
||||
try{
|
||||
int serviceId=cfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
long compileId=getCompileId(cfg);
|
||||
// cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
// cfg.setCreateTime(new Date());
|
||||
int compileId=new ConvertTool().getCompileId();
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setCompileId(compileId);
|
||||
@@ -162,11 +157,11 @@ public class NumCfgController extends BaseController{
|
||||
model.addAttribute("action",cfg.getAction());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}
|
||||
}else{
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败", e);
|
||||
addMessage(model,"保存失败!");
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}
|
||||
return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+cfg.getServiceId()+"&action="+cfg.getAction()+"&cfgName="+cfgName);
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,31 +177,42 @@ public class NumCfgController extends BaseController{
|
||||
public String auditStringCfg(String cfgName,NumBoundaryCfg cfg,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
if(cfg==null){
|
||||
logger.error("无法审核空的配置!");
|
||||
}else if(cfg.getServiceId()!=null){
|
||||
model.addAttribute("serviceId", cfg.getServiceId());
|
||||
model.addAttribute("action", cfg.getAction());
|
||||
try{
|
||||
int serviceId=cfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
int audit=numCfgService.getIsAudit(cfg);
|
||||
NumBoundaryCfg bean=numCfgService.getNumCfgById(cfg);
|
||||
bean.setTableName(serviceConfigInfo.getTableName());
|
||||
int audit=bean.getIsAudit().intValue();
|
||||
if(audit==Constants.AUDIT_YES&&cfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
cfg.setAuditorId(cfg.getCurrentUser().getId());
|
||||
cfg.setAuditTime(new Date());
|
||||
|
||||
bean.setIsAudit(cfg.getIsAudit());
|
||||
if(cfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
bean.setIsValid(Constants.VALID_NO);
|
||||
bean.setMaatTable(serviceConfigInfo.getMaatTable());
|
||||
}else if(cfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
bean.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=numCfgService.auditNumCfg(cfg);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", cfg.getAction());
|
||||
int result=numCfgService.auditNumCfg(bean,cfg);
|
||||
if(result!=0){
|
||||
addMessage(model, "审核成功");
|
||||
}else{
|
||||
addMessage(model, "审核失败");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("审核失败",e);
|
||||
addMessage(model, "审核失败");
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/num/list";
|
||||
}
|
||||
@@ -257,7 +263,14 @@ public class NumCfgController extends BaseController{
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected long getCompileId(BaseCfg cfg){
|
||||
return 0;
|
||||
protected long getCompileId(NumBoundaryCfg cfg){
|
||||
long compileId=0l;
|
||||
try {
|
||||
compileId = cfg.getCompileId()==null?new ConvertTool().getCompileId():cfg.getCompileId();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return compileId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@@ -121,7 +122,13 @@ public class StringCfgController extends BaseController{
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("tableName", tableName);
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
logger.info("table name is "+tableName);
|
||||
BaseStringCfg searchBean=new BaseStringCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
@@ -136,32 +143,10 @@ public class StringCfgController extends BaseController{
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
}else if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
BaseStringCfg searchBean=new BaseStringCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseStringCfg stringCfg=stringCfgService.getStringCfgById(searchBean);
|
||||
model.addAttribute("_cfg", stringCfg);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("未获取到正确的表名");
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("发生异常",e);
|
||||
}
|
||||
|
||||
return "/cfg/stringCfgForm";
|
||||
}
|
||||
|
||||
@@ -179,15 +164,20 @@ public class StringCfgController extends BaseController{
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType","string");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
model.addAttribute("serviceId",stringCfg.getServiceId());
|
||||
model.addAttribute("action",stringCfg.getAction());
|
||||
logger.info("saveOrUpdateStringCfg loaded");
|
||||
if(stringCfg==null){
|
||||
logger.error("无法保存空的配置!");
|
||||
addMessage(model,"保存失败!");
|
||||
}else if(!StringUtils.isBlank(stringCfg.getTableName())){
|
||||
try{
|
||||
String tableName=stringCfg.getTableName();
|
||||
int serviceId=stringCfg.getServiceId();
|
||||
long compileId=getCompileId(stringCfg);
|
||||
// stringCfg.setCreatorId(stringCfg.getCurrentUser().getId());
|
||||
// stringCfg.setCreateTime(new Date());
|
||||
if(StringUtils.isBlank(stringCfg.getTableName())){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
stringCfg.setTableName(tableName);
|
||||
}
|
||||
}
|
||||
int compileId=new ConvertTool().getCompileId();
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
stringCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
stringCfg.setCompileId(compileId);
|
||||
@@ -200,41 +190,13 @@ public class StringCfgController extends BaseController{
|
||||
stringCfg.setEditTime(new Date());
|
||||
stringCfgService.updateStringCfg(stringCfg);
|
||||
}
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
model.addAttribute("action",stringCfg.getAction());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}else if(stringCfg.getServiceId()!=null){
|
||||
int serviceId=stringCfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
long compileId=getCompileId(stringCfg);
|
||||
stringCfg.setTableName(tableName);
|
||||
// stringCfg.setCreatorId(stringCfg.getCurrentUser().getId());
|
||||
// stringCfg.setCreateTime(new Date());
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
stringCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
stringCfg.setCompileId(compileId);
|
||||
if(stringCfg.getCfgId()==null){
|
||||
stringCfg.setCreatorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setCreateTime(new Date());
|
||||
stringCfgService.addStringCfg(stringCfg);
|
||||
}else{
|
||||
stringCfg.setEditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setEditTime(new Date());
|
||||
stringCfgService.updateStringCfg(stringCfg);
|
||||
}
|
||||
model.addAttribute("serviceId",serviceId);
|
||||
model.addAttribute("action",stringCfg.getAction());
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
addMessage(model,"保存失败!");
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("保存失败!",e);
|
||||
addMessage(model,"保存失败!");
|
||||
}
|
||||
return "/cfg/resultPage";//StringEscapeUtils.escapeHtml4("?serviceId="+stringCfg.getServiceId()+"&action="+stringCfg.getAction()+"&cfgName="+cfgName);
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,53 +212,50 @@ public class StringCfgController extends BaseController{
|
||||
public String auditStringCfg(String cfgName,BaseStringCfg stringCfg,Model model) {
|
||||
model.addAttribute("cfgName", cfgName);
|
||||
model.addAttribute("audit", Constants.AUDIT_PAGE);
|
||||
if(stringCfg==null){
|
||||
logger.error("无法审核空的配置!");
|
||||
}else if(!StringUtils.isBlank(stringCfg.getTableName())){
|
||||
int audit=stringCfgService.getIsAudit(stringCfg);
|
||||
model.addAttribute("serviceId", stringCfg.getServiceId());
|
||||
model.addAttribute("action", stringCfg.getAction());
|
||||
try{
|
||||
String tableName=stringCfg.getTableName();
|
||||
int serviceId=stringCfg.getServiceId();
|
||||
String maatTable=null;
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
stringCfg.setTableName(tableName);
|
||||
}
|
||||
maatTable=serviceConfigInfo.getMaatTable();
|
||||
}
|
||||
|
||||
BaseStringCfg bean=stringCfgService.getStringCfgById(stringCfg);
|
||||
bean.setTableName(tableName);
|
||||
int audit=bean.getIsAudit().intValue();
|
||||
if(audit==Constants.AUDIT_YES&&stringCfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
stringCfg.setAuditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setAuditTime(new Date());
|
||||
|
||||
bean.setIsAudit(stringCfg.getIsAudit());
|
||||
if(stringCfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
bean.setIsValid(Constants.VALID_NO);
|
||||
bean.setMaatTable(maatTable);
|
||||
}else if(stringCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
stringCfg.setIsValid(Constants.VALID_YES);
|
||||
bean.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=stringCfgService.auditStringCfg(stringCfg);
|
||||
model.addAttribute("serviceId", stringCfg.getServiceId());
|
||||
model.addAttribute("action", stringCfg.getAction());
|
||||
}
|
||||
|
||||
}else if(stringCfg.getServiceId()!=null){
|
||||
int serviceId=stringCfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
String tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
stringCfg.setTableName(tableName);
|
||||
int audit=stringCfgService.getIsAudit(stringCfg);
|
||||
if(audit==Constants.AUDIT_YES&&stringCfg.getIsAudit()!=Constants.AUDIT_NOT_YES){
|
||||
logger.error("审核通过的配置只能取消审核通过!");
|
||||
}else{
|
||||
stringCfg.setAuditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setAuditTime(new Date());
|
||||
|
||||
if(stringCfg.getIsAudit()==Constants.AUDIT_NOT_YES){//取消审核通过,设置有效标志为0
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
}else if(stringCfg.getIsAudit()==Constants.AUDIT_YES){//审核通过,设置有效标志为1
|
||||
stringCfg.setIsValid(Constants.VALID_YES);
|
||||
}
|
||||
int result=stringCfgService.auditStringCfg(stringCfg);
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", stringCfg.getAction());
|
||||
}
|
||||
int result=stringCfgService.auditStringCfg(bean,stringCfg);
|
||||
if(result!=0){
|
||||
addMessage(model,"审核成功!");
|
||||
}else{
|
||||
addMessage(model,"审核失败!");
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
logger.error("审核失败", e);
|
||||
addMessage(model,"审核失败!");
|
||||
}
|
||||
return "redirect:" + adminPath + "/cfg/string/list";
|
||||
}
|
||||
@@ -316,7 +275,13 @@ public class StringCfgController extends BaseController{
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("cfgType","string");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
try{
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
int audit=stringCfgService.getIsAudit(tableName,cfgId);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
@@ -332,42 +297,10 @@ public class StringCfgController extends BaseController{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
}
|
||||
|
||||
}else if(serviceId!=null){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
BaseStringCfg stringCfg=new BaseStringCfg();
|
||||
stringCfg.setCfgId(cfgId);
|
||||
stringCfg.setTableName(tableName);
|
||||
int audit=stringCfgService.getIsAudit(stringCfg);
|
||||
//未审核时可删除
|
||||
if(audit!=Constants.AUDIT_YES){
|
||||
stringCfg.setEditorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setEditTime(new Date());
|
||||
stringCfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=stringCfgService.deleteStringCfg(stringCfg);
|
||||
addMessage(model,"删除成功,正在为您跳转页面...");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
logger.error("无法确定IP配置的表名!");
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败",e);
|
||||
addMessage(model,"删除失败!");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getCompileId(获取编译ID)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @return
|
||||
*long
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected long getCompileId(BaseCfg cfg){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,5 @@ public interface ComplexStringCfgDao extends CrudDao<ComplexkeywordCfg>{
|
||||
public int getIsValid(ComplexkeywordCfg entity);
|
||||
public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id);
|
||||
public int getIsAudit(ComplexkeywordCfg entity);
|
||||
public int deleteByCompileId(ComplexkeywordCfg entity);
|
||||
}
|
||||
|
||||
@@ -481,4 +481,7 @@
|
||||
SELECT IS_AUDIT FROM ${tableName}
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.ComplexkeywordCfg" >
|
||||
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -26,4 +26,5 @@ public interface IpCfgDao extends CrudDao<BaseIpCfg>{
|
||||
public int getIsValid(BaseIpCfg entity);
|
||||
public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id);
|
||||
public int getIsAudit(BaseIpCfg entity);
|
||||
public int deleteByCompileId(BaseIpCfg entity);
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
<if test="editTime != null" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="auditorId != null" >
|
||||
@@ -639,4 +639,7 @@
|
||||
SELECT IS_AUDIT FROM ${tableName}
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByCompileId" 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 compile_id = #{compileId,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.MultipleSearchCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
/**
|
||||
* 多域配置数据处理类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@MyBatisDao
|
||||
public interface MultipleCfgDao extends CrudDao<MultipleSearchCfg>{
|
||||
public MultipleSearchCfg getById(@Param("tableName")String tableName,@Param("cfgId")Long id) ;
|
||||
public MultipleSearchCfg get(MultipleSearchCfg entity) ;
|
||||
public List<MultipleSearchCfg> findList(MultipleSearchCfg entity) ;
|
||||
public int insert(MultipleSearchCfg entity) ;
|
||||
public int updateByPrimaryKeySelective(MultipleSearchCfg entity) ;
|
||||
public int updateValid(MultipleSearchCfg entity) ;
|
||||
public int audit(MultipleSearchCfg entity) ;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.configuration.MultipleCfgDao" >
|
||||
</mapper>
|
||||
@@ -26,4 +26,5 @@ public interface NumCfgDao extends CrudDao<NumBoundaryCfg>{
|
||||
public int getIsValid(NumBoundaryCfg entity);
|
||||
public int getIsAudit(@Param("cfgId")Long id);
|
||||
public int getIsAudit(NumBoundaryCfg entity);
|
||||
public int deleteByCompileId(NumBoundaryCfg entity);
|
||||
}
|
||||
|
||||
@@ -492,4 +492,7 @@
|
||||
SELECT IS_AUDIT FROM NUM_BOUNDARY_CFG
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.NumBoundaryCfg" >
|
||||
update NUM_BOUNDARY_CFG set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -26,4 +26,5 @@ public interface StringCfgDao extends CrudDao<BaseStringCfg>{
|
||||
public int getIsValid(BaseStringCfg entity);
|
||||
public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id);
|
||||
public int getIsAudit(BaseStringCfg entity);
|
||||
public int deleteByCompileId(BaseStringCfg entity);
|
||||
}
|
||||
|
||||
@@ -491,4 +491,7 @@
|
||||
SELECT IS_AUDIT FROM ${tableName}
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.BaseStringCfg" >
|
||||
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -143,19 +143,6 @@ public abstract class BaseService {
|
||||
|
||||
return scopeSql.toString();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getTableName(获取Class对应的表名)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param clazz
|
||||
* @return
|
||||
*String
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public String getTableName(String clazz){
|
||||
return Configurations.getStringProperty(clazz, null);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getTableName(获取表名对应的Class)
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.nis.web.service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
@@ -20,8 +21,13 @@ import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatUnAuditBean;
|
||||
import com.nis.domain.maat.UnAuditBean;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
|
||||
/**
|
||||
@@ -191,75 +197,132 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
* @param cfg
|
||||
* @return
|
||||
*boolean
|
||||
* @throws Exception
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public boolean sendToMaatConvertor(AreaIpCfg[] areaCfg,T ... cfg){
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean sendToMaatConvertor(int operation,List<AreaIpCfg> areaCfg,BaseCfg ... cfg) throws Exception{
|
||||
if(cfg==null){
|
||||
throw new RuntimeException("转换出错,配置为空");
|
||||
}
|
||||
long compileId=0l;
|
||||
ToMaatBean toMaatBean=new ToMaatBean();
|
||||
MaatCfg maatCfg=new MaatCfg();
|
||||
if(cfg[0] instanceof BaseIpCfg){
|
||||
maatCfg.setIpCfg((BaseIpCfg[])cfg);
|
||||
compileId=((BaseIpCfg)cfg[0]).getCompileId();
|
||||
}else if(cfg[0] instanceof BaseStringCfg){
|
||||
maatCfg.setStrCfg((BaseStringCfg[])cfg);
|
||||
compileId=((BaseStringCfg)cfg[0]).getCompileId();
|
||||
}else if(cfg[0] instanceof ComplexkeywordCfg){
|
||||
maatCfg.setComplexStrCfg((ComplexkeywordCfg[])cfg);
|
||||
compileId=((ComplexkeywordCfg)cfg[0]).getCompileId();
|
||||
}
|
||||
if(areaCfg!=null){
|
||||
AreaIpCfg[] cfgArray=new AreaIpCfg[1];
|
||||
|
||||
}
|
||||
List<MaatCfg> serviceCfg=new ArrayList<>();
|
||||
serviceCfg.add(maatCfg);
|
||||
BaseCfg baseCfg=(BaseCfg)cfg[0];
|
||||
if(compileId==0l){
|
||||
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());
|
||||
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
/*.setPrettyPrinting().serializeNulls()*/
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
String json=gson.toJson(toMaatBean);
|
||||
//发送至maat,待完成
|
||||
|
||||
return false;
|
||||
if(Constants.AUDIT_NOT_YES==operation){
|
||||
ToMaatUnAuditBean toMaatUnAuditBean=new ToMaatUnAuditBean();
|
||||
toMaatUnAuditBean.setServiceCfg(new ArrayList<UnAuditBean>());
|
||||
for(BaseCfg c:cfg){
|
||||
UnAuditBean bean=new UnAuditBean();
|
||||
if(c.getCompileId()==null||c.getCompileId()==0){
|
||||
throw new RuntimeException("转换出错,未获取到正确的compileId");
|
||||
}
|
||||
if(StringUtils.isBlank(c.getMaatTable())){
|
||||
throw new RuntimeException("转换出错,未获取到正确的maatTalbe");
|
||||
}
|
||||
bean.setCompileId(c.getCompileId());
|
||||
bean.setMaatTable(c.getMaatTable());
|
||||
}
|
||||
String json=gson.toJson(toMaatUnAuditBean);
|
||||
logger.info("to maat json:"+json);
|
||||
//发送至maat,待完成
|
||||
return new ConvertTool().setConfigInValid(json);
|
||||
}else{
|
||||
int compileId=0;
|
||||
ToMaatBean toMaatBean=new ToMaatBean();
|
||||
toMaatBean.setServiceCfg(new ArrayList<List<MaatCfg>>());
|
||||
MaatCfg maatCfg=new MaatCfg();
|
||||
for(BaseCfg c:cfg){
|
||||
if(c instanceof BaseIpCfg){
|
||||
compileId=compileId==0?c.getCompileId():compileId;
|
||||
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;
|
||||
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;
|
||||
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(areaCfg!=null){
|
||||
toMaatBean.setAreaCfg(areaCfg);
|
||||
}
|
||||
List<MaatCfg> serviceCfg=new ArrayList<>();
|
||||
serviceCfg.add(maatCfg);
|
||||
toMaatBean.getServiceCfg().add(serviceCfg);
|
||||
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());
|
||||
|
||||
String json=gson.toJson(toMaatBean);
|
||||
logger.info("to maat json:"+json);
|
||||
//发送至maat,待完成
|
||||
return new ConvertTool().saveConfig(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.ComplexStringCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
@@ -30,17 +30,7 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addStringCfg(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.insert(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("save "+tableName);
|
||||
return complexStringCfgDao.insert(cfg);
|
||||
}
|
||||
|
||||
return complexStringCfgDao.insert(cfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -54,17 +44,7 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateStringCfg(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.updateByPrimaryKeySelective(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("update "+tableName);
|
||||
return complexStringCfgDao.updateByPrimaryKeySelective(cfg);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -73,22 +53,21 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @throws Exception
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int auditStringCfg(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.audit(cfg);
|
||||
public int auditStringCfg(ComplexkeywordCfg sendCfg,ComplexkeywordCfg cfg) throws Exception{
|
||||
if(Constants.AUDIT_NOT_YES==cfg.getIsAudit().intValue()||
|
||||
Constants.AUDIT_YES==cfg.getIsAudit().intValue()){//审核通过,取消审核通过需要发到maat
|
||||
if(sendToMaatConvertor(cfg.getIsAudit(),null,sendCfg)){
|
||||
return complexStringCfgDao.audit(cfg);
|
||||
}
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("aduit "+tableName);
|
||||
return complexStringCfgDao.audit(cfg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -102,36 +81,8 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteStringCfg(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.updateValid(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("delete "+tableName);
|
||||
return complexStringCfgDao.updateValid(cfg);
|
||||
}
|
||||
|
||||
return complexStringCfgDao.updateValid(cfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getStringCfg(根据IP与类名获取IP配置)
|
||||
* (继承ComplexkeywordCfg这个类方可使用)
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
*ComplexkeywordCfg
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ComplexkeywordCfg getStringCfgById(Class<?> clazz,long id){
|
||||
String tableName=getTableName(clazz.getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
logger.info("get "+tableName);
|
||||
return complexStringCfgDao.getById(tableName, id);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getStringCfg(根据IP与类名获取IP配置)
|
||||
@@ -144,44 +95,16 @@ public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,Com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ComplexkeywordCfg getStringCfgById(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.get(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
cfg.setTableName(tableName);
|
||||
logger.info("get "+tableName);
|
||||
return complexStringCfgDao.get(cfg);
|
||||
}
|
||||
|
||||
return complexStringCfgDao.getById(cfg.getTableName(),cfg.getCfgId());
|
||||
}
|
||||
public Integer getIsValid(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.getIsValid(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
cfg.setTableName(tableName);
|
||||
return complexStringCfgDao.getIsValid(cfg);
|
||||
}
|
||||
|
||||
return complexStringCfgDao.getIsValid(cfg);
|
||||
}
|
||||
public Integer getIsValid(String tableName, long id){
|
||||
return complexStringCfgDao.getIsValid(tableName,id);
|
||||
}
|
||||
public Integer getIsAudit(ComplexkeywordCfg cfg){
|
||||
if(!StringUtils.isBlank(cfg.getTableName())){
|
||||
return complexStringCfgDao.getIsAudit(cfg);
|
||||
}else{
|
||||
String tableName=getTableName(cfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
cfg.setTableName(tableName);
|
||||
return complexStringCfgDao.getIsAudit(cfg);
|
||||
}
|
||||
|
||||
return complexStringCfgDao.getIsAudit(cfg);
|
||||
}
|
||||
public Integer getIsAudit(String tableName, long id){
|
||||
return complexStringCfgDao.getIsAudit(tableName,id);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
@@ -31,17 +30,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addIpCfg(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.insert(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("save "+tableName);
|
||||
return ipCfgDao.insert(baseIpCfg);
|
||||
}
|
||||
|
||||
return ipCfgDao.insert(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -55,17 +44,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateIpCfg(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("update "+tableName);
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
}
|
||||
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -74,22 +53,22 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @param baseIpCfg
|
||||
* @return
|
||||
*int
|
||||
* @throws Exception
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int auditIpCfg(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.audit(baseIpCfg);
|
||||
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);
|
||||
}
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("aduit "+tableName);
|
||||
return ipCfgDao.audit(baseIpCfg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -103,36 +82,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteIpCfg(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.updateValid(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("delete "+tableName);
|
||||
return ipCfgDao.updateValid(baseIpCfg);
|
||||
}
|
||||
|
||||
return ipCfgDao.updateValid(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getIpCfg(根据IP与类名获取IP配置)
|
||||
* (继承BaseIpCfg这个类方可使用)
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
*BaseIpCfg
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public BaseIpCfg getIpCfgById(Class<?> clazz,long id){
|
||||
String tableName=getTableName(clazz.getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
logger.info("get "+tableName);
|
||||
return ipCfgDao.getById(tableName, id);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getIpCfg(根据IP与类名获取IP配置)
|
||||
@@ -145,44 +96,16 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public BaseIpCfg getIpCfgById(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.get(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
logger.info("get "+tableName);
|
||||
return ipCfgDao.get(baseIpCfg);
|
||||
}
|
||||
|
||||
return ipCfgDao.getById(baseIpCfg.getTableName(), baseIpCfg.getCfgId());
|
||||
}
|
||||
public Integer getIsValid(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.getIsValid(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
return ipCfgDao.getIsValid(baseIpCfg);
|
||||
}
|
||||
|
||||
return ipCfgDao.getIsValid(baseIpCfg);
|
||||
}
|
||||
public Integer getIsValid(String tableName, long id){
|
||||
return ipCfgDao.getIsValid(tableName,id);
|
||||
}
|
||||
public Integer getIsAudit(BaseIpCfg baseIpCfg){
|
||||
if(!StringUtils.isBlank(baseIpCfg.getTableName())){
|
||||
return ipCfgDao.getIsAudit(baseIpCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseIpCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseIpCfg.setTableName(tableName);
|
||||
return ipCfgDao.getIsAudit(baseIpCfg);
|
||||
}
|
||||
|
||||
return ipCfgDao.getIsAudit(baseIpCfg);
|
||||
}
|
||||
public Integer getIsAudit(String tableName, long id){
|
||||
return ipCfgDao.getIsAudit(tableName,id);
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.MultipleCfg;
|
||||
import com.nis.domain.configuration.MultipleSearchCfg;
|
||||
import com.nis.domain.configuration.NumBoundaryCfg;
|
||||
import com.nis.web.dao.configuration.ComplexStringCfgDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.dao.configuration.MultipleCfgDao;
|
||||
import com.nis.web.dao.configuration.NumCfgDao;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
/**
|
||||
* 多域相关配置事务类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class MultipleCfgService extends CrudService<MultipleCfgDao,MultipleSearchCfg> {
|
||||
@Autowired
|
||||
protected MultipleCfgDao multipleCfgDao;
|
||||
@Autowired
|
||||
protected IpCfgDao ipCfgDao;
|
||||
@Autowired
|
||||
protected StringCfgDao stringCfgDao;
|
||||
@Autowired
|
||||
protected ComplexStringCfgDao complexStringCfgDao;
|
||||
@Autowired
|
||||
protected NumCfgDao numCfgDao;
|
||||
/**
|
||||
*
|
||||
* addStringCfg(新增IP类配置)
|
||||
* (继承ComplexkeywordCfg这个类方可使用)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addCfg(MultipleCfg cfg){
|
||||
if(cfg==null) return 0;
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
ipCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
stringCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
numCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
complexStringCfgDao.insert(_cfg);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateCfg(MultipleCfg cfg){
|
||||
if(cfg==null) return 0;
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
ipCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
stringCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
numCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
complexStringCfgDao.updateByPrimaryKeySelective(_cfg);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteCfg(MultipleCfg cfg){
|
||||
if(cfg==null) return 0;
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
ipCfgDao.deleteByCompileId(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
stringCfgDao.deleteByCompileId(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
numCfgDao.deleteByCompileId(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
complexStringCfgDao.deleteByCompileId(_cfg);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* auditCfg(这里用一句话描述这个方法的作用)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int auditCfg(MultipleCfg cfg){
|
||||
if(cfg==null) return 0;
|
||||
if(cfg.getIpCfg()!=null){
|
||||
for(BaseIpCfg _cfg:cfg.getIpCfg().values()){
|
||||
ipCfgDao.audit(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getStringCfg()!=null){
|
||||
for(BaseStringCfg _cfg:cfg.getStringCfg().values()){
|
||||
stringCfgDao.audit(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getNumCfg()!=null){
|
||||
for(NumBoundaryCfg _cfg:cfg.getNumCfg().values()){
|
||||
numCfgDao.audit(_cfg);
|
||||
}
|
||||
}
|
||||
if(cfg.getComplexCfg()!=null){
|
||||
for(ComplexkeywordCfg _cfg:cfg.getComplexCfg().values()){
|
||||
complexStringCfgDao.audit(_cfg);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 由于mysql不支持full join,并且考虑mysql的性能问题,这里分别从各个基础表里查询数据再拼接
|
||||
*/
|
||||
@Override
|
||||
public Page<MultipleSearchCfg> findPage(Page<MultipleSearchCfg> page, MultipleSearchCfg entity) {
|
||||
return super.findPage(page, entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.NumBoundaryCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.NumCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
@@ -52,12 +53,21 @@ public class NumCfgService extends CrudService<NumCfgDao,NumBoundaryCfg> {
|
||||
* @param cfg
|
||||
* @return
|
||||
*int
|
||||
* @throws Exception
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int auditNumCfg(NumBoundaryCfg cfg){
|
||||
return numCfgDao.audit(cfg);
|
||||
public int auditNumCfg(NumBoundaryCfg sendCfg,NumBoundaryCfg cfg) throws Exception{
|
||||
if(Constants.AUDIT_NOT_YES==cfg.getIsAudit().intValue()||
|
||||
Constants.AUDIT_YES==cfg.getIsAudit().intValue()){//审核通过,取消审核通过需要发到maat
|
||||
if(sendToMaatConvertor(cfg.getIsAudit(),null,sendCfg)){
|
||||
return numCfgDao.audit(cfg);
|
||||
}
|
||||
}else{
|
||||
return numCfgDao.audit(cfg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -99,7 +109,7 @@ public class NumCfgService extends CrudService<NumCfgDao,NumBoundaryCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public NumBoundaryCfg getNumCfgById(NumBoundaryCfg cfg){
|
||||
return numCfgDao.get(cfg);
|
||||
return numCfgDao.getById(cfg.getCfgId());
|
||||
}
|
||||
public Integer getIsValid(NumBoundaryCfg cfg){
|
||||
return numCfgDao.getIsValid(cfg);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
@@ -31,17 +30,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addStringCfg(BaseStringCfg baseStringCfg){
|
||||
if(!StringUtils.isBlank(baseStringCfg.getTableName())){
|
||||
return stringCfgDao.insert(baseStringCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseStringCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseStringCfg.setTableName(tableName);
|
||||
logger.info("save "+tableName);
|
||||
return stringCfgDao.insert(baseStringCfg);
|
||||
}
|
||||
|
||||
return stringCfgDao.insert(baseStringCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -55,17 +44,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateStringCfg(BaseStringCfg baseStringCfg){
|
||||
if(!StringUtils.isBlank(baseStringCfg.getTableName())){
|
||||
return stringCfgDao.updateByPrimaryKeySelective(baseStringCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseStringCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseStringCfg.setTableName(tableName);
|
||||
logger.info("update "+tableName);
|
||||
return stringCfgDao.updateByPrimaryKeySelective(baseStringCfg);
|
||||
}
|
||||
|
||||
return stringCfgDao.updateByPrimaryKeySelective(baseStringCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -74,22 +53,21 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
* @param baseStringCfg
|
||||
* @return
|
||||
*int
|
||||
* @throws Exception
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int auditStringCfg(BaseStringCfg baseStringCfg){
|
||||
if(!StringUtils.isBlank(baseStringCfg.getTableName())){
|
||||
return stringCfgDao.audit(baseStringCfg);
|
||||
public int auditStringCfg(BaseStringCfg sendCfg,BaseStringCfg baseStringCfg) throws Exception{
|
||||
if(Constants.AUDIT_NOT_YES==baseStringCfg.getIsAudit().intValue()||
|
||||
Constants.AUDIT_YES==baseStringCfg.getIsAudit().intValue()){//审核通过,取消审核通过需要发到maat
|
||||
if(sendToMaatConvertor(baseStringCfg.getIsAudit(),null,sendCfg)){
|
||||
return stringCfgDao.audit(baseStringCfg);
|
||||
}
|
||||
}else{
|
||||
String tableName=getTableName(baseStringCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseStringCfg.setTableName(tableName);
|
||||
logger.info("aduit "+tableName);
|
||||
return stringCfgDao.audit(baseStringCfg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@@ -103,36 +81,8 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int deleteStringCfg(BaseStringCfg baseStringCfg){
|
||||
if(!StringUtils.isBlank(baseStringCfg.getTableName())){
|
||||
return stringCfgDao.updateValid(baseStringCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseStringCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return 0;
|
||||
baseStringCfg.setTableName(tableName);
|
||||
logger.info("delete "+tableName);
|
||||
return stringCfgDao.updateValid(baseStringCfg);
|
||||
}
|
||||
|
||||
return stringCfgDao.updateValid(baseStringCfg);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getStringCfg(根据IP与类名获取IP配置)
|
||||
* (继承BaseStringCfg这个类方可使用)
|
||||
* @param clazz
|
||||
* @param id
|
||||
* @return
|
||||
*BaseStringCfg
|
||||
* @exception
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public BaseStringCfg getStringCfgById(Class<?> clazz,long id){
|
||||
String tableName=getTableName(clazz.getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
logger.info("get "+tableName);
|
||||
return stringCfgDao.getById(tableName, id);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* getStringCfg(根据IP与类名获取IP配置)
|
||||
@@ -145,44 +95,16 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public BaseStringCfg getStringCfgById(BaseStringCfg baseStringCfg){
|
||||
if(!StringUtils.isBlank(baseStringCfg.getTableName())){
|
||||
return stringCfgDao.get(baseStringCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseStringCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseStringCfg.setTableName(tableName);
|
||||
logger.info("get "+tableName);
|
||||
return stringCfgDao.get(baseStringCfg);
|
||||
}
|
||||
|
||||
return stringCfgDao.getById(baseStringCfg.getTableName(), baseStringCfg.getCfgId());
|
||||
}
|
||||
public Integer getIsValid(BaseStringCfg baseStringCfg){
|
||||
if(!StringUtils.isBlank(baseStringCfg.getTableName())){
|
||||
return stringCfgDao.getIsValid(baseStringCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseStringCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseStringCfg.setTableName(tableName);
|
||||
return stringCfgDao.getIsValid(baseStringCfg);
|
||||
}
|
||||
|
||||
return stringCfgDao.getIsValid(baseStringCfg);
|
||||
}
|
||||
public Integer getIsValid(String tableName, long id){
|
||||
return stringCfgDao.getIsValid(tableName,id);
|
||||
}
|
||||
public Integer getIsAudit(BaseStringCfg baseStringCfg){
|
||||
if(!StringUtils.isBlank(baseStringCfg.getTableName())){
|
||||
return stringCfgDao.getIsAudit(baseStringCfg);
|
||||
}else{
|
||||
String tableName=getTableName(baseStringCfg.getClass().getSimpleName());
|
||||
if(StringUtils.isBlank(tableName))
|
||||
return null;
|
||||
baseStringCfg.setTableName(tableName);
|
||||
return stringCfgDao.getIsAudit(baseStringCfg);
|
||||
}
|
||||
|
||||
return stringCfgDao.getIsAudit(baseStringCfg);
|
||||
}
|
||||
public Integer getIsAudit(String tableName, long id){
|
||||
return stringCfgDao.getIsAudit(tableName,id);
|
||||
|
||||
Reference in New Issue
Block a user