From 3eda21a5a601c808b4e7ef7bd56535de96e3d7ed Mon Sep 17 00:00:00 2001
From: feige <feige@qq.com>
Date: 星期三, 17 五月 2023 11:45:18 +0800
Subject: [PATCH] 添加了两个导出接口一个是选择了id的,一个是没有选择的
---
zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 105 insertions(+), 2 deletions(-)
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
index 93b18ec..21fcf92 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
@@ -250,6 +250,7 @@
}
+
private void checkAuthorization(String familyId, String destinationFamilyId,boolean flag) {
String text=null;
if(flag){
@@ -283,8 +284,6 @@
return familyId;
}
-
-
private String getFinalStr(String destinationFamilyId, List<String> authorityList) {
String authorityListStr = authorityList.stream().collect(Collectors.joining(" ", "{", "}"));
String finalStr= destinationFamilyId +authorityListStr; //3{2007 1988 1004}
@@ -292,4 +291,108 @@
}
+ /**
+ * 鑾峰彇瀹舵牴缃�
+ * @return
+ */
+ @Override
+ public AjaxResult listWithTree(Integer depth) {
+
+ List<ZInfoUser> allPeopleList = list();
+ List<ZInfoUser> result = null;
+ try {
+ result = allPeopleList.stream().filter(people -> people.getUserId()!=1&&(people.getFatherId() == 0||people.getMomId()==0))
+ .map(people -> {
+ if(depth>1)
+ people.setChildList(fillChildren(people, allPeopleList, depth-1));
+ return people;
+ }).collect(Collectors.toList());
+ } catch (NullPointerException e) {
+ throw new RuntimeException("鎮ㄥ湪鍔犲叆鎴愬憳鐨勬椂鍊欐病鏈夋寚瀹氳鎴愬憳鐨勭埗浜叉垨鑰呮瘝浜�");
+ }
+ return AjaxResult.success(result);
+
+ }
+
+ /**
+ * 涓轰簡瀹舵牴缃戙�佹柊澧炴垨鑰呬慨鏀圭埗瀛愬叧绯�
+ * @param fatherId
+ * @param motherId
+ * @return
+ */
+ @Override
+ public AjaxResult addParent(Long fatherId, Long motherId) {
+ SysUser user = SecurityUtils.getLoginUser().getUser();
+ Long userId = user.getUserId();
+ LambdaQueryWrapper<ZInfoUser> zInfoUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ zInfoUserLambdaQueryWrapper.eq(ZInfoUser::getUserId,userId);
+ ZInfoUser zInfoUser = getOne(zInfoUserLambdaQueryWrapper);
+
+ zInfoUser.setFatherId(fatherId);
+ zInfoUser.setMomId(motherId);
+
+ updateById(zInfoUser);
+ return AjaxResult.success();
+ }
+
+ @Override
+ public AjaxResult listAllExceptAdmin() {
+ List<ZInfoUser> collect = list().stream().filter(zInfoUser -> zInfoUser.getUserId() != 1).collect(Collectors.toList());
+ return AjaxResult.success(collect);
+
+ }
+
+ @Override
+ public AjaxResult listMySelfAndSpouse(Long id) {
+ LambdaQueryWrapper<ZInfoUser> lqw1 = new LambdaQueryWrapper<>();
+ lqw1.eq(ZInfoUser::getUserId,id);
+ ZInfoUser myself = getOne(lqw1);
+ Long spouseId = myself.getSpouseId();
+
+ LambdaQueryWrapper<ZInfoUser> lqw2 = new LambdaQueryWrapper<>();
+ lqw2.eq(ZInfoUser::getUserId,spouseId);
+ ZInfoUser spouse = getOne(lqw2);
+
+ ArrayList<ZInfoUser> zInfoUsers = new ArrayList<>();
+ zInfoUsers.add(myself);
+ zInfoUsers.add(spouse);
+
+ return AjaxResult.success(zInfoUsers);
+ }
+
+ /**
+ * 閫掑綊绠楁硶
+ * @param people
+ * @param allPeopleList
+ * @return
+ */
+ private List<ZInfoUser> fillChildren(ZInfoUser people, List<ZInfoUser> allPeopleList, Integer depth) {
+
+ // TODO: 2023-05-05 鎺у埗閫掑綊鐨勬鏁�
+ // if(depth==layer)
+
+ // layer = layer + 1;
+ System.out.println(depth);
+ List<ZInfoUser> collect = allPeopleList.stream().filter(
+ one -> one.getFatherId() == people.getUserId() || one.getMomId() == people.getUserId()
+ ).map(
+ one -> {
+ if(depth==1)
+ return one;
+ else {
+ List<ZInfoUser> zinfo = fillChildren(one, allPeopleList, depth - 1);
+ one.setChildList(zinfo);
+ System.out.println(one);
+ return one;
+ }
+
+ //return one;
+ }
+ ).collect(Collectors.toList());
+ System.out.println(collect);
+ return collect;
+
+ }
+
+
}
--
Gitblit v1.9.1