2021与蓝度共同重构项目,服务端
liuhaonan
2022-07-07 13df4af0cb954740fd23c4bc0553f731161d15fc
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneSubService.java
@@ -32,6 +32,10 @@
     * 新增子设备
     */
    public boolean addSub(InterphoneSubParam interphoneSubParam) {
        List<InterphoneSub> list = list(Wrappers.lambdaQuery(InterphoneSub.class).eq(InterphoneSub::getSubMac, interphoneSubParam.getSubMac()));
        if (list.size() > 0) {
            throw new BusinessException("该设备已存在");
        }
        InterphoneSub interphoneSub = new InterphoneSub();
        BeanUtils.copyProperties(interphoneSubParam, interphoneSub);
        boolean save = save(interphoneSub);
@@ -58,9 +62,11 @@
        if (byId == null) {
            return false;
        }
        boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getSubMac(), PoleBindingEnums.FOR_HELP);
        if (!belong) {
            throw new BusinessException("该设备不属于您,不能修改设备信息");
        if (SecurityUtils.getClientId() != null) {
            boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getSubMac(), PoleBindingEnums.FOR_HELP);
            if (!belong) {
                throw new BusinessException("该设备不属于您,不能修改设备信息");
            }
        }
        InterphoneSub interphoneSub = new InterphoneSub();
        BeanUtils.copyProperties(interphoneSubParam, interphoneSub);
@@ -78,8 +84,12 @@
        /**
         * 编辑一键求助子设备 日志记录结束
         */
        return updateById(interphoneSub);
        boolean b = updateById(interphoneSub);
        List<InterphoneSub> list = list(Wrappers.lambdaQuery(InterphoneSub.class).eq(InterphoneSub::getSubMac, interphoneSubParam.getSubMac()));
        if (list.size() > 1) {
            throw new BusinessException("请检查设备mac是否重复");
        }
        return b;
    }
    /**