zqy
2024-07-30 c35d9c6311b6f9ef75b49559a5c6db75e0a43ac6
zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java
@@ -203,22 +203,35 @@
    }
    @Override
    public void update(ZfAncestor zfAncestor) {
    public ZfAncestor update(ZfAncestor zfAncestor) {
        LambdaQueryWrapper<ZfAncestor> lqw = uniqueCondition(zfAncestor);
        List<ZfAncestor> list = list(lqw);
        System.out.println(list);
//        System.out.println(list);
        ZInfoUser updateDate =zInfoUserService.getInfoBysysId(zfAncestor.getSysId());
        ZfAncestor zfAncestor1 = new ZfAncestor();
        ZfAncestor zfAncestor2 = new ZfAncestor();
        zfAncestor1.setId(list.get(0).getId());
        zfAncestor1.setName(zfAncestor.getName());
        if((updateDate.getSpouseId() != null || updateDate.getSpouseId() != 0) && zfAncestor.getSex() !=null){
        System.out.println(updateDate);
        if (zfAncestor.getSex() != null){
        if(updateDate.getSpouseId() != null && updateDate.getSpouseId() != 0){
            Long spouseId=updateDate.getSpouseId();
            if (zInfoUserService.getById(spouseId).getSex().equals(zfAncestor.getSex())){
                throw new RuntimeException("祖先两位不能为同性");}
            zfAncestor.setSex(zfAncestor.getSex());}
                Long spouseSysId = zInfoUserService.getById(spouseId).getSysId();
                zfAncestor2.setSysId(spouseSysId);
                Integer spId = list(uniqueCondition(zfAncestor2)).get(0).getId();
                zfAncestor2.setId(spId);
                zfAncestor2.setSex(zfAncestor.getSex() == 0? 1: 0);
                System.out.println(zfAncestor2);
                zfAncestorService.updateById(zfAncestor2);
            }}
            zfAncestor1.setSex(zfAncestor.getSex());}
//        System.out.println("1841vdndigrrr"+zfAncestor1);
            zfAncestorService.updateById(zfAncestor1);
        return zfAncestor2;
    }
    /**