| | |
| | | |
| | | package com.ruoyi.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.EsModel; |
| | | import com.ruoyi.common.utils.MapUtils; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.ZfAncestor; |
| | | import com.ruoyi.domain.ZfClan; |
| | | import com.ruoyi.domain.dto.AncestorClan; |
| | | import com.ruoyi.mapper.ZfAncestorMapper; |
| | | import com.ruoyi.service.*; |
| | | import org.elasticsearch.action.delete.DeleteRequest; |
| | |
| | | private EsService esSer; |
| | | |
| | | @Resource |
| | | private ZfAncestorMapper zfAncestorMapper; |
| | | @Resource |
| | | ZInfoUserService zInfoUserService; |
| | | |
| | | @Resource |
| | |
| | | private LambdaQueryWrapper<ZfAncestor> buildCondition(ZfAncestor zfAncestor) { |
| | | LambdaQueryWrapper<ZfAncestor> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.orderByDesc(ZfAncestor::getId); |
| | | lqw.eq(zfAncestor.getClanId() !=null , ZfAncestor::getClanId, zfAncestor.getClanId()); |
| | | lqw.eq(zfAncestor.getName()!=null, ZfAncestor::getName,zfAncestor.getName()); |
| | | |
| | | return lqw; |
| | | } |
| | |
| | | return AjaxResult.success(members); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult selectDataList(ZfAncestor zfAncestor, Integer pageNo, Integer pageSize) { |
| | | QueryWrapper<Object> queryWrapper = new QueryWrapper<>(); |
| | | |
| | | queryWrapper.eq(zfAncestor.getClanId() !=null , " zf_ancestor.clan_id", zfAncestor.getClanId()); |
| | | queryWrapper.eq(zfAncestor.getSysId() !=null , " zf_ancestor.sys_id ", zfAncestor.getSysId()); |
| | | |
| | | Page<AncestorClan> info = zfAncestorMapper.selectInfo(new Page<>(pageNo, pageSize),queryWrapper); |
| | | //page(pa, wrapper); |
| | | // List<AncestorClan> orders = page(pa, wrapper); |
| | | List<AncestorClan> list =info.getRecords(); |
| | | HashMap<String, Object> data = MapUtils.getResult(info, list); |
| | | return AjaxResult.success(data); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Long addData(ZfAncestor zfAncestor) { |
| | | LambdaQueryWrapper<ZfAncestor> lqw = buildCondition(zfAncestor); |
| | | List<ZfAncestor> list = list(lqw); |
| | | Long sysID = 0L; |
| | | System.out.println("15dniwru/"+list); |
| | | if(list.size()>2){ |
| | | throw new RuntimeException("请勿重复添加祖先"); |
| | | } |
| | | // LambdaQueryWrapper<ZfAncestor> lqw = buildCondition(zfAncestor); |
| | | // List<ZfAncestor> list = list(lqw); |
| | | // Long sysID = 0L; |
| | | // System.out.println("15dniwru/"+list); |
| | | // if(list.size()>0){ |
| | | // throw new RuntimeException("请勿重复添加祖先"); |
| | | // } |
| | | |
| | | else if (list.size() == 1){ |
| | | if (list.get(0).getSex().equals(zfAncestor.getSex())){ |
| | | throw new RuntimeException("两位祖先不能为同性"); |
| | | } |
| | | // else if (list.size() == 1){ |
| | | // if (list.get(0).getSex().equals(zfAncestor.getSex())){ |
| | | // throw new RuntimeException("两位祖先不能为同性"); |
| | | // } |
| | | |
| | | |
| | | sysID = zInfoUserService.getInfoBysysId(list.get(0).getSysId()).getUserId(); |
| | | } |
| | | |
| | | // sysID = zInfoUserService.getInfoBysysId(list.get(0).getSysId()).getUserId(); |
| | | // } |
| | | // |
| | | |
| | | // if (!Long.valueOf(zfClanService.getById(zfClanManage.getClanId()).getAdminId()).equals(getUserId())) { |
| | | // throw new RuntimeException("您不是管理员,没有权力添加成员"); |
| | |
| | | // zInfoUserService.saveOrUpdate(zInfoUser); |
| | | |
| | | save(zfAncestor); |
| | | EsModel esModel = new EsModel(); |
| | | Integer inte = zfAncestor.getClanId(); |
| | | String uuid = UUID.randomUUID().toString().replace("-",""); |
| | | esModel.setId(uuid); |
| | | esModel.setCtId(Long.valueOf(inte)); |
| | | esModel.setCtTableName("家族管理"); |
| | | esModel.setBy1(zfAncestor.getName()); |
| | | |
| | | esModel.setBy5("/zfClanManage"); |
| | | // esModel.setFid(familyId); |
| | | esSer.insertTable(esModel); |
| | | // EsModel esModel = new EsModel(); |
| | | // Integer inte = zfAncestor.getClanId(); |
| | | // String uuid = UUID.randomUUID().toString().replace("-",""); |
| | | // esModel.setId(uuid); |
| | | // esModel.setCtId(Long.valueOf(inte)); |
| | | // esModel.setCtTableName("家族管理"); |
| | | // esModel.setBy1(zfAncestor.getName()); |
| | | // |
| | | // esModel.setBy5("/zfClanManage"); |
| | | //// esModel.setFid(familyId); |
| | | // esSer.insertTable(esModel); |
| | | // System.out.println(esModel); |
| | | |
| | | return sysID; |
| | | return 1L; |
| | | |
| | | } |
| | | |
| | |
| | | return zfAncestor2; |
| | | } |
| | | |
| | | @Override |
| | | public ZfAncestor selectZfAncestor(ZfAncestor zfAncestor) { |
| | | LambdaQueryWrapper<ZfAncestor> queryWraper = new LambdaQueryWrapper<>(); |
| | | |
| | | queryWraper.eq(zfAncestor.getSysId() !=null , ZfAncestor::getSysId, zfAncestor.getSysId()); |
| | | List lis = this.list(queryWraper); |
| | | if(lis.size()>0) |
| | | return (ZfAncestor) lis.get(0); |
| | | else |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | *通过家族id删除 |