Commit 22759691 authored by 李腾威's avatar 李腾威

消防水源及队伍改造

parent 62fee8e2
......@@ -116,12 +116,12 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
}
public List<Menu> getFireTeamTypeTree(String bizOrgCode) throws Exception {
Menu root = new Menu(null, "消防队伍类型", null, null,0);
// Menu root = new Menu(null, "消防队伍类型", null, null,0);
List<DataDictionary> list= dataDictionaryMapper.getFireTeamTypeTree(bizOrgCode);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null);
root.setChildren(menus);
return Lists.newArrayList(root);
// root.setChildren(menus);
return Lists.newArrayList(menus);
}
public List<DataDictionary> getwaterResourceTypeTree(String bizOrgCode) throws Exception {
List<DataDictionary> list= dataDictionaryMapper.getwaterResourceTypeTree(bizOrgCode);
......
......@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -554,8 +555,8 @@ public class WaterResourceController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/typeTree/XFSYLX", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据bizOrgCode的值获取对应的消防水源树信息,含有队伍下统计数据", notes = "根据bizOrgCode的值获取对应的消防水源树信息,含有队伍下统计数据")
public ResponseModel<JSONObject> getwaterResourceTypeTree(@RequestParam(required = false) String bizOrgCode) throws Exception {
JSONObject list = waterResourceServiceImpl.getwaterResourceTypeTree(bizOrgCode);
public ResponseModel<List<Menu>> getwaterResourceTypeTree(@RequestParam(required = false) String bizOrgCode) throws Exception {
List<Menu> list = waterResourceServiceImpl.getwaterResourceTypeTree(bizOrgCode);
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -11,6 +11,7 @@ import java.util.Optional;
import javax.annotation.Resource;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -327,7 +328,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
return result;
}
public JSONObject getwaterResourceTypeTree(String bizOrgCode) throws Exception {
public List<Menu> getwaterResourceTypeTree(String bizOrgCode) throws Exception {
List<Menu> list = new ArrayList<>();
ResponseModel <Object> response= equipFeignClient.list();
if(response.getStatus() != 200) {
return null;
......@@ -372,6 +374,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray("children");
JSONArray array = new JSONArray();
for (Object childObject : waterTypeDetailChildrenArray) {
JSONObject detail= JSONObject.parseObject(JSONObject.toJSONString(childObject));
String codeStr = detail.getString("code");
if(map!=null && map.containsKey(codeStr)) {
......@@ -380,13 +383,23 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
}else {
detail.put("num", 0);
}
array.add(detail);
Menu menu = new Menu(Long.valueOf(detail.get("id").toString()) ,detail.get("name").toString(),null,Integer.parseInt(detail.get("num").toString()));
list.add(menu);
// if (detail.get("children").toString().length() == 2) {
// detail.put("children",null);
// }
// array.add(detail);
}
waterTypeDetailJson.remove("children");
waterTypeDetailJson.put("children", array);
waterTypeDetailJson.put("num", num);
// waterTypeDetailJson.remove("children");
// if(array.size() == 0) {
// waterTypeDetailJson.put("children", null);
// } else {
// waterTypeDetailJson.put("children", array);
// }
// waterTypeDetailJson.put("num", num);
}
return waterTypeDetailJson;
return list;
}
public Object getwaterResourceType() throws Exception {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
......
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