2018-01-09 16:50:39 +08:00
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
2018-04-08 16:15:06 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
2018-02-23 09:54:28 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2018-01-09 16:50:39 +08:00
|
|
|
import org.springframework.stereotype.Service;
|
2018-02-25 18:43:20 +08:00
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
2018-01-09 16:50:39 +08:00
|
|
|
|
2018-04-08 16:15:06 +08:00
|
|
|
import com.nis.domain.configuration.AreaIpCfg;
|
2018-02-23 09:54:28 +08:00
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-03-26 14:43:58 +08:00
|
|
|
import com.nis.util.Constants;
|
2018-04-08 16:15:06 +08:00
|
|
|
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
2018-02-23 09:54:28 +08:00
|
|
|
import com.nis.web.dao.configuration.IpCfgDao;
|
|
|
|
|
import com.nis.web.service.CrudService;
|
|
|
|
|
|
2018-01-09 16:50:39 +08:00
|
|
|
/**
|
|
|
|
|
* IP相关配置事务类
|
|
|
|
|
* @author dell
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
2018-02-23 09:54:28 +08:00
|
|
|
public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|
|
|
|
@Autowired
|
|
|
|
|
protected IpCfgDao ipCfgDao;
|
2018-04-08 16:15:06 +08:00
|
|
|
@Autowired
|
|
|
|
|
protected AreaIpCfgDao areaIpCfgDao;
|
2018-02-23 09:54:28 +08:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* addIpCfg(新增IP类配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param baseIpCfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-08 16:15:06 +08:00
|
|
|
public int addIpCfg(BaseIpCfg baseIpCfg,List<AreaIpCfg> areaIpCfgs){
|
|
|
|
|
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
|
|
|
|
this.saveIpBatch(areaIpCfgs);
|
|
|
|
|
}
|
2018-03-26 14:43:58 +08:00
|
|
|
return ipCfgDao.insert(baseIpCfg);
|
2018-02-23 09:54:28 +08:00
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* updateIpCfg(更新IP类配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param baseIpCfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-08 16:15:06 +08:00
|
|
|
public int updateIpCfg(BaseIpCfg baseIpCfg,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);
|
|
|
|
|
}
|
2018-03-26 14:43:58 +08:00
|
|
|
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
2018-02-25 18:43:20 +08:00
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* auditIpCfg(审核IP类配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param baseIpCfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
2018-03-26 14:43:58 +08:00
|
|
|
* @throws Exception
|
2018-02-25 18:43:20 +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 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);
|
|
|
|
|
}
|
2018-02-25 18:43:20 +08:00
|
|
|
}else{
|
|
|
|
|
return ipCfgDao.audit(baseIpCfg);
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-26 14:43:58 +08:00
|
|
|
return 0;
|
2018-02-25 18:43:20 +08:00
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* deleteIpCfg(删除IP类配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param baseIpCfg
|
|
|
|
|
* @return
|
|
|
|
|
*int
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-10 10:42:24 +08:00
|
|
|
public int deleteIpCfg(BaseIpCfg baseIpCfg, List<AreaIpCfg> areaCfg){
|
|
|
|
|
if(areaCfg!=null&&areaCfg.size()>0){
|
|
|
|
|
this.deleteIpBatch(areaCfg);
|
|
|
|
|
}
|
2018-03-26 14:43:58 +08:00
|
|
|
return ipCfgDao.updateValid(baseIpCfg);
|
2018-02-23 09:54:28 +08:00
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* getIpCfg(根据IP与类名获取IP配置)
|
|
|
|
|
* (继承BaseIpCfg这个类方可使用)
|
|
|
|
|
* @param clazz
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*BaseIpCfg
|
|
|
|
|
* @exception
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
*/
|
|
|
|
|
public BaseIpCfg getIpCfgById(BaseIpCfg baseIpCfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
return ipCfgDao.getById(baseIpCfg.getTableName(), baseIpCfg.getCfgId());
|
2018-02-25 18:43:20 +08:00
|
|
|
}
|
|
|
|
|
public Integer getIsValid(BaseIpCfg baseIpCfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
return ipCfgDao.getIsValid(baseIpCfg);
|
2018-02-25 18:43:20 +08:00
|
|
|
}
|
|
|
|
|
public Integer getIsValid(String tableName, long id){
|
|
|
|
|
return ipCfgDao.getIsValid(tableName,id);
|
|
|
|
|
}
|
|
|
|
|
public Integer getIsAudit(BaseIpCfg baseIpCfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
return ipCfgDao.getIsAudit(baseIpCfg);
|
2018-02-25 18:43:20 +08:00
|
|
|
}
|
|
|
|
|
public Integer getIsAudit(String tableName, long id){
|
|
|
|
|
return ipCfgDao.getIsAudit(tableName,id);
|
2018-02-23 09:54:28 +08:00
|
|
|
}
|
2018-04-08 16:15:06 +08:00
|
|
|
public List<AreaIpCfg> getAreaCfgByCompileId(int compileId){
|
|
|
|
|
return areaIpCfgDao.getByCompileId(compileId);
|
|
|
|
|
}
|
2018-01-09 16:50:39 +08:00
|
|
|
}
|