Commit cd1bf286 authored by changxiangyu's avatar changxiangyu

删除废弃代码

parent 17c9030e
......@@ -23,236 +23,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.stream.Collectors;
///**
// * @author system_generator
// * @date 2024-09-24
// */
//@RestController
//@Api(tags = "TreeToList")
//@RequestMapping(value = "/tree-to-list")
//public class TreeToListController extends BaseController {
// private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
// @Autowired
// RedisUtils redisUtils;
// @Autowired
// private PrivilegeFeginService privilegeFeginService;
//
//
// /**
// * 过滤数据
// *
// * @param resultList
// * @param linkedHashMap
// */
// private static void clearSafeMap(ArrayList<LinkedHashMap> resultList, LinkedHashMap linkedHashMap) {
// LinkedHashMap<String, String> safeLinkedHashMap = new LinkedHashMap<>();
// safeLinkedHashMap.put("companyName", (String) linkedHashMap.get("companyName"));
// safeLinkedHashMap.put("agencyCode", (String) linkedHashMap.get("agencyCode"));
// safeLinkedHashMap.put("companyCode", (String) linkedHashMap.get("companyCode"));
// safeLinkedHashMap.put("sequenceNbr", (String) linkedHashMap.get("sequenceNbr"));
// safeLinkedHashMap.put("parentId", (String) linkedHashMap.get("parentId"));
//
// resultList.add(safeLinkedHashMap);
// }
//
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @GetMapping(value = "/getTreeToList")
// @ApiOperation(httpMethod = "GET", value = "根据当前登录人获取监管机构平铺列表数据", notes = "根据当前登录人获取监管机构平铺列表数据")
// public ResponseModel<Object> getTreeChildList(@RequestParam(value = "current") int current, @RequestParam
// (value = "size") int size) {
// // 获取结果数据
// ArrayList<LinkedHashMap> resultLinkedHashMapList = getResultList();
// // 分页
// int start = (current - 1) * size;
// int end = Math.min(start + size, resultLinkedHashMapList.size());
// List<LinkedHashMap> pageData = resultLinkedHashMapList.subList(start, end);
// Page page = new Page(resultLinkedHashMapList.size(), current, (int) Math.ceil((double) resultLinkedHashMapList.size() / size), size, pageData, true);
// return ResponseHelper.buildResponse(page);
// }
//
// /**
// * @return 返回最终数据对象
// */
// private ArrayList<LinkedHashMap> getResultList() {
// ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
// if (ObjectUtils.isEmpty(reginParams)) {
// return null;
// }
// Long id = reginParams.getCompany().getSequenceNbr();
// List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
// ArrayList<LinkedHashMap> result = new ArrayList<>();
// List<LinkedHashMap> linkedHashMaps = screenData(result, data, id.toString());
// //getFinallyResult
// ArrayList<LinkedHashMap> resultLinkedHashMapList = mapToDeepList(linkedHashMaps);
// return resultLinkedHashMapList;
// }
//
// public List<LinkedHashMap> screenData(List<LinkedHashMap> result, List<LinkedHashMap> data, String id) {
// if (!ObjectUtils.isEmpty(result)) {
// return result;
// }
// List<LinkedHashMap> list = data.stream().filter(item -> item.get("sequenceNbr").toString().equals(id)).collect(Collectors.toList());
// if (!ObjectUtils.isEmpty(list)) {
// return list;
// }
// for (LinkedHashMap item : data) {
// if (!ObjectUtils.isEmpty(item.get("children"))) {
// List<LinkedHashMap> children = screenData(result, (List<LinkedHashMap>) item.get("children"), id);
// if (!ObjectUtils.isEmpty(children)) {
// result = children;
// break;
// }
// }
// }
// return result;
// }
//
// /**
// * 将树平铺为列表并返回
// *
// * @return
// */
// public ArrayList<LinkedHashMap> mapToDeepList(List<LinkedHashMap> linkedHashMapList) {
// ArrayList<LinkedHashMap> resultList = new ArrayList<>();
// //获取平铺后的机构列表
// ArrayList<LinkedHashMap> linkedHashMaps = insertToResultList(linkedHashMapList, resultList);
// FeignClientResult tree = privilegeFeginService.getTree();
// //获取机构数据Map(region,regionObjectMap)对象
// HashMap<String, HashMap> regionTreeToHashMapByRegionCode = regionTreeToHashMapByRegionCode((ArrayList<LinkedHashMap>) tree.getResult());
// HashMap<String, HashMap> regionTreeToHashMapById = regionTreeToHashMapById((ArrayList<LinkedHashMap>) tree.getResult());
// //构建平铺后的hashMapBySeq
// HashMap<String, HashMap> listById = getListById(linkedHashMaps);
//
// //匹配regionName
// for (LinkedHashMap linkedHashMap : linkedHashMaps) {
// String companyCode = (String) linkedHashMap.get("companyCode");
// if(regionTreeToHashMapByRegionCode.get(companyCode)==null){
// continue;
// }
// //拼接regionName
// StringBuilder regionName = new StringBuilder((String) regionTreeToHashMapByRegionCode.get(companyCode).get("regionName"));
// String parentId = (String) regionTreeToHashMapByRegionCode.get(companyCode).get("parentId");
//
// while (!"0".equals(parentId)) {
// regionName.insert(0, regionTreeToHashMapById.get(parentId).get("regionName"));
// parentId = (String) regionTreeToHashMapById.get(parentId).get("parentId");
//
// }
// linkedHashMap.put("regionName", regionName.toString());
// }
// return linkedHashMaps;
// }
//
// /*
// 返回机构列表的hashMap(SequenceNbr,机构树对象的Map)
// */
// public HashMap<String, HashMap> getListById(ArrayList<LinkedHashMap> linkedHashMaps) {
// HashMap<String, HashMap> resultHashMap = new HashMap<>();
// for (LinkedHashMap linkedHashMap : linkedHashMaps) {
// resultHashMap.put((String) linkedHashMap.get("sequenceNbr"), linkedHashMap);
// }
// return resultHashMap;
// }
//
// /**
// * doDepth 深度优先搜索平铺linkedHashMapList并塞入,resultList
// *
// * @param linkedHashMapList
// * @param resultList
// * @return
// */
// public ArrayList<LinkedHashMap> insertToResultList
// (List<LinkedHashMap> linkedHashMapList, ArrayList<LinkedHashMap> resultList) {
// for (LinkedHashMap linkedHashMap : linkedHashMapList) {
// if (linkedHashMap.get("children") != null) {
// clearSafeMap(resultList, linkedHashMap);
// insertToResultList((ArrayList<LinkedHashMap>) linkedHashMap.get("children"), resultList);
// } else {
// clearSafeMap(resultList, linkedHashMap);
// }
// }
// return resultList;
// }
//
// /**
// * 广度优先遍历将区划树平铺并加入HashMap<regionCode,regionName>
// *
// * @param list
// * @return 返回区划数据HashMap<regionCode, 区划数据map>
// */
// public HashMap<String, HashMap> regionTreeToHashMapByRegionCode(ArrayList<LinkedHashMap> list) {
// Queue tempQueue = new LinkedList();
// HashMap<String, HashMap> hashMap = new HashMap();
// for (LinkedHashMap linkedHashMap : list) {
// tempQueue.offer(linkedHashMap);
// }
// while (tempQueue.size() != 0) {
// LinkedHashMap poll = (LinkedHashMap) tempQueue.poll();
// //过滤数据,只加入所需数据
// HashMap<String, String> objectHashMap = new HashMap<>();
// objectHashMap.put("sequenceNbr", (String) poll.get("sequenceNbr"));
// objectHashMap.put("regionCode", String.valueOf(poll.get("regionCode")));
// objectHashMap.put("regionName", (String) poll.get("regionName"));
//
// objectHashMap.put("parentId", (String) poll.get("parentId"));
// hashMap.put(String.valueOf(poll.get("regionCode")), objectHashMap);
// if (poll.get("children") != null) {
// ArrayList<LinkedHashMap> children = (ArrayList<LinkedHashMap>) poll.get("children");
// for (LinkedHashMap child : children) {
// tempQueue.offer(child);
// }
// }
// }
// return hashMap;
// }
//
// public HashMap<String, HashMap> regionTreeToHashMapById(ArrayList<LinkedHashMap> list) {
// Queue tempQueue = new LinkedList();
// HashMap<String, HashMap> hashMap = new HashMap();
// for (LinkedHashMap linkedHashMap : list) {
// tempQueue.offer(linkedHashMap);
// }
// while (tempQueue.size() != 0) {
// LinkedHashMap poll = (LinkedHashMap) tempQueue.poll();
// //过滤数据,只加入所需数据
// HashMap<String, String> objectHashMap = new HashMap<>();
// objectHashMap.put("sequenceNbr", (String) poll.get("sequenceNbr"));
// objectHashMap.put("regionCode", String.valueOf(poll.get("regionCode")));
// objectHashMap.put("regionName", (String) poll.get("regionName"));
//
// objectHashMap.put("parentId", (String) poll.get("parentId"));
// hashMap.put(String.valueOf(poll.get("sequenceNbr")), objectHashMap);
// if (poll.get("children") != null) {
// ArrayList<LinkedHashMap> children = (ArrayList<LinkedHashMap>) poll.get("children");
// for (LinkedHashMap child : children) {
// tempQueue.offer(child);
// }
// }
// }
// return hashMap;
// }
//
// @Data
// @AllArgsConstructor
// @NoArgsConstructor
// class Page {
// //总条数
// private Integer total;
// //当前页码
// private Integer current;
// //总页数
// private Integer pages;
// //显示条数
// private Integer size;
// //用来存放查询出来的数据
// private Object records;
// private boolean searchCount;
//
// }
//}
/**
* @author chang xiangyu
* @date 2024-09-24
......@@ -351,7 +121,6 @@ public class TreeToListController extends BaseController {
FeignClientResult tree = privilegeFeginService.getTree();
//获取机构数据Map(region,regionObjectMap)对象
HashMap<String, HashMap> regionTreeToHashMapByRegionCode = regionTreeToHashMapByRegionCode((ArrayList<LinkedHashMap>) tree.getResult());
HashMap<String, HashMap> regionTreeToHashMapById = regionTreeToHashMapById((ArrayList<LinkedHashMap>) tree.getResult());
insertToResultList(linkedHashMapList, resultList, regionTreeToHashMapByRegionCode,"");
return resultList;
......@@ -419,32 +188,6 @@ public class TreeToListController extends BaseController {
return hashMap;
}
public HashMap<String, HashMap> regionTreeToHashMapById(ArrayList<LinkedHashMap> list) {
Queue tempQueue = new LinkedList();
HashMap<String, HashMap> hashMap = new HashMap();
for (LinkedHashMap linkedHashMap : list) {
tempQueue.offer(linkedHashMap);
}
while (tempQueue.size() != 0) {
LinkedHashMap poll = (LinkedHashMap) tempQueue.poll();
//过滤数据,只加入所需数据
HashMap<String, String> objectHashMap = new HashMap<>();
objectHashMap.put("sequenceNbr", (String) poll.get("sequenceNbr"));
objectHashMap.put("regionCode", String.valueOf(poll.get("regionCode")));
objectHashMap.put("regionName", (String) poll.get("regionName"));
objectHashMap.put("parentId", (String) poll.get("parentId"));
hashMap.put(String.valueOf(poll.get("sequenceNbr")), objectHashMap);
if (poll.get("children") != null) {
ArrayList<LinkedHashMap> children = (ArrayList<LinkedHashMap>) poll.get("children");
for (LinkedHashMap child : children) {
tempQueue.offer(child);
}
}
}
return hashMap;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
......
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