| | |
| | | |
| | | @Override |
| | | public AjaxResult addData(ZfEvent zfEvent) { |
| | | ZInfoUser myself = zInfoUserService.getMyself(); |
| | | Long familyId = myself.getFamilyId(); |
| | | |
| | | if(familyId == null){ |
| | | throw new RuntimeException("您还未加入任何家庭"); |
| | | } |
| | | |
| | | List<ZAuthority> authority = zAuthorityService.getAuthority(); |
| | | List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList()); |
| | | familyIdList.add(familyId); |
| | | |
| | | if (zfEvent.getFamilyId()!=null && !familyIdList.contains(zfEvent.getFamilyId())) { |
| | | throw new RuntimeException("你没有权限操作此家庭的数据"); |
| | | } |
| | | |
| | | |
| | | if(zfEvent.getFamilyId() == null){ |
| | | //默认添加自己家庭的数据 |
| | | zfEvent.setFamilyId(familyId); |
| | | } |
| | | // ZInfoUser myself = zInfoUserService.getMyself(); |
| | | // Long familyId = myself.getFamilyId(); |
| | | // |
| | | // if(familyId == null){ |
| | | // throw new RuntimeException("您还未加入任何家庭"); |
| | | // } |
| | | // |
| | | // List<ZAuthority> authority = zAuthorityService.getAuthority(); |
| | | // List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList()); |
| | | // familyIdList.add(familyId); |
| | | // |
| | | // if (zfEvent.getFamilyId()!=null && !familyIdList.contains(zfEvent.getFamilyId())) { |
| | | // throw new RuntimeException("你没有权限操作此家庭的数据"); |
| | | // } |
| | | // |
| | | // |
| | | // if(zfEvent.getFamilyId() == null){ |
| | | // //默认添加自己家庭的数据 |
| | | // zfEvent.setFamilyId(familyId); |
| | | // } |
| | | |
| | | //判断是否有重复数据 |
| | | LambdaQueryWrapper<ZfEvent> lqw = uniqueCondition(zfEvent); |
| | |
| | | // esModel.setCtName("大家"); |
| | | // esModel.setCtContent("大家好,才是真的好");//处事由 |
| | | esSer.insertTable(esModel); |
| | | |
| | | return AjaxResult.success(); |
| | | } else { |
| | | return AjaxResult.error(); |