隐藏isLeaf字段,修复insert没加businessType字段

This commit is contained in:
wangxin
2018-08-23 15:10:21 +08:00
parent 190b90099b
commit ac21f74043
3 changed files with 67 additions and 75 deletions

View File

@@ -195,7 +195,7 @@ public class SpecificServiceCfgController extends BaseController {
*/
@ResponseBody
@RequestMapping(value = "treeData")
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide,
public List<Map<String, Object>> treeData(@RequestParam(required=false)Boolean specific,@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide,
@RequestParam(required=false)boolean isLeafShow,@RequestParam(required=true)Integer cfgType,HttpServletResponse response){
List<Map<String, Object>> mapList = Lists.newArrayList();
Map<String, Object> map2 = Maps.newHashMap();
@@ -206,84 +206,76 @@ public class SpecificServiceCfgController extends BaseController {
map2.put("name","root_node");
//map2.put("placeholder","0");
mapList.add(map2);
Properties props=this.getMsgProp();
List<SysDataDictionaryItem> businessTypeList=Lists.newArrayList();
if(cfgType==1) {
businessTypeList=DictUtils.getDictList("APP_BUSINESS_TYPE");
}else if(cfgType==3) {
businessTypeList=DictUtils.getDictList("BASIC_PROTOCOL_BUSINESS_TYPE");
}
List<Map<String, Object>> businessList = Lists.newArrayList();
for(SysDataDictionaryItem dict:businessTypeList) {
Map<String, Object> map = Maps.newHashMap();
map.put("id", "businessType"+dict.getItemCode());
map.put("pId", 0);
map.put("name",props.getProperty(dict.getItemValue(), dict.getItemValue()));
map.put("serviceType",cfgType);
map.put("businessType","-1");
map.put("nodes", new ArrayList<Map<String, Object>>());
businessList.add(map);
}
mapList.addAll(businessList);
List<SpecificServiceCfg> list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),"");
for (int i=0; i<list.size(); i++){
SpecificServiceCfg specificServiceCfg = list.get(i);
if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
if(specificServiceCfg.getIsValid().equals(0)||
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||
(cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){
continue;
}
if(businessTypeList.size()>0) {
for(SysDataDictionaryItem business:businessTypeList) {
if(String.valueOf(business.getItemCode()).equals(specificServiceCfg.getBusinessType())) {
Map<String, Object> map = Maps.newHashMap();
map.put("id", specificServiceCfg.getSpecServiceId());
map.put("pId", "businessType"+business.getItemCode());
map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType());
map.put("businessType",specificServiceCfg.getBusinessType());
mapList.add(map);
break;
}
if(specific==null||!specific) {
Properties props=this.getMsgProp();
List<SysDataDictionaryItem> businessTypeList=Lists.newArrayList();
if(cfgType==1) {
businessTypeList=DictUtils.getDictList("APP_BUSINESS_TYPE");
}else if(cfgType==3) {
businessTypeList=DictUtils.getDictList("BASIC_PROTOCOL_BUSINESS_TYPE");
}
List<Map<String, Object>> businessList = Lists.newArrayList();
for(SysDataDictionaryItem dict:businessTypeList) {
Map<String, Object> map = Maps.newHashMap();
map.put("id", "businessType"+dict.getItemCode());
map.put("pId", 0);
map.put("name",props.getProperty(dict.getItemValue(), dict.getItemValue()));
map.put("serviceType",cfgType);
map.put("businessType","-1");
businessList.add(map);
}
mapList.addAll(businessList);
List<SpecificServiceCfg> list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),"");
for (int i=0; i<list.size(); i++){
SpecificServiceCfg specificServiceCfg = list.get(i);
if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
if(specificServiceCfg.getIsValid().equals(0)||
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||
(cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){
continue;
}
if(businessTypeList.size()>0) {
for(SysDataDictionaryItem business:businessTypeList) {
if(String.valueOf(business.getItemCode()).equals(specificServiceCfg.getBusinessType())) {
Map<String, Object> map = Maps.newHashMap();
map.put("id", specificServiceCfg.getSpecServiceId());
map.put("pId", "businessType"+business.getItemCode());
map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType());
map.put("businessType",specificServiceCfg.getBusinessType());
mapList.add(map);
break;
}
}
}else {
Map<String, Object> map = Maps.newHashMap();
map.put("id", specificServiceCfg.getSpecServiceId());
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType());
mapList.add(map);
}
}
}
}else {
List<SpecificServiceCfg> list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),"");
for (int i=0; i<list.size(); i++){
SpecificServiceCfg specificServiceCfg = list.get(i);
if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
if(specificServiceCfg.getIsValid().equals(0)||
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||
(cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){
continue;
}
}else {
Map<String, Object> map = Maps.newHashMap();
map.put("id", specificServiceCfg.getSpecServiceId());
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType());
map.put("type",specificServiceCfg.getCfgType());
mapList.add(map);
}
}
}
// List<SpecificServiceCfg> list = specificServiceCfgService.findAllSpecificServiceCfg(new SpecificServiceCfg(),"");
//
// for (int i=0; i<list.size(); i++){
// SpecificServiceCfg specificServiceCfg = list.get(i);
// if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
// if(specificServiceCfg.getIsValid().equals(0)||
// (!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))||
// (cfgType.intValue()!=0&&specificServiceCfg.getCfgType().intValue()!=cfgType)){
// continue;
// }
// for(Map<String, Object> business:businessList) {
// if(String.valueOf(business.get("id")).equals(specificServiceCfg.getBusinessType())) {
// Map<String, Object> map = Maps.newHashMap();
// map.put("id", specificServiceCfg.getSpecServiceId());
// map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
// map.put("name",specificServiceCfg.getSpecServiceName());
// map.put("type",specificServiceCfg.getCfgType());
// map.put("business",specificServiceCfg.getBusinessType());
// ((List<Map<String, Object>>)business.get("nodes")).add(map);
// break;
// }
// }
//
//
// }
// }
// map2.put("nodes", businessList);
return mapList;
}