| | |
| | | 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; |
| | |
| | | |
| | | //要查自己家庭的 |
| | | ZInfoUser myself = zInfoUserService.getMyself(); |
| | | if(myself==null) |
| | | { |
| | | // System.out.println("ssssss"); |
| | | return AjaxResult.success("您没加入到对应的家庭,请联系管理员"); |
| | | } |
| | | Long familyId = myself.getFamilyId(); |
| | | //也要查别人授权的 |
| | | List<ZAuthority> authority = zAuthorityService.getAuthority(); |
| | |
| | | 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 |
| | |
| | | @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(); |
| | | |
| | |
| | | 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(); |
| | |
| | | "by6",newModel.getBy6(), |
| | | "remark",newModel.getRemark() |
| | | ); |
| | | |
| | | try { |
| | | restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT); |
| | | } catch (IOException e) { |
| | |
| | | //删除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 { |