(1)tree属性扩展,支持新增节点

(2)特定服务增加一列标记新增节点
This commit is contained in:
wangxin
2018-08-24 11:54:21 +08:00
parent 295d92fe79
commit 063fa03a94
15 changed files with 328 additions and 21 deletions

View File

@@ -1,6 +1,5 @@
package com.nis.web.controller.specific;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -13,6 +12,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -22,6 +22,8 @@ import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
@@ -201,8 +203,9 @@ public class SpecificServiceCfgController extends BaseController {
Map<String, Object> map2 = Maps.newHashMap();
map2.put("id", 0);
map2.put("pId", 0);
map2.put("type",0);
map2.put("serviceType",0);
map2.put("business",-2);
map2.put("groupId",0);
map2.put("name","root_node");
//map2.put("placeholder","0");
mapList.add(map2);
@@ -222,6 +225,7 @@ public class SpecificServiceCfgController extends BaseController {
map.put("name",props.getProperty(dict.getItemValue(), dict.getItemValue()));
map.put("serviceType",cfgType);
map.put("businessType","-1");
map.put("groupId",0);
businessList.add(map);
}
mapList.addAll(businessList);
@@ -242,7 +246,12 @@ public class SpecificServiceCfgController extends BaseController {
map.put("pId", "businessType"+business.getItemCode());
map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType());
map.put("serviceCode",specificServiceCfg.getSpecServiceCode());
map.put("businessType",specificServiceCfg.getBusinessType());
map.put("groupId",specificServiceCfg.getGroupId());
if(specificServiceCfg.getAddFlag()!=null) {
map.put("user",specificServiceCfg.getAddFlag());
}
mapList.add(map);
break;
}
@@ -253,6 +262,7 @@ public class SpecificServiceCfgController extends BaseController {
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
map.put("name",specificServiceCfg.getSpecServiceName());
map.put("serviceType",specificServiceCfg.getCfgType());
map.put("groupId",specificServiceCfg.getGroupId());
mapList.add(map);
}
}
@@ -272,6 +282,10 @@ public class SpecificServiceCfgController extends BaseController {
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
map.put("name",specificServiceCfg.getSpecServiceName());
map.put("type",specificServiceCfg.getCfgType());
map.put("groupId",specificServiceCfg.getGroupId());
if(specificServiceCfg.getAddFlag()!=null) {
map.put("user",specificServiceCfg.getAddFlag());
}
mapList.add(map);
}
}
@@ -380,5 +394,70 @@ public class SpecificServiceCfgController extends BaseController {
}
return false;
}
@ResponseBody
@RequestMapping(value = "ajaxSaveOrUpdateApp",method=RequestMethod.POST )
public Map<String,Object> ajaxSaveOrUpdateApp(@RequestParam(required=true,value="specServiceId")String specServiceId,@RequestParam(required=false,value="specServiceCode")String specServiceCode,@RequestParam(required=true,value="specServiceName") String specServiceName,
@RequestParam(required=true,value="cfgType") String cfgType, @RequestParam(required=true,value="businessType")String businessType,@RequestParam(required=false,value="addFlag")String addFlag,
@RequestParam(required=false,value="groupId")String groupId){
Map<String, Object> map = Maps.newHashMap();
//校验是真ID还是假ID假的Id以manual开头无法转换成数字
boolean isTrueId=false;
try {
Long.parseLong(specServiceId);
isTrueId=true;
}catch (Exception e) {
// TODO: handle exception
}
try{
SpecificServiceCfg cfg=new SpecificServiceCfg();
if(isTrueId) {
cfg.setSpecServiceId(Integer.parseInt(specServiceId));
}
if(StringUtils.isNotBlank(specServiceCode)) {
cfg.setSpecServiceCode(Integer.parseInt(specServiceCode));
}
cfg.setAddFlag(Integer.parseInt(addFlag));
cfg.setSpecServiceName(specServiceName);
cfg.setBusinessType(businessType);
cfg.setCfgType(Integer.parseInt(cfgType));
cfg.setIsValid(Constants.VALID_YES);
if(StringUtils.isNotBlank(groupId)) {
cfg.setGroupId(Integer.parseInt(groupId));
}
SpecificServiceCfg parent=new SpecificServiceCfg();
parent.setSpecServiceId(0);
cfg.setParent(parent);
specificServiceCfgService.saveOrUpdate(cfg);
cfg=specificServiceCfgService.getBySpecServiceId(cfg.getSpecServiceId());
map.put("id", cfg.getSpecServiceId());
map.put("pId", "businessType"+cfg.getBusinessType());
map.put("name",cfg.getSpecServiceName());
map.put("serviceType",cfg.getCfgType());
map.put("businessType",cfg.getBusinessType());
map.put("groupId",cfg.getGroupId());
return map;
}catch (Exception e) {
e.printStackTrace();
if(e instanceof MaatConvertException) {
map.put("errTip", "request_service_failed");
}else {
map.put("errTip", "save_failed");
}
}
return map;
}
@ResponseBody
@RequestMapping(value = "ajaxRemoveApp",method=RequestMethod.POST )
public boolean ajaxRemoveApp(@RequestParam(required=true,value="specServiceId")Integer specServiceId){
try{
specificServiceCfgService.delete(String.valueOf(specServiceId));
return true;
}catch (Exception e) {
e.printStackTrace();
}
return false;
}
}