feige
2023-09-16 d29cce61fb3a38f9f57a64a2a20d276b0d1254bc
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -313,26 +313,26 @@
    @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);
@@ -358,6 +358,7 @@
            //   esModel.setCtName("大家");
            //  esModel.setCtContent("大家好,才是真的好");//处事由
            esSer.insertTable(esModel);
            return AjaxResult.success();
        } else {
            return AjaxResult.error();