Commit bacc03ac authored by 廖旭伟's avatar 廖旭伟

修改站点树接口返回值结构

parent a11f641e
package com.mortals.xhx.common.pdu.site;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class SiteTreeSelectVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private String id;
/**
* 站点编码
*/
private String siteCode;
/**
* 节点名称
*/
private String label;
/**
* 区域编码
*/
private String areaCode;
/**
* 是否叶子节点
*/
private Boolean isLeaf;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
/**
* 节点类型
*/
private String type;
/**
* 图标
*/
private String icon;
/**
* 子节点
*/
private List<SiteTreeSelectVO> children;
private Integer siteCount;
}
......@@ -65,7 +65,8 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
}
branchVO.setEquipments(equipments);
}else {
branchVO.setEquipments(Collections.emptyList());
//branchVO.setEquipments(Collections.emptyList());
continue;
}
result.add(branchVO);
......@@ -109,11 +110,7 @@ public class ConvergeSiteServiceImpl extends AbstractCRUDServiceImpl<ConvergeSit
entity.setSiteId(sitePdu.getId());
entity.setBranchName(sitePdu.getSiteName());
entity.setBranchLogo(sitePdu.getSiteCode());
if(sitePdu.getStatus()!=null && sitePdu.getStatus()==1) {
entity.setStatus("Y");
}else {
entity.setStatus("N");
}
entity.setServerTime("星期一至星期五 上午:09:00-12:00 下午:14:00-17:00 备注:法定节假日除外;");
entity.setConsultPhone(sitePdu.getSiteTel());
entity.setBranchStyle("1");
......
package com.mortals.xhx.module.site.web.vo;
public class SiteTreeVO {
}
......@@ -14,6 +14,7 @@ import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.app.AppPdu;
import com.mortals.xhx.common.pdu.site.SiteTreeSelectVO;
import com.mortals.xhx.feign.app.IAppFeign;
import com.mortals.xhx.feign.base.IApiBaseManagerFeign;
import com.mortals.xhx.feign.base.pdu.SitePdu;
......@@ -24,6 +25,7 @@ import com.mortals.xhx.module.sst.model.SstAppsEntity;
import com.mortals.xhx.module.sst.service.SstAppsDeskService;
import com.mortals.xhx.module.sst.service.SstAppsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -159,7 +161,21 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
throw new AppException("获取用户站点列表树数据失败:" + apiResp.getMsg());
}
if (apiResp.getData().get("siteTree") != null) {
model.put("data", apiResp.getData().get("siteTree"));
List<SiteTreeSelectVO> resultList = JSONObject.parseArray(apiResp.getData().get("siteTree").toString(),SiteTreeSelectVO.class);
SiteTreeSelectVO rootNode = new SiteTreeSelectVO();
rootNode.setId("6182157d00ce41559e001a89d87f4057");
rootNode.setAreaCode("510000000000");
rootNode.setLabel("四川省");
rootNode.setType("area");
rootNode.setIcon("el-icon-folder");
rootNode.setIsLeaf(false);
rootNode.setLatitude("30.595081");
rootNode.setLongitude("104.062983");
rootNode.setSiteCount(getChildrenCount(resultList)-1);
rootNode.setChildren(resultList);
List<SiteTreeSelectVO> dataList = new ArrayList<>();
dataList.add(rootNode);
model.put("data", dataList);
} else {
model.put("data", Collections.emptyList());
}
......@@ -177,6 +193,20 @@ public class SstBasicController extends BaseCRUDJsonBodyMappingController<SstBas
return ret;
}
private static Integer getChildrenCount(List<SiteTreeSelectVO> children){
if(CollectionUtils.isEmpty(children)) {
return 1;
}else {
int size = 1;
for (SiteTreeSelectVO vo:children){
int c = getChildrenCount(vo.getChildren());
vo.setSiteCount(c);
size += c;
}
return size;
}
}
@PostMapping({"site/list"})
public Rest<Object> list() {
IUser user = this.getCurUser();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment