Commit bd135c67 authored by tianyiming's avatar tianyiming

生成管辖分局树

parent 35ccf1eb
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -19,4 +20,6 @@ public interface IEquipmentCategoryService { ...@@ -19,4 +20,6 @@ public interface IEquipmentCategoryService {
Page equipClaimOverview(); Page equipClaimOverview();
int createSupervisorCode(Map<String,Object> map); int createSupervisorCode(Map<String,Object> map);
List<LinkedHashMap> creatTree();
} }
...@@ -13,7 +13,6 @@ import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService; ...@@ -13,7 +13,6 @@ import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import liquibase.pro.packaged.S;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -189,4 +188,17 @@ public class EquipmentCategoryController extends BaseController { ...@@ -189,4 +188,17 @@ public class EquipmentCategoryController extends BaseController {
public ResponseModel<Object> createSupervisorCode(@RequestBody Map<String,Object> map) { public ResponseModel<Object> createSupervisorCode(@RequestBody Map<String,Object> map) {
return ResponseHelper.buildResponse(equipmentCategoryService.createSupervisorCode(map)); return ResponseHelper.buildResponse(equipmentCategoryService.createSupervisorCode(map));
} }
/**
* 生成管辖分局树
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/creatTree")
@ApiOperation(httpMethod = "GET", value = "生成管辖分局树", notes = "生成管辖分局树")
public ResponseModel<Object> creatTree() {
return ResponseHelper.buildResponse(equipmentCategoryService.creatTree());
}
} }
package com.yeejoin.amos.boot.module.tzs.biz.fegin;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient(name = "${privilege.fegin.name}", configuration = {FeignConfiguration.class})
public interface PrivilegeFeign {
//获取单位树
@RequestMapping(value = "/privilege/v1/company/tree", method = RequestMethod.GET)
FeignClientResult tree();
}
...@@ -10,7 +10,9 @@ import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentClassifityEnum; ...@@ -10,7 +10,9 @@ import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.tzs.api.mapper.CategoryOtherInfoMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService; import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.tzs.biz.fegin.PrivilegeFeign;
import com.yeejoin.amos.boot.module.tzs.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.JsonUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -40,6 +42,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -40,6 +42,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
private Resource equipStatus; private Resource equipStatus;
@Autowired @Autowired
PrivilegeFeign privilegeFeign;
@Autowired
CategoryOtherInfoMapper categoryOtherInfoMapper; CategoryOtherInfoMapper categoryOtherInfoMapper;
/** /**
...@@ -144,6 +149,31 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -144,6 +149,31 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return categoryOtherInfoMapper.updateSupervisorCode(codeMap.get("supervisorCode"), codeMap.get("elevatorCode"), otherInfo.getSequenceNbr()); return categoryOtherInfoMapper.updateSupervisorCode(codeMap.get("supervisorCode"), codeMap.get("elevatorCode"), otherInfo.getSequenceNbr());
} }
@Override
public List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeign.tree();
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteTreeData(result);
List<LinkedHashMap> resultTree = new ArrayList<>();
resultTree.add(treeData.get(5));
return resultTree;
}
private List<LinkedHashMap> deleteTreeData(List<LinkedHashMap> result) {
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap)it.next();
//删除使用单位
if ("company".equals(e.get("level"))) {
it.remove();
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
deleteTreeData((List<LinkedHashMap>) e.get("children"));
}
}
return result;
}
/** /**
* 具体生成监管码和电梯96333识别码逻辑 * 具体生成监管码和电梯96333识别码逻辑
*/ */
......
...@@ -18,6 +18,6 @@ public class JsonUtils { ...@@ -18,6 +18,6 @@ public class JsonUtils {
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(resource + "json文件转化失败"); throw new RuntimeException(resource + "json文件转化失败");
} }
return (Map)JSONObject.parseObject(json, Map.class); return JSONObject.parseObject(json, Map.class);
} }
} }
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