2018-03-17 17:09:19 +08:00
|
|
|
package com.nis.web.controller.specific;
|
|
|
|
|
|
2018-08-22 19:48:20 +08:00
|
|
|
import java.util.ArrayList;
|
2018-03-17 17:09:19 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
2018-08-22 19:48:20 +08:00
|
|
|
import java.util.Properties;
|
2018-03-17 17:09:19 +08:00
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
2018-04-02 12:41:42 +08:00
|
|
|
import org.apache.shiro.authz.annotation.Logical;
|
2018-03-17 17:09:19 +08:00
|
|
|
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.RequestParam;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import com.nis.domain.Page;
|
2018-08-22 19:48:20 +08:00
|
|
|
import com.nis.domain.SysDataDictionaryItem;
|
2018-03-17 17:09:19 +08:00
|
|
|
import com.nis.domain.specific.SpecificServiceCfg;
|
2018-08-22 19:48:20 +08:00
|
|
|
import com.nis.util.DictUtils;
|
2018-03-17 17:09:19 +08:00
|
|
|
import com.nis.util.StringUtils;
|
|
|
|
|
import com.nis.web.controller.BaseController;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping(value = "${adminPath}/specific/specificServiceCfg")
|
|
|
|
|
public class SpecificServiceCfgController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/* @ModelAttribute
|
|
|
|
|
public SpecificServiceCfg get(@RequestParam(required=false)Integer specServiceId) {
|
|
|
|
|
if (!StringUtil.isEmpty(specServiceId)) {
|
|
|
|
|
SpecificServiceCfg ss = specificServiceCfgService.getBySpecServiceId(specServiceId);
|
|
|
|
|
return ss==null?new SpecificServiceCfg():ss;
|
|
|
|
|
} else {
|
|
|
|
|
return new SpecificServiceCfg();
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查出分页列表
|
|
|
|
|
*
|
|
|
|
|
* @param specificServiceCfg
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @param model
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2018-03-28 08:42:32 +08:00
|
|
|
@RequiresPermissions("specific:service:view")
|
2018-03-17 17:09:19 +08:00
|
|
|
@RequestMapping(value = "list")
|
|
|
|
|
public String list(SpecificServiceCfg specificServiceCfg, HttpServletRequest request, HttpServletResponse response,
|
|
|
|
|
Model model) {
|
|
|
|
|
String searchType = null;
|
|
|
|
|
String searchContent = null;
|
2018-07-16 14:21:21 +08:00
|
|
|
if(specificServiceCfg.getSpecServiceCode()!=null){
|
|
|
|
|
searchType = "specServiceCode";
|
|
|
|
|
searchContent = specificServiceCfg.getSpecServiceCode().toString();
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
|
|
|
|
if(!StringUtils.isBlank(specificServiceCfg.getSpecServiceName())){
|
|
|
|
|
searchType = "specServiceName";
|
|
|
|
|
searchContent = specificServiceCfg.getSpecServiceName();
|
|
|
|
|
}
|
2018-03-21 13:43:43 +08:00
|
|
|
if(!StringUtils.isBlank(specificServiceCfg.getSpecServiceDesc())){
|
|
|
|
|
searchType = "specServiceDesc";
|
|
|
|
|
searchContent = specificServiceCfg.getSpecServiceDesc();
|
|
|
|
|
}
|
|
|
|
|
if(specificServiceCfg.getGroupId()!=null){
|
|
|
|
|
searchType = "groupId";
|
|
|
|
|
searchContent = specificServiceCfg.getGroupId().toString();
|
|
|
|
|
}
|
2018-03-17 17:09:19 +08:00
|
|
|
model.addAttribute("searchType", searchType);
|
|
|
|
|
model.addAttribute("searchContent", searchContent);
|
2018-03-21 13:43:43 +08:00
|
|
|
|
|
|
|
|
Page<SpecificServiceCfg> pageCondition = new Page<SpecificServiceCfg>(request, response);
|
2018-03-17 17:09:19 +08:00
|
|
|
// 取出所有符合条件的数据
|
2018-03-21 13:43:43 +08:00
|
|
|
List<SpecificServiceCfg> allList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg,pageCondition.getOrderBy());
|
2018-03-17 17:09:19 +08:00
|
|
|
model.addAttribute("showTotalCount", allList.size());
|
|
|
|
|
// 取出所有符合条件的顶层分页
|
|
|
|
|
Page<SpecificServiceCfg> page = specificServiceCfgService
|
2018-03-21 13:43:43 +08:00
|
|
|
.findTopPage(pageCondition, specificServiceCfg);
|
2018-03-17 17:09:19 +08:00
|
|
|
// 植入序号
|
|
|
|
|
for (int i = 0; i < page.getList().size(); i++) {
|
|
|
|
|
page.getList().get(i).setShowSequence("" + (i + 1 + ((page.getPageNo() - 1) * page.getPageSize())));
|
|
|
|
|
}
|
|
|
|
|
model.addAttribute("page", page);
|
2018-03-28 08:42:32 +08:00
|
|
|
// 删除顶层数据、取出id
|
2018-03-17 17:09:19 +08:00
|
|
|
List<Integer> intList = Lists.newArrayList();
|
|
|
|
|
for (SpecificServiceCfg tempSS : page.getList()) {
|
|
|
|
|
if (tempSS != null) {
|
|
|
|
|
intList.add(tempSS.getSpecServiceId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int i = allList.size() - 1; i >= 0; i--) {
|
|
|
|
|
SpecificServiceCfg ss = allList.get(i);
|
2018-03-21 13:43:43 +08:00
|
|
|
if ((ss != null && intList.contains(ss.getSpecServiceId())) || (ss != null && ss.getParent().getSpecServiceId() == 0)) {
|
2018-03-17 17:09:19 +08:00
|
|
|
allList.remove(ss);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allList.addAll(page.getList());
|
2018-03-21 13:43:43 +08:00
|
|
|
|
2018-03-17 17:09:19 +08:00
|
|
|
List<SpecificServiceCfg> list = Lists.newArrayList();
|
|
|
|
|
SpecificServiceCfg.sortList(list, allList, 0, true);
|
|
|
|
|
//处理下级序号
|
|
|
|
|
SpecificServiceCfg.addChildrenSeq(list, 0);
|
|
|
|
|
|
|
|
|
|
model.addAttribute("list", list);
|
|
|
|
|
|
|
|
|
|
return "/specific/specificServiceCfgList";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 进入查看或新增、修改页面
|
|
|
|
|
*
|
|
|
|
|
* @param specificServiceCfg
|
|
|
|
|
* @param model
|
|
|
|
|
* @param doAction
|
|
|
|
|
* @param mulitId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2018-04-10 18:04:25 +08:00
|
|
|
@RequiresPermissions(value={"specific:service:add","specific:service:edit","specific:service:view"},logical=Logical.OR)
|
2018-03-17 17:09:19 +08:00
|
|
|
@RequestMapping(value = { "form" })
|
2018-03-29 18:45:37 +08:00
|
|
|
public String form(SpecificServiceCfg specificServiceCfg, Model model, String doAction) {
|
|
|
|
|
if(specificServiceCfg!=null&&specificServiceCfg.getSpecServiceId()!=null){
|
|
|
|
|
specificServiceCfg = specificServiceCfgService.getBySpecServiceId(specificServiceCfg.getSpecServiceId());
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
2018-03-29 18:45:37 +08:00
|
|
|
if (specificServiceCfg == null || specificServiceCfg.getSpecServiceId()==null) {
|
2018-03-17 17:09:19 +08:00
|
|
|
SpecificServiceCfg parent = new SpecificServiceCfg();
|
|
|
|
|
parent.setSpecServiceId(0);
|
|
|
|
|
specificServiceCfg.setParent(parent);
|
2018-07-25 15:19:24 +08:00
|
|
|
specificServiceCfg.setParentType(0);
|
|
|
|
|
}
|
|
|
|
|
if(specificServiceCfg!=null&&specificServiceCfg.getParent().getSpecServiceId()!=null){//获取父配置的id
|
|
|
|
|
specificServiceCfg.setParentType(specificServiceCfgService.getParentType(specificServiceCfg.getParent().getSpecServiceId()));
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
|
|
|
|
model.addAttribute("specificServiceCfg", specificServiceCfg);
|
|
|
|
|
if (doAction != null && doAction.equals("0")) {
|
|
|
|
|
return "/specific/specificServiceCfgInfo";
|
|
|
|
|
}
|
|
|
|
|
return "/specific/specificServiceCfgForm";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增或保存
|
|
|
|
|
* @param specificServiceCfg
|
|
|
|
|
* @param model
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2018-04-10 18:04:25 +08:00
|
|
|
@RequiresPermissions(value= {"specific:service:add","specific:service:edit"},logical=Logical.OR)
|
2018-03-17 17:09:19 +08:00
|
|
|
@RequestMapping(value="saveOrUpdate")
|
|
|
|
|
public String saveOrUpdate(SpecificServiceCfg specificServiceCfg, Model model,
|
2018-06-21 09:12:25 +08:00
|
|
|
RedirectAttributes redirectAttributes) {
|
2018-03-17 17:09:19 +08:00
|
|
|
try {
|
2018-06-21 09:12:25 +08:00
|
|
|
specificServiceCfgService.saveOrUpdate(specificServiceCfg);
|
2018-03-28 18:24:09 +08:00
|
|
|
addMessage(redirectAttributes, "save_success");
|
2018-03-17 17:09:19 +08:00
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
2018-03-28 18:24:09 +08:00
|
|
|
addMessage(redirectAttributes, "save_failed");
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
|
|
|
|
return "redirect:" + adminPath + "/specific/specificServiceCfg/list";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除
|
|
|
|
|
* @param specificServiceCfg
|
|
|
|
|
* @param redirectAttributes
|
|
|
|
|
* @param mulitId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2018-04-10 18:04:25 +08:00
|
|
|
@RequiresPermissions("specific:service:del")
|
2018-03-17 17:09:19 +08:00
|
|
|
@RequestMapping(value="delete")
|
|
|
|
|
public String delete(SpecificServiceCfg specificServiceCfg, RedirectAttributes redirectAttributes, String mulitId){
|
|
|
|
|
try{
|
|
|
|
|
specificServiceCfgService.delete(mulitId);
|
2018-03-28 18:24:09 +08:00
|
|
|
addMessage(redirectAttributes,"delete_success");
|
2018-03-17 17:09:19 +08:00
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
2018-03-28 18:24:09 +08:00
|
|
|
addMessage(redirectAttributes,"delete_failed");
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "redirect:"+adminPath+"/specific/specificServiceCfg/list";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 父节点选择树形结构
|
2018-06-21 18:10:07 +08:00
|
|
|
* @param extId排除节点id
|
2018-03-17 17:09:19 +08:00
|
|
|
* @param isShowHide
|
2018-06-21 18:10:07 +08:00
|
|
|
* @param isLeafShow:叶子节点是否显示
|
2018-03-17 17:09:19 +08:00
|
|
|
* @param response
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequestMapping(value = "treeData")
|
2018-08-23 15:10:21 +08:00
|
|
|
public List<Map<String, Object>> treeData(@RequestParam(required=false)Boolean specific,@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide,
|
2018-07-23 18:48:11 +08:00
|
|
|
@RequestParam(required=false)boolean isLeafShow,@RequestParam(required=true)Integer cfgType,HttpServletResponse response){
|
2018-03-17 17:09:19 +08:00
|
|
|
List<Map<String, Object>> mapList = Lists.newArrayList();
|
|
|
|
|
Map<String, Object> map2 = Maps.newHashMap();
|
|
|
|
|
map2.put("id", 0);
|
|
|
|
|
map2.put("pId", 0);
|
2018-07-25 15:19:24 +08:00
|
|
|
map2.put("type",0);
|
2018-08-22 19:48:20 +08:00
|
|
|
map2.put("business",-2);
|
2018-03-28 18:24:09 +08:00
|
|
|
map2.put("name","root_node");
|
2018-03-17 17:09:19 +08:00
|
|
|
//map2.put("placeholder","0");
|
|
|
|
|
mapList.add(map2);
|
2018-08-23 15:10:21 +08:00
|
|
|
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;
|
|
|
|
|
}
|
2018-08-22 19:48:20 +08:00
|
|
|
}
|
2018-08-23 15:10:21 +08:00
|
|
|
}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;
|
2018-08-22 19:48:20 +08:00
|
|
|
}
|
|
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
|
|
map.put("id", specificServiceCfg.getSpecServiceId());
|
|
|
|
|
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
|
|
|
|
|
map.put("name",specificServiceCfg.getSpecServiceName());
|
2018-08-23 15:10:21 +08:00
|
|
|
map.put("type",specificServiceCfg.getCfgType());
|
2018-08-22 19:48:20 +08:00
|
|
|
mapList.add(map);
|
|
|
|
|
}
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-08-22 19:48:20 +08:00
|
|
|
// map2.put("nodes", businessList);
|
2018-03-17 17:09:19 +08:00
|
|
|
return mapList;
|
|
|
|
|
}
|
2018-07-23 18:48:11 +08:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequestMapping(value = "childrenList")
|
|
|
|
|
public List<Map<String, Object>> childrenList(@RequestParam(required=false)Integer parent,HttpServletResponse response){
|
|
|
|
|
List<Map<String, Object>> mapList = Lists.newArrayList();
|
|
|
|
|
List<SpecificServiceCfg> list = specificServiceCfgService.getChildrenById(parent);
|
|
|
|
|
for (int i=0; i<list.size(); i++){
|
|
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
|
|
SpecificServiceCfg specificServiceCfg = list.get(i);
|
|
|
|
|
if(specificServiceCfg.getIsLeaf().equals(1)){
|
|
|
|
|
map.put("code", specificServiceCfg.getSpecServiceCode());
|
|
|
|
|
map.put("pId", specificServiceCfg.getParent().getSpecServiceId());
|
|
|
|
|
map.put("name",specificServiceCfg.getSpecServiceName());
|
2018-07-25 15:19:24 +08:00
|
|
|
map.put("type",specificServiceCfg.getCfgType());
|
2018-07-23 18:48:11 +08:00
|
|
|
mapList.add(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return mapList;
|
|
|
|
|
}
|
2018-03-17 17:09:19 +08:00
|
|
|
/**
|
|
|
|
|
* 校验协议id是否重复
|
|
|
|
|
* @param specServiceId
|
|
|
|
|
* @param oldId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
2018-07-30 09:15:36 +08:00
|
|
|
@RequestMapping(value = "isCodeNotRepeat")
|
|
|
|
|
public boolean isIdRepeat(@RequestParam(required=false,value="parentId")Integer parentId,@RequestParam(required=false,value="specServiceId")Integer specServiceId,@RequestParam(required=true,value="specServiceCode")Integer specServiceCode,@RequestParam(required=true,value="cfgType")Integer cfgType){
|
|
|
|
|
if(parentId!=null&&parentId.intValue()!=0) {
|
|
|
|
|
Integer parentCode=specificServiceCfgService.getParentCode(parentId);
|
|
|
|
|
if(parentCode!=null&&parentCode.intValue()==specServiceCode) {
|
|
|
|
|
return false;
|
2018-03-21 13:43:43 +08:00
|
|
|
}
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
|
|
|
|
if(specServiceId!=null){
|
|
|
|
|
SpecificServiceCfg ss = specificServiceCfgService.getBySpecServiceId(Integer.valueOf(specServiceId));
|
2018-07-30 09:15:36 +08:00
|
|
|
if(ss!=null){
|
|
|
|
|
if(ss.getSpecServiceCode().intValue()==specServiceCode.intValue()&&cfgType.intValue()==ss.getCfgType().intValue()) {
|
|
|
|
|
return true;
|
|
|
|
|
}else {
|
|
|
|
|
ss=specificServiceCfgService.getRepeat(specServiceCode, cfgType,parentId);
|
|
|
|
|
if(ss==null) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
2018-07-30 09:15:36 +08:00
|
|
|
}else {
|
|
|
|
|
SpecificServiceCfg ss=specificServiceCfgService.getRepeat(specServiceCode, cfgType,parentId);
|
|
|
|
|
if(ss==null) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2018-03-17 17:09:19 +08:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验叶子节点无上级不得选为叶子节点
|
|
|
|
|
* @param specServiceId
|
|
|
|
|
* @param oldId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequestMapping(value = "ajaxLeafHasTree")
|
|
|
|
|
public boolean ajaxLeafHasTree(Integer parentId, Integer newIsLeaf){
|
|
|
|
|
if(parentId==null||parentId==0){
|
|
|
|
|
if(newIsLeaf==0){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(parentId!=null&parentId!=0){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验叶子节点有下级不得更改为叶子节点
|
|
|
|
|
* @param parent
|
|
|
|
|
* @param newIsLeaf
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@RequestMapping(value = "ajaxLeafChange")
|
|
|
|
|
public boolean ajaxLeafChange(Integer parent,Integer newIsLeaf){
|
|
|
|
|
if(parent==null){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
List<SpecificServiceCfg> list = specificServiceCfgService.getChildrenById(parent);
|
2018-03-21 13:43:43 +08:00
|
|
|
if(list==null||list.size()==0){
|
2018-03-17 17:09:19 +08:00
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
if(newIsLeaf==0){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|