2018-02-27 15:31:30 +08:00
|
|
|
|
package com.nis.web.service.configuration;
|
|
|
|
|
|
|
2018-04-11 16:44:45 +08:00
|
|
|
|
import java.util.ArrayList;
|
2018-04-09 16:38:45 +08:00
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
2018-02-27 15:31:30 +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 16:44:45 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseCfg;
|
|
|
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
2018-02-27 15:31:30 +08:00
|
|
|
|
import com.nis.domain.configuration.BaseStringCfg;
|
2018-03-26 14:43:58 +08:00
|
|
|
|
import com.nis.util.Constants;
|
2018-04-11 16:44:45 +08:00
|
|
|
|
import com.nis.web.dao.configuration.IpCfgDao;
|
2018-02-27 15:31:30 +08:00
|
|
|
|
import com.nis.web.dao.configuration.StringCfgDao;
|
|
|
|
|
|
import com.nis.web.service.CrudService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* String相关配置事务类
|
|
|
|
|
|
* @author dell
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Service
|
|
|
|
|
|
public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
protected StringCfgDao stringCfgDao;
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* addStringCfg(新增IP类配置)
|
|
|
|
|
|
* (继承BaseStringCfg这个类方可使用)
|
|
|
|
|
|
* @param baseStringCfg
|
|
|
|
|
|
* @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(BaseStringCfg baseStringCfg,List<AreaIpCfg> areaIpCfgs){
|
|
|
|
|
|
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
|
|
|
|
|
this.saveIpBatch(areaIpCfgs);
|
|
|
|
|
|
}
|
2018-03-26 14:43:58 +08:00
|
|
|
|
return stringCfgDao.insert(baseStringCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* updateStringCfg(更新IP类配置)
|
|
|
|
|
|
* (继承BaseStringCfg这个类方可使用)
|
|
|
|
|
|
* @param baseStringCfg
|
|
|
|
|
|
* @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(BaseStringCfg baseStringCfg,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 stringCfgDao.updateByPrimaryKeySelective(baseStringCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* auditStringCfg(审核IP类配置)
|
|
|
|
|
|
* (继承BaseStringCfg这个类方可使用)
|
|
|
|
|
|
* @param baseStringCfg
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*int
|
2018-03-26 14:43:58 +08:00
|
|
|
|
* @throws Exception
|
2018-02-27 15:31:30 +08:00
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-11 16:44:45 +08:00
|
|
|
|
public void auditStringCfg(int isAduit,List<BaseStringCfg> auditCfg,List<AreaIpCfg> areaCfg,List<BaseStringCfg> sendCfg) throws Exception{
|
|
|
|
|
|
List<BaseCfg[]> sendCfgs=new ArrayList<BaseCfg[]>();
|
|
|
|
|
|
for(BaseStringCfg c:sendCfg){
|
|
|
|
|
|
BaseStringCfg[] cArr=new BaseStringCfg[1];
|
|
|
|
|
|
cArr[0]=c;
|
|
|
|
|
|
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, StringCfgDao.class);
|
2018-03-26 14:43:58 +08:00
|
|
|
|
}
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}else{
|
2018-04-11 16:44:45 +08:00
|
|
|
|
this.auditBatch(auditCfg, IpCfgDao.class);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* deleteStringCfg(删除IP类配置)
|
|
|
|
|
|
* (继承BaseStringCfg这个类方可使用)
|
|
|
|
|
|
* @param baseStringCfg
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*int
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
2018-03-05 16:30:16 +08:00
|
|
|
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
2018-04-11 16:44:45 +08:00
|
|
|
|
public void deleteStringCfg(List<BaseStringCfg> stringCfg,List<AreaIpCfg> areaCfg){
|
2018-04-10 10:42:24 +08:00
|
|
|
|
if(areaCfg!=null&&areaCfg.size()>0){
|
|
|
|
|
|
this.deleteIpBatch(areaCfg);
|
|
|
|
|
|
}
|
2018-04-11 16:44:45 +08:00
|
|
|
|
this.deleteBatch(stringCfg, StringCfgDao.class);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
* getStringCfg(根据IP与类名获取IP配置)
|
|
|
|
|
|
* (继承BaseStringCfg这个类方可使用)
|
|
|
|
|
|
* @param clazz
|
|
|
|
|
|
* @param id
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*BaseStringCfg
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public BaseStringCfg getStringCfgById(BaseStringCfg baseStringCfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
|
return stringCfgDao.getById(baseStringCfg.getTableName(), baseStringCfg.getCfgId());
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
public Integer getIsValid(BaseStringCfg baseStringCfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
|
return stringCfgDao.getIsValid(baseStringCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
public Integer getIsValid(String tableName, long id){
|
|
|
|
|
|
return stringCfgDao.getIsValid(tableName,id);
|
|
|
|
|
|
}
|
|
|
|
|
|
public Integer getIsAudit(BaseStringCfg baseStringCfg){
|
2018-03-26 14:43:58 +08:00
|
|
|
|
return stringCfgDao.getIsAudit(baseStringCfg);
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
public Integer getIsAudit(String tableName, long id){
|
|
|
|
|
|
return stringCfgDao.getIsAudit(tableName,id);
|
|
|
|
|
|
}
|
2018-04-11 16:44:45 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* getList(这里用一句话描述这个方法的作用)
|
|
|
|
|
|
* (这里描述这个方法适用条件 – 可选)
|
|
|
|
|
|
* @param tableName
|
|
|
|
|
|
* @param ids
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*List<BaseStringCfg>
|
|
|
|
|
|
* @exception
|
|
|
|
|
|
* @since 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<BaseStringCfg> getList(String tableName, String ids) {
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
return stringCfgDao.getList(tableName,ids);
|
|
|
|
|
|
}
|
2018-02-27 15:31:30 +08:00
|
|
|
|
}
|