2018-02-28 12:15:52 +08:00
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
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-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;
|
|
|
|
|
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-09 16:38:45 +08:00
|
|
|
public int addStringCfg(ComplexkeywordCfg cfg,List<AreaIpCfg> areaIpCfgs){
|
|
|
|
|
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-09 16:38:45 +08:00
|
|
|
public int updateStringCfg(ComplexkeywordCfg cfg,List<AreaIpCfg> addAreaCfg,List<AreaIpCfg> updateAreaCfg,List<AreaIpCfg> deleteAreaCfgs){
|
|
|
|
|
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
|
|
|
|
this.saveIpBatch(addAreaCfg);
|
|
|
|
|
}
|
|
|
|
|
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
|
|
|
|
this.updateIpBatch(updateAreaCfg);
|
|
|
|
|
}
|
|
|
|
|
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
|
|
|
|
this.deleteIpBatch(deleteAreaCfgs);
|
|
|
|
|
}
|
|
|
|
|
return complexStringCfgDao.updateByPrimaryKeySelective(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-03-26 14:43:58 +08:00
|
|
|
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);
|
|
|
|
|
}
|
2018-02-28 12:15:52 +08:00
|
|
|
}else{
|
|
|
|
|
return complexStringCfgDao.audit(cfg);
|
|
|
|
|
}
|
2018-03-26 14:43:58 +08:00
|
|
|
return 0;
|
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-02-28 12:15:52 +08:00
|
|
|
public int deleteStringCfg(ComplexkeywordCfg cfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
return complexStringCfgDao.updateValid(cfg);
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|