2021与蓝度共同重构项目,服务端
liuhaonan
2022-07-07 cd0fa3261b49dbab89bb01dfa94dc3ebdb08dec4
changes
已修改3个文件
33 ■■■■■ 文件已修改
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostSubService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneSubService.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostService.java
@@ -90,17 +90,11 @@
        /**
         * 编辑一键求助主机 日志记录结束
         */
        List<InterphoneHost> list = list(Wrappers.lambdaQuery(InterphoneHost.class).eq(InterphoneHost::getHostMac, interphoneHostParam.getHostMac()));
        if (list.size() > 0) {
            list.forEach(
                    host -> {
                        if (!host.getHostId().equals(id)) {
                            throw new BusinessException("请检查设备mac是否重复");
                        }
                    }
            );
        }
        boolean b = updateById(interphoneHost);
        List<InterphoneHost> list = list(Wrappers.lambdaQuery(InterphoneHost.class).eq(InterphoneHost::getHostMac, interphoneHostParam.getHostMac()));
        if (list.size() > 1) {
            throw new BusinessException("请检查设备mac是否重复");
        }
        return b;
    }
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostSubService.java
@@ -5,6 +5,7 @@
import com.sandu.common.execption.BusinessException;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.common.util.SpringContextHolder;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.dao.domain.InterphoneHost;
import com.sandu.ximon.dao.domain.InterphoneHostSubPole;
import com.sandu.ximon.dao.mapper.InterphoneHostSubPoleMapper;
@@ -22,6 +23,9 @@
    public boolean bindHostSub(Integer hostId, Integer subId) {
        if (hostId == null || subId == null) {
            throw new BusinessException("主设备id或子设备id不能为空");
        }
        if (SecurityUtils.getClientId() != null) {
            throw new BusinessException("只有管理员才能进行此操作");
        }
        InterphoneHostSubPole pole = new InterphoneHostSubPole();
        InterphoneHost host = SpringContextHolder.getBean(InterphoneHostService.class).getById(hostId);
@@ -46,6 +50,9 @@
        if (subId == null) {
            throw new BusinessException("子设备id不能为空");
        }
        if (SecurityUtils.getClientId() != null) {
            throw new BusinessException("只有管理员才能进行此操作");
        }
        LambdaQueryWrapper<InterphoneHostSubPole> eq = Wrappers.lambdaQuery(InterphoneHostSubPole.class).eq(InterphoneHostSubPole::getSubId, subId);
        InterphoneHostSubPole one = getOne(eq);
        if (one == null) {
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneSubService.java
@@ -83,20 +83,14 @@
                "}";
        StoreOperationRecordsUtils.storeOperationData(listCode, null, "编辑一键求助子设备", content);
        boolean b = updateById(interphoneSub);
        /**
         * 编辑一键求助子设备 日志记录结束
         */
        List<InterphoneSub> list = list(Wrappers.lambdaQuery(InterphoneSub.class).eq(InterphoneSub::getSubMac, interphoneSubParam.getSubMac()));
        if (list.size() > 0) {
            list.forEach(
                    sub->{
                        if(!sub.getSubId().equals(id)){
                            throw new BusinessException("请检查设备mac是否重复");
                        }
                    }
            );
        if (list.size() > 1) {
            throw new BusinessException("请检查设备mac是否重复");
        }
        boolean b = updateById(interphoneSub);
        return b;
    }