Merge branch 'develop' of http://192.168.10.125/k18_web/NFS.git into develop

This commit is contained in:
leijun
2018-10-09 15:00:02 +08:00
5 changed files with 97 additions and 98 deletions

View File

@@ -2,7 +2,9 @@ package com.nis.web.service.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -222,104 +224,80 @@ public class SysDictInfoService extends BaseService{
return sysDictInfoDao.getDistrictDict(tableName);
}
// 组织区域、运营商配置下发格式
/**
* 组织区域、运营商配置下发格式
* @param areaEffectiveIds
* @return
*/
public String setEffectiveRange(String areaEffectiveIds){
EffectiveRangeCfg rangeCfg = new EffectiveRangeCfg();
List<List<AreaIsp>> effectiveRangeList = new ArrayList();
List<String> locaValueList = new ArrayList();
List<String> ispValueList = new ArrayList();
HashMap<String, List<String>> map = new HashMap<String,List<String>>();
List<String> ispList = new ArrayList();
for (String areaEffectiveId : StringUtils.split(areaEffectiveIds, ",")) {
List<AreaIsp> areaIspList = new ArrayList();
AreaIsp area = new AreaIsp();
area.setTag(Constants.AREA_TAG);
AreaIsp isp = new AreaIsp();
isp.setTag(Constants.ISP_TAG);
String areaStr = "";
// 区域和运营商
if(areaEffectiveId.contains(":")) {
// 区域和运营商
int index = areaEffectiveId.indexOf(":");
String areaCode = areaEffectiveId.substring(0, index);
String ispCode = areaEffectiveId.substring(index+1);
// 查询该区域信息及其所有父节点信息
List<SysDictInfo> list = sysDictInfoDao.getEffectiveArea(areaCode);
for (SysDictInfo sysDictInfo : list) {
areaStr += sysDictInfo.getItemValue();
while(sysDictInfo.getParent().getSysDictId() != 0) {
sysDictInfo = sysDictInfoDao.getDictById(sysDictInfo.getParent().getSysDictId());
areaStr += "/"+sysDictInfo.getItemValue();
if(!map.containsKey(areaCode)){
ispList = new ArrayList();
ispList.add(ispCode);
map.put(areaCode, ispList);
}else{
if(!ispList.contains(ispCode)){
ispList.add(ispCode);
}
map.replace(areaCode, ispList);
}
String areaItemValue = StringUtils.revertStr(areaStr, "/");
if(!locaValueList.contains(areaItemValue)) {
locaValueList = new ArrayList();
ispValueList = new ArrayList();
locaValueList.add(areaItemValue);
}else {
// 区域相同就只加运营商信息
SysDictInfo ispStr = sysDictInfoDao.getDictByItemCode(ispCode);
if(!ispValueList.contains(ispStr.getItemValue())) {
ispValueList.add(ispStr.getItemValue());
if(ispValueList.size() < 2) {
isp.setValue(ispValueList);
areaIspList.add(isp);
effectiveRangeList.add(areaIspList);
}
}
continue;
}
// 查询运营商信息
SysDictInfo ispStr = sysDictInfoDao.getDictByItemCode(ispCode);
if(!ispValueList.contains(ispStr.getItemValue())) {
ispValueList.add(ispStr.getItemValue());
}
area.setValue(locaValueList);
isp.setValue(ispValueList);
areaIspList.add(area);
areaIspList.add(isp);
effectiveRangeList.add(areaIspList);
}else {
// 区域
SysDictInfo dict = sysDictInfoDao.getDictByItemCode(areaEffectiveId);
// 查询所有父节点区域信息
areaStr += dict.getItemValue();
while(dict.getParent().getSysDictId() != 0) {
dict = sysDictInfoDao.getDictById(dict.getParent().getSysDictId());
areaStr += "/"+dict.getItemValue();
}
String areaItemValue = StringUtils.revertStr(areaStr, "/");
if(!locaValueList.contains(areaItemValue)) {
locaValueList = new ArrayList();
locaValueList.add(areaItemValue);
area.setValue(locaValueList);
areaIspList.add(area);
effectiveRangeList.add(areaIspList);
if(!map.containsKey(areaEffectiveId)){
map.put(areaEffectiveId, null);
}
}
}
EffectiveRangeCfg rangeCfg = new EffectiveRangeCfg();
List<List<AreaIsp>> effectiveRangeList = new ArrayList();
Set<String> keySet = map.keySet();
for (String key : keySet) {
AreaIsp area = new AreaIsp();
area.setTag(Constants.AREA_TAG);
AreaIsp isp = new AreaIsp();
isp.setTag(Constants.ISP_TAG);
List<String> locaValueList = new ArrayList();
List<String> ispValueList = new ArrayList();
List<AreaIsp> areaIspList = new ArrayList();
// 获取区域信息
String areaStr = "";
SysDictInfo areaDict = sysDictInfoDao.getDictByItemCode(key);
areaStr += areaDict.getItemValue();
while(areaDict.getParent().getSysDictId() != 0) {
areaDict = sysDictInfoDao.getDictById(areaDict.getParent().getSysDictId());
areaStr += "/"+areaDict.getItemValue();
}
locaValueList.add(StringUtils.revertStr(areaStr, "/"));
area.setValue(locaValueList);
areaIspList.add(area);
// 获取运营商信息
if(map.get(key) != null){
for (String ispCode : map.get(key)) {
SysDictInfo ispDict = sysDictInfoDao.getDictByItemCode(ispCode);
ispValueList.add(ispDict.getItemValue());
}
isp.setValue(ispValueList);
areaIspList.add(isp);
}
effectiveRangeList.add(areaIspList);
}
rangeCfg.setEffectiveRangeList(effectiveRangeList);
return gsonToJson(rangeCfg);
}
public static void main(String[] args) {
SysDictInfoService service = new SysDictInfoService();
String json = service.setEffectiveRange("7182:4,7182:5");
System.err.println(json);
}
}

View File

@@ -39,9 +39,9 @@
</c:if>
</c:forEach>
<sys:treeselect id="classify" name="classify" value="${empty _cfg.classify?0:_cfg.classify}" labelName="classifyName" extId="0"
labelValue="${classifyValue}"
title="classification" url="/basics/serviceDictInfo/treeData?itType=1&isShowLeaf=true" notAllowSelectRoot="true" allowClear="true" notAllowSelectParent="false"
checked="true" cssClass="form-control" checkedPS="" unCheckedPS=""/>
labelValue="${classifyValue}" labelEmptyValue="0"
title="classification" url="/basics/serviceDictInfo/treeData?itType=1&isShowLeaf=true" notAllowSelectRoot="false" allowClear="true" notAllowSelectParent="false"
checked="true" cssClass="form-control" checkedPS="ps" unCheckedPS="s"/>
<%-- <select name="classify" multiple class="selectpicker form-control" title=<spring:message code="select"/>>
<c:forEach items="${fls}" var="fl">
@@ -89,9 +89,9 @@
</c:if>
</c:forEach>
<sys:treeselect id="attribute" name="attribute" value="${empty _cfg.attribute?0:_cfg.attribute}" labelName="attributeName" extId="0"
labelValue="${attributeValue}"
title="attribute" url="/basics/serviceDictInfo/treeData?itType=2&isShowLeaf=true" notAllowSelectRoot="true" allowClear="true" notAllowSelectParent="false"
checked="true" cssClass="form-control" checkedPS="" unCheckedPS=""/>
labelValue="${attributeValue}" labelEmptyValue="0"
title="attribute" url="/basics/serviceDictInfo/treeData?itType=2&isShowLeaf=true" notAllowSelectRoot="false" allowClear="true" notAllowSelectParent="false"
checked="true" cssClass="form-control" checkedPS="ps" unCheckedPS="s"/>
<%-- <select name="attribute" multiple class="selectpicker form-control" title=<spring:message code="select"/>>
<c:forEach items="${xzs}" var="xz">
<c:choose>
@@ -134,9 +134,9 @@
</c:if>
</c:forEach>
<sys:treeselect id="lable" name="lable" value="${empty _cfg.lable?0:_cfg.lable}" labelName="lableName" extId="0"
labelValue="${lableValue}"
title="label" url="/basics/serviceDictInfo/treeData?itType=3&isShowLeaf=true" notAllowSelectRoot="true" allowClear="true" notAllowSelectParent="false"
checked="true" cssClass="form-control" checkedPS="" unCheckedPS=""/>
labelValue="${lableValue}" labelEmptyValue="0"
title="label" url="/basics/serviceDictInfo/treeData?itType=3&isShowLeaf=true" notAllowSelectRoot="false" allowClear="true" notAllowSelectParent="false"
checked="true" cssClass="form-control" checkedPS="ps" unCheckedPS="s"/>
<%-- <select name="lable" multiple class="selectpicker form-control" title=<spring:message code="select"/>>
<c:forEach items="${lables}" var="lable">
<c:choose>

View File

@@ -28,6 +28,7 @@
<%@ attribute name="unCheckedPS" type="java.lang.String" required="false" description="复选框取消选中时是否关联父子节点ps关联父子p关联父s关联子,都不关联为空"%>
<%@ attribute name="enableAddBtn" type="java.lang.Boolean" required="false" description="节点是否可编辑"%>
<%@ attribute name="enableSearch" type="java.lang.Boolean" required="false" description="是否开启节点搜索功能"%>
<%@ attribute name="labelEmptyValue" type="java.lang.String" required="false" description="标签不能为空的时候当清空选择时补填的值"%>
<div class="input-group">
<input id="${id}Id" name="${name}" class="${cssClass} singleClass" type="hidden" value="${value}" />
<input id="${id}Name" name="${labelName}" ${allowInput?'':'readonly="readonly"'} type="text" value="<spring:message code='${empty value?"":labelValue}'/>" data-msg-required="${dataMsgRequired}" placeholder="${(empty value or value eq extId)?labelValue:value}"
@@ -45,7 +46,7 @@
return true;
}
// 正常打开
top.$.jBox.open("iframe:${ctx}/tag/treeselect?url="+encodeURIComponent("${url}")+"&selectIds="+$("#${id}Id").val()+"&module=${module}&checked=${checked}&extId=${extId}&isAll=${isAll}&title=${title}&enableAddBtn=${enableAddBtn}&enableSearch=${enableSearch}", "<spring:message code='choose'/> <spring:message code='${title}'/>", 320, 420, {
top.$.jBox.open("iframe:${ctx}/tag/treeselect?url="+encodeURIComponent("${url}")+"&selectIds="+$("#${id}Id").val()+"&module=${module}&checked=${checked}&checkedPS=${checkedPS}&unCheckedPS=${unCheckedPS}&extId=${extId}&isAll=${isAll}&title=${title}&enableAddBtn=${enableAddBtn}&enableSearch=${enableSearch}", "<spring:message code='choose'/> <spring:message code='${title}'/>", 320, 420, {
ajaxData:{selectIds: $("#${id}Id").val()},buttons:{"<spring:message code='ok'/>":"ok", "<spring:message code='clear'/>":"clear","<spring:message code='close'/>":true}, submit:function(v, h, f){
if (v == "ok"){
var tree = h.find("iframe")[0].contentWindow.tree;//h.find("iframe").contents();
@@ -90,6 +91,11 @@
top.$.jBox.tip("<spring:message code='no_node'/>"+nodes[i].name+"<spring:message code='reselect'/>");
return false;
}//</c:if>
if("${labelEmptyValue}"&&""!="${labelEmptyValue}"){
if("${extId}"==nodes[i].id){
continue;
}
}
ids.push(nodes[i].id);
//<c:if test="${showParentName}">
if (nodes[i].id != null ){
@@ -109,7 +115,7 @@
names.push(nodes[i].name);
}
});
});
}//</c:if>
//<c:if test="${!showParentName}">
@@ -119,7 +125,9 @@
break; // 如果为非复选框选择,则返回第一个选择
//</c:if>
}
if(ids.length==0&&"${labelEmptyValue}"&&""!="${labelEmptyValue}"){
ids.push("${labelEmptyValue}");
}
$("#${id}Id").val(ids.join(",").replace(/u_/ig,""));
$("#${id}Id").change();//手动触发change事件使Id的值得变化可以被监听到
$("#${id}Name").val(names.join(","));
@@ -127,7 +135,11 @@
$("#${id}Name").attr("placeholder","");
}
}else if (v == "clear"){
$("#${id}Id").val("");
if("${labelEmptyValue}"&&""!="${labelEmptyValue}"){
$("#${id}Id").val("${labelEmptyValue}");
}else{
$("#${id}Id").val("");
}
$("#${id}Id").change();//手动触发change事件使Id的值得变化可以被监听到
$("#${id}Name").val("");
$("#${id}Name").attr("placeholder","");

View File

@@ -194,9 +194,18 @@ label.errorShow {
<div class="form-group">
<label class="col-md-3 control-label"><spring:message code="superior_config"/>:</label>
<div class="col-md-4">
<c:set var="fatherName"><spring:message code="root_node"/></c:set>
<sys:treeselect id="serviceDictInfo" name="parent.serviceDictId" value="${serviceDictInfo.parent.serviceDictId}" labelName="parent.itemValue" labelValue="${serviceDictInfo.parent.serviceDictId eq '0'?fatherName:fns:getServiceDictInfoById(serviceDictInfo.parent.serviceDictId).itemValue}"
title="${title }" url="/basics/serviceDictInfo/treeData?itType=${itType}" cssClass="required form-control"/>
<c:if test="${itType==1 }">
<c:set var="fatherName"><spring:message code="classification"/></c:set>
</c:if>
<c:if test="${itType==2 }">
<c:set var="fatherName"><spring:message code="attribute"/></c:set>
</c:if>
<c:if test="${itType==3 }">
<c:set var="fatherName"><spring:message code="label"/></c:set>
</c:if>
<sys:treeselect id="serviceDictInfo" name="parent.serviceDictId" value="${serviceDictInfo.parent.serviceDictId}" labelName="parent.itemValue"
labelValue="${serviceDictInfo.parent.serviceDictId eq '0'?fatherName:fns:getServiceDictInfoById(serviceDictInfo.parent.serviceDictId).itemValue}"
title="${title }" url="/basics/serviceDictInfo/treeData?itType=${itType}" cssClass="required form-control"/>
<label class="errorShow" style="display: none;"><spring:message code="isLevelNoSure"/></label>
</div>
</div>

View File

@@ -539,11 +539,11 @@ $(function(){
}
});
$("#classifyId,#attributeId,#lableId").on("change",function(){
/*$("#classifyId,#attributeId,#lableId").on("change",function(){
if($(this).val()==0 || $(this).val()==''){
$(this).val(0);
}
});
});*/
//配置修改时已经展开的域上的加号隐藏
$(".boxSolid:visible").each(function(){
$(this).prev("h4").find(".glyphicon-plus").addClass("hidden");