package com.ld.igds.gis.manager; import com.bstek.bdf2.core.business.IDept; import com.bstek.bdf2.core.model.DefaultDept; import com.ld.igds.constant.Constant; import com.ld.igds.constant.RespCodeEnum; import com.ld.igds.data.BaseParam; import com.ld.igds.data.PageResponse; import com.ld.igds.sys.service.SysDeptService; import com.ld.igds.util.ContextUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.stream.Collectors; /** * gis 定位 */ @Component public class GisManager { @Autowired private SysDeptService sysDeptService; public PageResponse deptChild(@RequestBody BaseParam param) { //return oAManager.getGpsLocation(companyId); if (param == null) return new PageResponse(RespCodeEnum.CODE_1007.getCode(), "参数异常", null); if (StringUtils.isEmpty(param.getDeptId())) return new PageResponse(RespCodeEnum.CODE_1007.getCode(), "参数异常", null); if (StringUtils.isEmpty(param.getCompanyId())) { param.setCompanyId(ContextUtil.getCompanyId()); } DefaultDept dept = sysDeptService.getCacheDept(param.getCompanyId(), param.getDeptId()); if (dept == null) return new PageResponse(RespCodeEnum.CODE_2000.getCode(), "没获取到数据", null); List defaultDepts = sysDeptService.loadDeptByParentId(param.getCompanyId(), dept.getId()); //找到子节点 List childs = defaultDepts.stream().filter(item -> !Constant.YN_N.equals(item.getVal())) .collect(Collectors.toList()); dept.setChildren(childs); return new PageResponse(RespCodeEnum.CODE_0000, dept); } }