jinquanOu
2024-06-11 5d7b0a0bbcae6844e2296ef53c3f4c88293dacfe
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -258,6 +259,11 @@
        //要查自己家庭的
        ZInfoUser myself = zInfoUserService.getMyself();
        if(myself==null)
        {
            //   System.out.println("ssssss");
            return AjaxResult.success("您没加入到对应的家庭,请联系管理员");
        }
        Long familyId = myself.getFamilyId();
        //也要查别人授权的
        List<ZAuthority> authority = zAuthorityService.getAuthority();
@@ -299,6 +305,12 @@
        else
            list = list();
        return list;
    }
    @Override
    public AjaxResult selectType() {
        List<String> lis = list(new QueryWrapper<ZfProperty>().select("distinct (type)").lambda()).stream().map(ZfProperty::getType).collect(Collectors.toList());
        return AjaxResult.success(lis);
    }
    @Override
@@ -416,8 +428,9 @@
    @Override
    public AjaxResult updateData(ZfProperty zfProperty) {
        ZInfoUser myself = zInfoUserService.getMyself();
        Long familyId = myself.getFamilyId();
        Long familyId = myself.getFamilyId();
      //  System.out.println("sssssssssssss");
        //先根据id查询出数据的familyId,看看有没有权限操作
        Long dataFamilyId = getById(zfProperty.getId()).getFamilyId();
@@ -439,9 +452,11 @@
        if(updateById(zfProperty)){
            //到数据库中查询对应的数据
            ZfProperty dataById = getById(zfProperty.getId());
            //先到es中查询到对应那条数据在es的id
            EsModel esResult = esService.findByCtId(dataById.getId().intValue(), "家庭资产");
            if (esResult == null){
                return AjaxResult.success();
            }
            //操作es修改数据
            EsModel newModel = new EsModel();
@@ -491,7 +506,6 @@
                    "by6",newModel.getBy6(),
                    "remark",newModel.getRemark()
            );
            try {
                restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
            } catch (IOException e) {
@@ -529,12 +543,14 @@
            //删除es中的数据
            zfPropertys.stream().forEach(zfProperty -> {
                EsModel esModel = esService.findByCtId(zfProperty.getId().intValue(), "家庭资产");
                if(esModel!=null)
                {
                DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
                try {
                    restHighLevelClient.delete(deleteRequest,RequestOptions.DEFAULT);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                }}
            });
            return AjaxResult.success();
        }else {