2018-02-28 12:15:52 +08:00
|
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
|
2018-04-11 18:47:02 +08:00
|
|
|
|
import java.util.ArrayList;
|
2018-04-09 16:38:45 +08:00
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
2018-02-28 12:15:52 +08:00
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
2018-04-09 16:38:45 +08:00
|
|
|
|
import com.nis.domain.configuration.AreaIpCfg;
|
2018-04-11 18:47:02 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-02-28 12:15:52 +08:00
|
|
|
|
import com.nis.domain.configuration.ComplexkeywordCfg;
|
2018-03-26 14:43:58 +08:00
|
|
|
|
import com.nis.util.Constants;
|
2018-02-28 12:15:52 +08:00
|
|
|
|
import com.nis.web.dao.configuration.ComplexStringCfgDao;
|
2018-04-11 18:47:02 +08:00
|
|
|
|
import com.nis.web.dao.configuration.IpCfgDao;
|
2018-02-28 12:15:52 +08:00
|
|
|
|
import com.nis.web.service.CrudService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* String相关配置事务类
|
|
|
|
|
|
* @author dell
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Service
|
|
|
|
|
|
public class ComplexStringCfgService extends CrudService<ComplexStringCfgDao,ComplexkeywordCfg> {
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
protected ComplexStringCfgDao complexStringCfgDao;
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* addStringCfg(新增IP类配置)
|
|
|
|
|
|
* (继承ComplexkeywordCfg这个类方可使用)
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*int
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-13 13:50:29 +08:00
|
|
|
|
public int addStringCfg(ComplexkeywordCfg cfg,List<BaseIpCfg> areaIpCfgs){
|
2018-04-09 16:38:45 +08:00
|
|
|
|
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
|
|
|
|
|
this.saveIpBatch(areaIpCfgs);
|
|
|
|
|
|
}
|
2018-03-26 14:43:58 +08:00
|
|
|
|
return complexStringCfgDao.insert(cfg);
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* updateStringCfg(更新IP类配置)
|
|
|
|
|
|
* (继承ComplexkeywordCfg这个类方可使用)
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*int
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-13 13:50:29 +08:00
|
|
|
|
public int updateStringCfg(ComplexkeywordCfg cfg,List<BaseIpCfg> addAreaCfg,List<BaseIpCfg> updateAreaCfg,List<BaseIpCfg> deleteAreaCfgs){
|
2018-04-09 16:38:45 +08:00
|
|
|
|
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
|
|
|
|
|
this.saveIpBatch(addAreaCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
|
|
|
|
|
this.updateIpBatch(updateAreaCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
|
|
|
|
|
this.deleteIpBatch(deleteAreaCfgs);
|
|
|
|
|
|
}
|
2018-04-13 13:50:29 +08:00
|
|
|
|
return complexStringCfgDao.update(cfg);
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* auditStringCfg(审核IP类配置)
|
|
|
|
|
|
* (继承ComplexkeywordCfg这个类方可使用)
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*int
|
2018-03-26 14:43:58 +08:00
|
|
|
|
* @throws Exception
|
2018-02-28 12:15:52 +08:00
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-13 13:50:29 +08:00
|
|
|
|
public void auditStringCfg(int isAduit,List<ComplexkeywordCfg> auditCfg,List<BaseIpCfg> areaCfg,List<ComplexkeywordCfg> sendCfg) throws Exception{
|
|
|
|
|
|
List<List<BaseCfg>> sendCfgs=new ArrayList<List<BaseCfg>>();
|
2018-04-11 18:47:02 +08:00
|
|
|
|
for(ComplexkeywordCfg c:sendCfg){
|
2018-04-13 13:50:29 +08:00
|
|
|
|
List<BaseCfg> cArr=new ArrayList<>();
|
|
|
|
|
|
cArr.add(c);
|
2018-04-11 18:47:02 +08:00
|
|
|
|
sendCfgs.add(cArr);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(Constants.AUDIT_NOT_YES==isAduit||
|
|
|
|
|
|
Constants.AUDIT_YES==isAduit){//审核通过,取消审核通过需要发到maat
|
|
|
|
|
|
if(sendToMaatConvertorBatch(isAduit,sendCfgs)){
|
|
|
|
|
|
if(areaCfg!=null&&areaCfg.size()>0){
|
|
|
|
|
|
this.auditIpBatch(areaCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.auditBatch(auditCfg, IpCfgDao.class);
|
2018-03-26 14:43:58 +08:00
|
|
|
|
}
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}else{
|
2018-04-11 18:47:02 +08:00
|
|
|
|
if(areaCfg!=null&&areaCfg.size()>0){
|
|
|
|
|
|
this.auditIpBatch(areaCfg);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.auditBatch(auditCfg, ComplexStringCfgDao.class);
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* deleteStringCfg(删除IP类配置)
|
|
|
|
|
|
* (继承ComplexkeywordCfg这个类方可使用)
|
|
|
|
|
|
* @param cfg
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*int
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-13 13:50:29 +08:00
|
|
|
|
public void deleteStringCfg(List<ComplexkeywordCfg> cfgs,List<BaseIpCfg> areaCfg){
|
2018-04-10 10:42:24 +08:00
|
|
|
|
if(areaCfg!=null&&areaCfg.size()>0){
|
|
|
|
|
|
this.deleteIpBatch(areaCfg);
|
|
|
|
|
|
}
|
2018-04-11 18:47:02 +08:00
|
|
|
|
this.deleteBatch(cfgs, ComplexStringCfgDao.class);
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* getStringCfg(根据IP与类名获取IP配置)
|
|
|
|
|
|
* (继承ComplexkeywordCfg这个类方可使用)
|
|
|
|
|
|
* @param clazz
|
|
|
|
|
|
* @param id
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*ComplexkeywordCfg
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public ComplexkeywordCfg getStringCfgById(ComplexkeywordCfg cfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
|
return complexStringCfgDao.getById(cfg.getTableName(),cfg.getCfgId());
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
public Integer getIsValid(ComplexkeywordCfg cfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
|
return complexStringCfgDao.getIsValid(cfg);
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
public Integer getIsValid(String tableName, long id){
|
|
|
|
|
|
return complexStringCfgDao.getIsValid(tableName,id);
|
|
|
|
|
|
}
|
|
|
|
|
|
public Integer getIsAudit(ComplexkeywordCfg cfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
|
return complexStringCfgDao.getIsAudit(cfg);
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
public Integer getIsAudit(String tableName, long id){
|
|
|
|
|
|
return complexStringCfgDao.getIsAudit(tableName,id);
|
|
|
|
|
|
}
|
2018-04-11 18:47:02 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* getList(这里用一句话描述这个方法的作用)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @param tableName
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<BaseIpCfg>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<ComplexkeywordCfg> getList(String tableName, String ids) {
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
return complexStringCfgDao.getList(tableName, ids);
|
|
|
|
|
|
}
|
2018-02-28 12:15:52 +08:00
|
|
|
|
}
|