Commit d07d10ca authored by kongfm's avatar kongfm

优化项943 by kongfm

parent 5901d973
......@@ -84,8 +84,8 @@ public class KeySiteController extends BaseController {
return ResponseHelper.buildResponse(entity);
}
public JSONObject getBulid(Long buildingId) {
ResponseModel<Object> equipObj = equipFeignClient.getOne(buildingId);
public JSONObject getBulid(Long id) {
ResponseModel<Object> equipObj = equipFeignClient.getOne(id);
JSONObject equipjSONObject = JSONObject.parseObject(JSONObject.toJSONString(equipObj.getResult()));
if (!equipjSONObject.containsKey("parentId")) {
return null;
......@@ -93,12 +93,10 @@ public class KeySiteController extends BaseController {
if (!"0".equals(equipjSONObject.getString("parentId"))) {
String parentId = equipjSONObject.getString("parentId");
if (StringUtils.isNotBlank(parentId)) {
getBulid(Long.parseLong(parentId));
return getBulid(Long.parseLong(parentId));
}
} else {
return equipjSONObject;
}
return null;
return equipjSONObject;
}
/**
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.common.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -12,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.ESOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -54,6 +56,8 @@ public class OrgUsrController extends BaseController {
@Value("${jcs.company.topic.delete}")
private String airportDeleteTopic;
@Autowired
EquipFeignClient equipFeignClient;
/**
* 新增单位信息
......@@ -430,4 +434,26 @@ public class OrgUsrController extends BaseController {
return ResponseHelper.buildResponse(loginUserDetails);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getParentBuilding/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取最上级建筑信息", notes = "获取最上级建筑信息")
public ResponseModel<JSONObject> getBuliding(@PathVariable Long id) {
JSONObject equipjSONObject = this.getBulid(id);
return ResponseHelper.buildResponse(equipjSONObject);
}
public JSONObject getBulid(Long id) {
ResponseModel<Object> equipObj = equipFeignClient.getOne(id);
JSONObject equipjSONObject = JSONObject.parseObject(JSONObject.toJSONString(equipObj.getResult()));
if (!equipjSONObject.containsKey("parentId")) {
return null;
}
if (!"0".equals(equipjSONObject.getString("parentId"))) {
String parentId = equipjSONObject.getString("parentId");
if (StringUtils.isNotBlank(parentId)) {
return getBulid(Long.parseLong(parentId));
}
}
return equipjSONObject;
}
}
\ No newline at end of file
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