| | |
| | | import com.ruoyi.domain.*; |
| | | import com.ruoyi.domain.dto.*; |
| | | import com.ruoyi.mapper.ZInfoUserMapper; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import com.ruoyi.service.ZfFamilyService; |
| | | import com.ruoyi.service.ZfRelationService; |
| | | import com.ruoyi.service.ZfRoleService; |
| | | import com.ruoyi.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | |
| | | |
| | | @Resource |
| | | private ZfRoleService zfRoleService; |
| | | |
| | | @Resource |
| | | private ZfClanService zfClanService; |
| | | |
| | | |
| | | @Override |
| | | public AjaxResult selectInfoList(ZInfoUser zInfoUser, Integer pageNum, Integer pageSize) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ZInfoUser> findByUaidToFaid(String usid) { |
| | | ZInfoUser zInfoUser = new ZInfoUser(); |
| | | zInfoUser.setUaid(usid); |
| | | LambdaQueryWrapper<ZInfoUser> lqw = buildCondition(zInfoUser); |
| | | return list(lqw); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZInfoUser> selectByClanId(Integer clanId) { |
| | | ZInfoUser zInfoUser = new ZInfoUser(); |
| | | zInfoUser.setClanId(clanId); |
| | |
| | | // } |
| | | |
| | | @Override |
| | | public AjaxResult findInfoUserNameAClan(String nickName) |
| | | public AjaxResult findUserNameAClan(List<String> nickNames) |
| | | { |
| | | List<ZfShareOther> shareOtherClans = new ArrayList<>(); |
| | | for (String nickName:nickNames) { |
| | | ZInfoUser zInfoUser = new ZInfoUser(); |
| | | zInfoUser.setNickName(nickName); |
| | | |
| | | LambdaQueryWrapper<ZInfoUser> lqw = buildCondition(zInfoUser); |
| | | List<ZInfoUser> zInfoUsers = list(lqw); |
| | | List<ShareOtherClan> shareOtherClans = new ArrayList<>(); |
| | | |
| | | |
| | | for (ZInfoUser zInfoUser1: zInfoUsers) { |
| | | ShareOtherClan shareOtherClan = new ShareOtherClan(); |
| | | shareOtherClan.setNickName(zInfoUser1.getNickName()); |
| | | ZfShareOther shareOtherClan = new ZfShareOther(); |
| | | shareOtherClan.setUserName(zInfoUser1.getNickName()); |
| | | shareOtherClan.setUserId(zInfoUser1.getUserId().intValue()); |
| | | shareOtherClan.setClanId(zInfoUser1.getClanId()); |
| | | shareOtherClan.setClanName(zfClanService.getById(zInfoUser1.getClanId()).getClanName()); |
| | | shareOtherClans.add(shareOtherClan); |
| | | } |
| | | }} |
| | | return AjaxResult.success(shareOtherClans); |
| | | } |
| | | |
| | |
| | | lqw.like(StringUtils.isNotEmpty(zInfoUser.getUnit()), ZInfoUser::getUnit, zInfoUser.getUnit()); |
| | | lqw.like(zInfoUser.getSex() != null, ZInfoUser::getSex, zInfoUser.getSex()); |
| | | lqw.like(zInfoUser.getMaritalStatus() != null, ZInfoUser::getMaritalStatus, zInfoUser.getMaritalStatus()); |
| | | lqw.like(zInfoUser.getBirth() != null, ZInfoUser::getBirth, zInfoUser.getBirth()); |
| | | lqw.le(zInfoUser.getBirth() != null, ZInfoUser::getBirth, zInfoUser.getBirth()); |
| | | lqw.like(zInfoUser.getClanId() != null, ZInfoUser::getClanId, zInfoUser.getClanId()); |
| | | |
| | | lqw.le(zInfoUser.getUaid()!=null, ZInfoUser::getUaid, zInfoUser.getUserId()); |
| | | return lqw; |
| | | |
| | | } |
| | |
| | | LambdaQueryWrapper<ZInfoUser> lambdaQueryWrapper = buildCondition(zInfoUser); |
| | | List<ZInfoUser> list = list(lambdaQueryWrapper); |
| | | log.info("返回的数据为:{}", list); |
| | | |
| | | return list; |
| | | |
| | | } |
| | |
| | | LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>(); |
| | | // lqw.eq(zInfoUser.getSex() != null, ZInfoUser::getSex, zInfoUser.getSex()); |
| | | // lqw.like(StringUtils.isNotEmpty(zInfoUser.getNickName()), ZInfoUser::getNickName, zInfoUser.getNickName()); |
| | | // lqw.between(zInfoUser.getHappenStartTime() != null && zInfoUser.getHappenEndTime() != null, ZInfoUser::getBirth, zInfoUser.getHappenStartTime(),zInfoUser.getHappenEndTime()); |
| | | // lqw.between(zInfoUser.getBirth() != null, ZInfoUser::getBirth, zInfoUser.getBirth(),zInfoUser.getBirth()); |
| | | lqw.eq(zInfoUser.getClanId()!=null, ZInfoUser::getClanId,zInfoUser.getClanId()); |
| | | List<ZInfoUser> allPeopleList = list(lqw); |
| | | // System.out.println(allPeopleList); |
| | | // System.out.println("============z=============zzzzzzzzzzzzzzzzzzz"); |
| | | // System.out.println(allPeopleList); |
| | | //System.out.println("============z=============zzzzzzzzzzzzzzzzzzz"); |
| | | |
| | | // List<ZInfoUser> allPeopleList = list(); |
| | | List<ZInfoUser> result = null; |
| | | // if (depth != null){ |
| | | try { |
| | | result = allPeopleList.stream().filter(people -> people.getUserId() != 1 && ((people.getFatherId()!=null&&people.getFatherId() == 0) || (people.getMomId()!=null&&people.getMomId() == 0))) |
| | | .map(people -> { |
| | |
| | | } |
| | | return people; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // if(zInfoUser.getSex() != null) { |
| | | // System.out.println("/////////////"+result); |
| | | // result = result.stream().filter(i -> i.getSex().equals(zInfoUser.getSex())).collect(Collectors.toList()); |
| | | // } |
| | | // if(zInfoUser.getNickName() != null){ |
| | | // System.out.println("/////////////"+result); |
| | | // result = result.stream().filter(i -> i.getNickName().equals(zInfoUser.getNickName())).collect(Collectors.toList()); |
| | | // } |
| | | //// List<Date> dates = allPeopleList.stream(). |
| | | // if(zInfoUser.getHappenEndTime() != null && zInfoUser.getHappenStartTime() != null){ |
| | | // result = result.stream().filter(a -> a.getBirth().before(zInfoUser.getHappenEndTime())).collect(Collectors.toList()); |
| | | // Long result1 = result.stream().filter(a -> a.getBirth().after(zInfoUser.getHappenStartTime())).count(); |
| | | // System.out.println("9999999999999999999999"); |
| | | // System.out.println(result1); |
| | | // } |
| | | // System.out.println("9999999999999999999999"); |
| | | // System.out.println(result); |
| | | |
| | | } catch (NullPointerException e) { |
| | | throw new RuntimeException("您在加入成员的时候没有指定该成员的父亲或者母亲"); |
| | | } |
| | |
| | | List<ZInfoUser> treeList = (List<ZInfoUser>) listWithTreeByCondition(100, genealogy).get("data"); |
| | | recursionFindUser(treeList); |
| | | |
| | | // System.out.println("555555555555555555555555555555555555555555555555555555555555"); |
| | | List<Genealogy> allData = userList.stream().map( |
| | | zInfoUser -> { |
| | | Genealogy newGenealogy = new Genealogy(); |
| | | BeanUtils.copyProperties(zInfoUser, newGenealogy); |
| | | |
| | | // System.out.println(userList); |
| | | // System.out.println("---------------"); |
| | | List<Genealogy> allData = userList.stream().map( |
| | | zInfoUser -> { |
| | | Genealogy newGenealogy = new Genealogy(); |
| | | BeanUtils.copyProperties(zInfoUser, newGenealogy); |
| | | if (zInfoUser.getSpouseId() != null) { |
| | | ZInfoUser spouse = getById(zInfoUser.getSpouseId()); |
| | | |
| | | if (zInfoUser.getSpouseId() != null) { |
| | | ZInfoUser spouse = getById(zInfoUser.getSpouseId()); |
| | | |
| | | Genealogy spouseInfo = new Genealogy(); |
| | | BeanUtils.copyProperties(spouse,spouseInfo); |
| | | newGenealogy.setSpouse(spouseInfo); |
| | | spouseInfo.setIdentity(newGenealogy.getIdentity()); |
| | | spouseInfo.setSpouseName(zInfoUser.getNickName()); |
| | | newGenealogy.setSpouseName(spouse.getNickName()); |
| | | } |
| | | return newGenealogy; |
| | | } |
| | | Genealogy spouseInfo = new Genealogy(); |
| | | BeanUtils.copyProperties(spouse,spouseInfo); |
| | | newGenealogy.setSpouse(spouseInfo); |
| | | spouseInfo.setIdentity(newGenealogy.getIdentity()); |
| | | spouseInfo.setSpouseName(zInfoUser.getNickName()); |
| | | newGenealogy.setSpouseName(spouse.getNickName()); |
| | | } |
| | | System.out.println(newGenealogy); |
| | | return newGenealogy; |
| | | } |
| | | ).collect(Collectors.toList()); |
| | | // System.out.println(allData); |
| | | // System.out.println("999999999988888888888++++++++++++++++++++++"); |
| | | List<Genealogy> collect = allData.stream() |
| | | .distinct() |
| | | .filter((data)-> data.getIsMyFamily() == 1) |
| | |
| | | .collect(Collectors.toList()); |
| | | List<Genealogy> resultData = new ArrayList<>(); |
| | | |
| | | for (int i = (pageNum - 1) * pageSize; i < pageNum * pageSize + pageSize; i++) { |
| | | if (i >= collect.size()) { |
| | | break; |
| | | } |
| | | resultData.add(collect.get(i)); |
| | | } |
| | | // System.out.println(resultData); |
| | | // System.out.println("999999999988888888888++++++++++++++++++++++"); |
| | | |
| | | // System.out.println(resultData); |
| | | // System.out.println("999999999988888888888++++++++++++++++++++++"); |
| | | // |
| | | // |
| | | //对result做一个条件筛选 |
| | | Iterator<Genealogy> it = resultData.iterator(); //迭代器 从null开始 |
| | | while(it.hasNext()){ //判断下一个指针指向元素是否为空 |
| | | Genealogy data = it.next(); //跳到下一个元素 |
| | | Iterator<Genealogy> it = collect.iterator(); |
| | | while(it.hasNext()){ |
| | | Genealogy data = it.next(); |
| | | |
| | | if(genealogy.getIdentity()!=null){ |
| | | if(data.getIdentity()!=genealogy.getIdentity()){ |
| | |
| | | } |
| | | |
| | | if(genealogy.getBirth()!=null){ |
| | | if(data.getBirth().compareTo(genealogy.getBirth())!=0){ //比较 |
| | | it.remove(); |
| | | continue; |
| | | if(data.getBirth()!=null) { |
| | | if (data.getBirth().compareTo(genealogy.getBirth()) != 0) { |
| | | it.remove(); |
| | | } |
| | | } |
| | | } |
| | | if(genealogy.getHappenEndTime() != null && genealogy.getHappenStartTime() != null ){ |
| | | if (data.getBirth() == null) {it.remove(); continue;} |
| | | if(data.getBirth().before(genealogy.getHappenStartTime()) || data.getBirth().after(genealogy.getHappenEndTime())){ |
| | | it.remove(); |
| | | } |
| | | else it.remove(); |
| | | } |
| | | } |
| | | |
| | |
| | | // } |
| | | // |
| | | // } |
| | | for (int i = (pageNum - 1) * pageSize; i < pageNum * pageSize; i++) { |
| | | if (i >= collect.size()) { |
| | | break; |
| | | } |
| | | System.out.println(i+"//////"+collect.get(i)); |
| | | resultData.add(collect.get(i)); |
| | | } |
| | | |
| | | HashMap<String, Object> resultMap = new HashMap<>(); |
| | | resultMap.put("data", resultData); |
| | | resultMap.put("total", resultData.size()); |
| | | resultMap.put("total", collect.size()); |
| | | resultMap.put("pageNum", pageNum); |
| | | resultMap.put("pageSize", pageSize); |
| | | |
| | |
| | | @Override |
| | | public ZInfoUser getInfoById(Long userId) { |
| | | ZInfoUser user = getInfoBysysId(userId); |
| | | |
| | | |
| | | if(user==null) { |
| | | //利用userId查询 |
| | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private void recursionFindUser(List<ZInfoUser> treeList) { |
| | |
| | | |
| | | // layer = layer + 1; |
| | | // System.out.println(depth); |
| | | |
| | | List<ZInfoUser> collect = allPeopleList.stream().filter( |
| | | one -> Objects.equals(one.getFatherId(), people.getUserId()) || Objects.equals(one.getMomId(),people.getUserId()) |
| | | ).map( |