Commit 49a7af83 authored by taabe's avatar taabe

机场单位-消防队伍树接口添加

parent ded7f8a2
......@@ -6,30 +6,32 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FireTeamServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 消防队伍
......@@ -142,7 +144,7 @@ public class FireTeamController extends BaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{companyId}/listTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "队伍树", notes = "队伍树")
@ApiOperation(httpMethod = "GET", value = "查询所属单位下消防队伍树", notes = "查询所属单位下消防队伍树")
public ResponseModel<List<Menu>> listTreeByCompanyId(@PathVariable(value = "companyId") String companyId) throws Exception {
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("is_delete", 0);
......@@ -198,4 +200,18 @@ public class FireTeamController extends BaseController {
page = iFireTeamService.page(pageBean, fireTeamQueryWrapper);
return page;
}
/**
* 查询机场单位-消防队伍树
*
* @return
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/company/listTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "查询机场单位-消防队伍树", notes = "查询机场单位-消防队伍树")
public ResponseModel<List<MenuFrom>> listCompanyTree() throws Exception {
List<MenuFrom> menus = iFireTeamService.getCompanyTeamTree();
return ResponseHelper.buildResponse(menus);
}
}
\ No newline at end of file
......@@ -2,16 +2,21 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.FireBrigadeResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -24,6 +29,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 消防队伍 服务实现类
......@@ -40,6 +46,9 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
OrgUsrServiceImpl orgUsrService;
/**
* 获取监控大队列表
*
......@@ -96,4 +105,38 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName",
"getParent");
}
/**
* 获取机场单位-队伍树
*
* @return
*/
public List<MenuFrom> getCompanyTeamTree() throws Exception {
MenuFrom root = new MenuFrom("-1", "消防队伍", null);
// 机场单位
List<OrgUsr> companyDeptList = orgUsrService.selectCompanyDepartmentMsg();
List<MenuFrom> companyDeptMenuList = Lists.newArrayList();
companyDeptList.forEach(o -> {
if (ValidationUtil.isEmpty(o.getParentId())) {
o.setParentId("-1");
}
companyDeptMenuList.add(new MenuFrom(o.getSequenceNbr().toString(), o.getBizOrgName(), o.getParentId()));
});
// 消防队伍
List<MenuFrom> teamMenuList = Lists.newArrayList();
List<FireTeamDto> teamList = this.queryFireTeamForList(false);
teamList.forEach(team -> {
if (ValidationUtil.isEmpty(team.getParent())) {
// 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构)
team.setParent(team.getCompany());
}
teamMenuList.add(new MenuFrom(team.getSequenceNbr().toString(), team.getName(), team.getParent().toString()));
});
companyDeptMenuList.addAll(teamMenuList);
List<MenuFrom> menuList = TreeParser.getTreexin("-1", companyDeptMenuList, MenuFrom.class.getName(), "getKey",
1, "getName",
"getParentId");
root.setChildren(menuList);
return Lists.newArrayList(root);
}
}
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