隐藏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;
}

View File

@@ -164,8 +164,8 @@
<!-- 新增 -->
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true">
insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type)
values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType})
insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type,business_type)
values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType},#{businessType})
</insert>
<!-- 修改 -->

View File

@@ -226,11 +226,11 @@
<div class="col-md-4">
<c:if test="${empty specificServiceCfg.specServiceId}">
<sys:treeselect id="${'specificServiceCfg'.concat(dict.itemCode)}" name="parent.specServiceId" value="${specificServiceCfg.parent.specServiceId}" labelName="parent.specServiceName" labelValue="${fatherName}" title="${dict.itemValue}"
url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}&specific=true" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
</c:if>
<c:if test="${not empty specificServiceCfg.specServiceId}">
<sys:treeselect id="${'specificServiceCfg'.concat(dict.itemCode)}" name="parent.specServiceId" value="${specificServiceCfg.cfgType eq dict.itemCode?specificServiceCfg.parent.specServiceId:0}" labelName="parent.specServiceName" labelValue="${(specificServiceCfg.cfgType eq dict.itemCode and specificServiceCfg.parent.specServiceId ne '0')?fns:getBySpecServiceId(specificServiceCfg.parent.specServiceId).specServiceName:fatherName}"
title="${dict.itemValue}" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
title="${dict.itemValue}" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=${dict.itemCode}&specific=true" extId="${specificServiceCfg.specServiceId}" cssClass="required form-control"/>
</c:if>
</div>
<div for="parent.specServiceName"></div>
@@ -301,7 +301,7 @@
<div for="groupId"></div>
</div>
<div class="form-group">
<div class="form-group hidden">
<label class="col-md-3 control-label"><font color="red">*</font><spring:message code="is_leaf"/>:</label>
<div class="col-md-4">
<form:select path="isLeaf" class="form-control leafChange">