This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-argus-service/src/main/java/com/nis/web/service/restful/ConfigPzIdService.java
renkaige 996a780c3c 1:修改证书类配置的表达式删除最后面的\n
2:修改redis连接池信息
3:修改获取配置id的方式,改为从程序中遍历,从redis中太耗时了
4:添加单独添加域,删除域使用多线程的方法
2018-11-14 19:29:35 +08:00

79 lines
2.4 KiB
Java

/**
*
*/
package com.nis.web.service.restful;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.restful.ConfigPzIdSource;
import com.nis.web.dao.ConfigPzIdDao;
import com.nis.web.service.BaseLogService;
import com.zdjizhi.utils.StringUtil;
/**
* @ClassName:ConfigPzIdService
* @Description:TODO(这里用一句话描述这个类的作用)
* @author (zdx)
* @date 2017年9月20日 上午10:43:36
* @version V1.0
*/
@Service
public class ConfigPzIdService extends BaseLogService {
protected final Logger logger = Logger.getLogger(this.getClass());
/**
* 持久层对象
*/
@Autowired
protected ConfigPzIdDao dao;
@Autowired
ConfigRedisService configRedisService;
private static Map<String, String> sourceNameMap = new HashMap<String, String>();
static {
sourceNameMap.put("CONFIG_COMPILE", "SEQ_COMPILEID");
sourceNameMap.put("CONFIG_GROUP", "SEQ_GROUPID");
sourceNameMap.put("CONFIG_REGION", "SEQ_REGIONID");
}
public ConfigPzIdSource getConfigPzIdListOld(ConfigPzIdSource entity) {
List<Long> pzIdList = new ArrayList<Long>();
entity.setSourceName(entity.getSourceName().toUpperCase());
String seqName = StringUtil.isEmpty(sourceNameMap.get(entity.getSourceName())) ? "SEQ_COMPILEID"
: sourceNameMap.get(entity.getSourceName());
for (int i = 0; i < entity.getNum(); i++) {
// pzIdList.add(dao.getConfigPzIdList(entity)); //直接从数据库序列号获取
pzIdList.add(configRedisService.getIncrId(seqName));
}
entity.setPzIdList(pzIdList);
return entity;
}
public ConfigPzIdSource getConfigPzIdList(ConfigPzIdSource entity) {
List<Long> pzIdList = new LinkedList<Long>();
entity.setSourceName(entity.getSourceName().toUpperCase());
String seqName = StringUtil.isEmpty(sourceNameMap.get(entity.getSourceName())) ? "SEQ_COMPILEID"
: sourceNameMap.get(entity.getSourceName());
long endNum = configRedisService.getIncrById(seqName, entity.getNum());
long startNum=endNum-entity.getNum();
for (long i = endNum; i > startNum; i--) {
// pzIdList.add(dao.getConfigPzIdList(entity)); //直接从数据库序列号获取
pzIdList.add(i);
}
entity.setPzIdList(pzIdList);
return entity;
}
}