全量下发公共方法:isValid从entity中获取;cfg的auditTime为空,则从entity中获取
getServiceList方法增加根据functionId或serviceId条件获取
This commit is contained in:
@@ -61,6 +61,60 @@ public class ServiceConfigTemplateUtil {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param functionId
|
||||
* @param serviceId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> getServiceList(String functionId,String serviceId){
|
||||
List<Map<String,Object>> list =new ArrayList();
|
||||
List<Element> elements = root.selectNodes("service");
|
||||
boolean flag=false;
|
||||
for(Element element:elements){
|
||||
if(!StringUtil.isEmpty(functionId) || !StringUtil.isEmpty(serviceId) ) {
|
||||
flag=false;
|
||||
String serviceIdC=element.attributeValue("id");
|
||||
String functionIdC=element.attributeValue("functionId");
|
||||
|
||||
if(!StringUtil.isEmpty(functionId) && !StringUtil.isEmpty(serviceId)) {
|
||||
if(serviceIdC.equals(serviceId) && functionIdC.equals(functionId)) {
|
||||
flag=true;
|
||||
}
|
||||
}else {
|
||||
if(!StringUtil.isEmpty(serviceId) && serviceIdC.equals(serviceId) ) {
|
||||
flag=true;
|
||||
}
|
||||
if(!StringUtil.isEmpty(functionId) && functionIdC.equals(functionId) ) {
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
Map<String,Object> map = new HashMap();
|
||||
for(int i=0;i<element.attributes().size();i++){
|
||||
String attributeName = element.attribute(i).getName();
|
||||
|
||||
map.put(attributeName, element.attributeValue(attributeName));
|
||||
}
|
||||
map.put("cfgList", getServiceCfgList(element));
|
||||
map.put("userRegionList",getUserRegionList(element));
|
||||
list.add(map);
|
||||
}
|
||||
}else {
|
||||
Map<String,Object> map = new HashMap();
|
||||
for(int i=0;i<element.attributes().size();i++){
|
||||
String attributeName = element.attribute(i).getName();
|
||||
|
||||
map.put(attributeName, element.attributeValue(attributeName));
|
||||
}
|
||||
map.put("cfgList", getServiceCfgList(element));
|
||||
map.put("userRegionList",getUserRegionList(element));
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务配置列表
|
||||
@@ -111,7 +165,7 @@ public class ServiceConfigTemplateUtil {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
|
||||
List<Map<String,Object>> list = serviceTemplate.getServiceList();
|
||||
List<Map<String,Object>> list = serviceTemplate.getServiceList("","128");
|
||||
for(Map<String,Object> map :list){
|
||||
System.out.println("业务配置:"+map.get("id")+","+map.get("functionId")+","+map.get("serviceType")+","+map.get("tableName"));
|
||||
List<Map<String,Object>> cfgList = (List<Map<String, Object>>) map.get("cfgList");
|
||||
|
||||
Reference in New Issue
Block a user