forked from gzzfw/backEnd/gz-dyh

xusd
2024-10-17 adddb6522e95c08bef6bc6b00338ff27d82aa55d
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java
@@ -672,6 +672,32 @@
        }
    }
    /**
     * 获取本级综治中心
     * @param unitId 当前单位编号
     * @return
     */
    public CtUnitDTO getBjZzzx(String unitId){
        try{
            CtUnitDTO ctUnitDTO = new CtUnitDTO();
            // 查询自己是否是综治中心
            CtUnit loginCtUnit = mapper.selectById(unitId);
            if (UserBaseConsts.UNIT_TYPE_1 == loginCtUnit.getUnitType()){
                BeanUtils.copyProperties(loginCtUnit, ctUnitDTO);
            }else {
                // 查询当前单位的上级综治中心
                QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>();
                ctUnitQueryWrapper.eq("id", loginCtUnit.getParentId()).eq("unit_type", UserBaseConsts.UNIT_TYPE_1);
                CtUnit zzzxCtUnit = mapper.selectOne(ctUnitQueryWrapper);
                BeanUtils.copyProperties(zzzxCtUnit, ctUnitDTO);
            }
            return ctUnitDTO;
        }catch (Exception e){
            log.error("[CtUnitService.getParentZzzx]调用失败,异常信息:"+e, e);
            throw new ServiceException("CtUnitService.getParentZzzx", e);
        }
    }
    public CtUnit selectUnitByGridId(String gridUnitId){
        return mapper.selectUnitByGridId(gridUnitId);
    }