| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.constant.MenuAuthority.*; |
| | |
| | | ZAuthorityService zAuthorityService; |
| | | |
| | | @Resource |
| | | ZfPetNoteService zfPetNoteService; |
| | | |
| | | @Resource |
| | | ZfPetSharService zfPetSharService; |
| | | |
| | | @Resource |
| | | ZfPetDownlService zfPetDownlService; |
| | | |
| | | @Override |
| | | public AjaxResult selectDataList(ZfPet zfPet, Integer pageNum, Integer pageSize) { |
| | | // LambdaQueryWrapper<ZfPet> lqw = buildCondition(zfPet); |
| | |
| | | fatherFaId = zInfoUserService.getInfoById(myself.getFatherId()).getFamilyId(); |
| | | Long motherFaId = 0L; |
| | | if(myself.getMomId()!=null) |
| | | motherFaId = zInfoUserService.getInfoBysysId(myself.getMomId()).getFamilyId(); |
| | | motherFaId = zInfoUserService.getInfoById(myself.getMomId()).getFamilyId(); |
| | | |
| | | //也要查别人授权的 |
| | | List<ZAuthority> authority = zAuthorityService.getAuthority(); |
| | |
| | | //加上父母家族id |
| | | idList.add(fatherFaId); |
| | | idList.add(motherFaId); |
| | | |
| | | List<Long> fms = zInfoUserService.findByUaidToFaid(myself.getUaid()).stream().map(ZInfoUser::getFamilyId).collect(Collectors.toList()); |
| | | if(!fms.isEmpty()) |
| | | { |
| | | idList.addAll(fms); |
| | | } |
| | | // String familyIds = listFamilyIds(); |
| | | // String secondFamilyAuthority = listSecondFamilyIds(); |
| | | LambdaQueryWrapper<ZfPet> lqw = buildCondition(zfPet, idList); |
| | |
| | | public List<ZfPet> markOwnData(Long familyId,Long fatherFamilyId, Long motherFamilyId,List<ZfPet> beanRecords){ |
| | | return beanRecords.stream().peek( |
| | | bean -> { |
| | | if (bean.getFamilyId() == familyId||(fatherFamilyId!=0L && fatherFamilyId==familyId)||(motherFamilyId!=0L && motherFamilyId==familyId)) { |
| | | if (Objects.equals(bean.getFamilyId(), familyId) ||(fatherFamilyId!=0L && fatherFamilyId.equals(familyId))||(motherFamilyId!=0L && motherFamilyId.equals(familyId))) { |
| | | bean.setOwnData(1); |
| | | } else { |
| | | bean.setOwnData(0); |
| | |
| | | //加上父母家族id |
| | | idList.add(fatherFaId); |
| | | idList.add(motherFaId); |
| | | |
| | | List<Long> fms = zInfoUserService.findByUaidToFaid(myself.getUaid()).stream().map(ZInfoUser::getFamilyId).collect(Collectors.toList()); |
| | | if(!fms.isEmpty()) |
| | | { |
| | | idList.addAll(fms); |
| | | } |
| | | LambdaQueryWrapper<ZfPet> lambdaQueryWrapper = buildCondition(zfPet, idList); |
| | | List<ZfPet> beanRecords = list(lambdaQueryWrapper); |
| | | log.info("从数据库中查到的为:{}", beanRecords); |
| | |
| | | if (!familyIdList.contains(data.getFamilyId())){ |
| | | throw new RuntimeException("你没有权限操作此家庭的数据"); |
| | | } |
| | | List<ZfPetNote> petNoteByPetId = zfPetNoteService.getPetNoteByPetId(data.getId()); |
| | | if(petNoteByPetId.size() != 0) |
| | | if (!zfPetNoteService.removeBatchByIds(petNoteByPetId)) |
| | | return AjaxResult.error(); |
| | | } |
| | | if (! (zfPetDownlService.deleteData(ids) && zfPetSharService.deleteByContentId(ids) ) ){ |
| | | return AjaxResult.error(); |