package com.ld.igds.gis.controller;
|
|
import com.bstek.bdf2.core.business.IUser;
|
import com.bstek.bdf2.core.model.DefaultCompany;
|
import com.bstek.bdf2.core.model.DefaultDept;
|
import com.ld.igds.common.CoreCommonService;
|
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.gis.manager.GisManager;
|
import com.ld.igds.sys.service.SysCompanyService;
|
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.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
/**
|
* OA模块的控制层
|
*/
|
@RestController
|
@RequestMapping("basic/gis")
|
public class GisController {
|
|
@Autowired
|
private SysCompanyService companyService;
|
@Autowired
|
private GisManager gisManager;
|
@Autowired
|
private SysDeptService sysDeptService;
|
|
|
/**
|
* 集团/公司 调用 地图导航
|
*
|
* @param companyId
|
* @return
|
*/
|
@RequestMapping("/gis-group")
|
public ModelAndView gisMap(@RequestParam(value = "companyId", required = false) String companyId) {
|
ModelAndView view = new ModelAndView();
|
|
IUser user = ContextUtil.getLoginUser();
|
view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
|
|
//获取当前用户的部门
|
DefaultDept defaultDept = sysDeptService.loadUserDept(user.getUsername());
|
view.addObject("dept", defaultDept);
|
//功能模块
|
DefaultCompany company = companyService.getCompany(user.getCompanyId());
|
view.addObject("model", company.getModel());
|
view.setViewName("admin/gis/gis-group");
|
return view;
|
}
|
|
/**
|
* 获取子节点
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/dept-child")
|
public PageResponse<DefaultDept> deptChild(@RequestBody BaseParam param) {
|
return gisManager.deptChild(param);
|
}
|
|
|
/**
|
* 返回上一层
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/back-parent")
|
public PageResponse<DefaultDept> backParent(@RequestBody BaseParam param) {
|
if (param == null) {
|
return new PageResponse<DefaultDept>(RespCodeEnum.CODE_1007.getCode(), "参数异常", null);
|
}
|
if (StringUtils.isEmpty(param.getDeptId())){
|
return new PageResponse<DefaultDept>(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<DefaultDept>(RespCodeEnum.CODE_2000.getCode(), "没获取到数据", null);
|
}
|
param.setDeptId(dept.getParentId());
|
return gisManager.deptChild(param);
|
}
|
|
}
|