2017-12-19 14:55:52 +08:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
package com.nis.web.service.restful;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2018-05-24 17:22:38 +08:00
|
|
|
import java.util.HashMap;
|
2017-12-19 14:55:52 +08:00
|
|
|
import java.util.List;
|
2018-05-24 17:22:38 +08:00
|
|
|
import java.util.Map;
|
2017-12-19 14:55:52 +08:00
|
|
|
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import com.nis.domain.restful.ConfigPzIdSource;
|
2018-05-24 17:22:38 +08:00
|
|
|
import com.nis.util.StringUtil;
|
2017-12-19 14:55:52 +08:00
|
|
|
import com.nis.web.dao.ConfigPzIdDao;
|
|
|
|
|
import com.nis.web.service.BaseLogService;
|
2018-05-24 17:22:38 +08:00
|
|
|
import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion.Static;
|
2017-12-19 14:55:52 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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;
|
|
|
|
|
|
2018-05-24 17:22:38 +08:00
|
|
|
@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");
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-19 14:55:52 +08:00
|
|
|
public ConfigPzIdSource getConfigPzIdList(ConfigPzIdSource entity){
|
|
|
|
|
List<Long> pzIdList = new ArrayList<Long>();
|
|
|
|
|
entity.setSourceName(entity.getSourceName().toUpperCase());
|
2018-05-24 17:22:38 +08:00
|
|
|
String seqName= StringUtil.isEmpty(sourceNameMap.get(entity.getSourceName()))?"SEQ_COMPILEID":sourceNameMap.get(entity.getSourceName());
|
2017-12-19 14:55:52 +08:00
|
|
|
for (int i = 0; i < entity.getNum(); i++) {
|
2018-05-24 17:22:38 +08:00
|
|
|
//pzIdList.add(dao.getConfigPzIdList(entity)); //直接从数据库序列号获取
|
|
|
|
|
pzIdList.add(configRedisService.getIncrId(seqName));
|
2017-12-19 14:55:52 +08:00
|
|
|
}
|
|
|
|
|
entity.setPzIdList(pzIdList);
|
|
|
|
|
return entity;
|
|
|
|
|
}
|
|
|
|
|
}
|