2021与蓝度共同重构项目,服务端
liuhaonan
2022-07-06 c61daa1070487b6adeff3438633c10f750ac45ab
changes
已修改12个文件
119 ■■■■ 文件已修改
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/InterphoneHostController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/InterphoneHostSubController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/InterphoneSubController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/param/InterphoneHostParam.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/param/InterphoneSubParam.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostSubService.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneSubService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/InterphoneHostController.java
@@ -65,10 +65,10 @@
    }
    /**
     * 删除主机
     * 主机列表
     */
    @GetMapping("/getList/{keyword}")
    public ResponseVO<Object> getInterphoneHostList(BaseConditionVO baseConditionVO, @PathVariable String keyword) {
    @GetMapping("/getList")
    public ResponseVO<Object> getInterphoneHostList(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword",required = false) String keyword) {
        if (!permissionConfig.check(MenuEnum.FOR_HELP_MANAGER.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/InterphoneHostSubController.java
@@ -17,17 +17,26 @@
    private PermissionConfig permissionConfig;
    private final InterphoneHostSubService interphoneHostSubService;
    /**
     * 主机绑定子机
     * @param map
     * @return
     */
    @PostMapping("/bind")
    public ResponseVO<Object> bind(@RequestBody Map map) {
        if (!permissionConfig.check(MenuEnum.INTER_PHONE_HOST_SUB_BINDING.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        Integer hostId = (Integer) map.get("hostId");
        Integer subId = (Integer) map.get("subId");
        int hostId = Integer.parseInt(map.get("hostId").toString());
        int subId = Integer.parseInt(map.get("subId").toString());
        return ResponseUtil.success(interphoneHostSubService.bindHostSub(hostId, subId));
    }
    /**
     * 主机解绑子机
     * @param subId
     * @return
     */
    @PostMapping("/unbind/{subId}")
    public ResponseVO<Object> unbind(@PathVariable Integer subId) {
        if (!permissionConfig.check(MenuEnum.INTER_PHONE_HOST_SUB_UNBIND.getCode())) {
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/InterphoneSubController.java
@@ -65,10 +65,10 @@
    }
    /**
     * 删除主机
     * 子设备列表
     */
    @GetMapping("/getList/{keyword}")
    public ResponseVO<Object> getInterphoneHostList(BaseConditionVO baseConditionVO, @PathVariable String keyword) {
    @GetMapping("/getList")
    public ResponseVO<Object> getInterphoneHostList(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword",required = false) String keyword) {
        if (!permissionConfig.check(MenuEnum.FOR_HELP_MANAGER.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
ximon-admin/src/main/java/com/sandu/ximon/admin/param/InterphoneHostParam.java
@@ -27,15 +27,6 @@
     */
    private String hostAddress;
    /**
     *
     */
    private LocalDateTime createtime;
    /**
     *
     */
    private LocalDateTime updatetime;
    /**
     * sip服务器地址
ximon-admin/src/main/java/com/sandu/ximon/admin/param/InterphoneSubParam.java
@@ -23,16 +23,6 @@
    private String subAddress;
    /**
     *
     */
    private LocalDateTime createtime;
    /**
     *
     */
    private LocalDateTime updatetime;
    /**
     * sip服务器地址
     */
    private String sipAddress;
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostService.java
@@ -62,10 +62,12 @@
            return false;
        }
        boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getHostMac(), PoleBindingEnums.FOR_HELP);
        if (!belong) {
            throw new BusinessException("该设备不属于您,不能修改设备信息");
        }
       if(SecurityUtils.getClientId()!=null){
           boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getHostMac(), PoleBindingEnums.FOR_HELP);
           if (!belong) {
               throw new BusinessException("该设备不属于您,不能修改设备信息");
           }
       }
        InterphoneHost interphoneHost = new InterphoneHost();
        interphoneHost.setHostId(id);
        BeanUtils.copyProperties(interphoneHostParam, interphoneHost);
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneHostSubService.java
@@ -1,8 +1,11 @@
package com.sandu.ximon.admin.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.sandu.common.execption.BusinessException;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.common.util.SpringContextHolder;
import com.sandu.ximon.dao.domain.InterphoneHost;
import com.sandu.ximon.dao.domain.InterphoneHostSubPole;
import com.sandu.ximon.dao.mapper.InterphoneHostSubPoleMapper;
import lombok.AllArgsConstructor;
@@ -26,6 +29,11 @@
        }
        InterphoneHostSubPole pole = new InterphoneHostSubPole();
        InterphoneHost host = SpringContextHolder.getBean(InterphoneHostService.class).getById(hostId);
        InterphoneHost sub = SpringContextHolder.getBean(InterphoneHostService.class).getById(subId);
        if (host == null && sub == null) {
            throw new BusinessException("主设备或子设备不存在");
        }
        pole.setHostId(hostId);
        pole.setSubId(subId);
        return save(pole);
@@ -38,10 +46,11 @@
        if (subId == null) {
            throw new BusinessException("子设备id不能为空");
        }
        InterphoneHostSubPole one = getOne(Wrappers.lambdaQuery(InterphoneHostSubPole.class).eq(InterphoneHostSubPole::getSubId, subId));
        LambdaQueryWrapper<InterphoneHostSubPole> eq = Wrappers.lambdaQuery(InterphoneHostSubPole.class).eq(InterphoneHostSubPole::getSubId, subId);
        InterphoneHostSubPole one = getOne(eq);
        if (one == null) {
            throw new BusinessException("绑定关系不存在");
        }
        return removeById(one);
        return remove(eq);
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/InterphoneSubService.java
@@ -58,9 +58,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);
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LEDProgramService.java
@@ -102,10 +102,10 @@
        if (seq != null) {
            switch (seq) {
                case 1:
                    orderBySeq = " ASC";
                    orderBySeq = OrderByEnums.ASC.getCode();
                    break;
                case 2:
                    orderBySeq = " DESC";
                    orderBySeq = OrderByEnums.DESC.getCode();
                    break;
                default:
                    break;
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
@@ -159,10 +159,12 @@
        if (deviceCode == null) {
            throw new BusinessException("设备编号不能为空");
        }
        //查灯杆归属关系
        boolean belong = isBelong(deviceCode, null);
        if(!belong){
            throw  new BusinessException("该灯杆不属于您,无法解绑!");
        if (SecurityUtils.getClientId() != null) {
            //查灯杆归属关系
            boolean belong = isBelong(deviceCode, null);
            if (!belong) {
                throw new BusinessException("该灯杆不属于您,无法解绑!");
            }
        }
        //直接删除设备不需要灯杆ID
        PoleBinding one = getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode));
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleLightemitService.java
@@ -273,9 +273,11 @@
            throw new BusinessException("未找到LED屏");
        }
        boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getLightemitControlCode(), PoleBindingEnums.XIXUN);
        if (!belong) {
            throw new BusinessException("该设备不属于您,不能修改设备信息");
        if (SecurityUtils.getClientId() != null) {
            boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getLightemitControlCode(), PoleBindingEnums.XIXUN);
            if (!belong) {
                throw new BusinessException("该设备不属于您,不能修改设备信息");
            }
        }
        poleLightemit.setLightemitId(ledId);
        boolean b = this.updateById(poleLightemit);
ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java
@@ -8,6 +8,7 @@
import com.sandu.ximon.admin.dto.nova.PlayerPage;
import com.sandu.ximon.admin.dto.nova.PlayerWidget;
import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereHeartbeatReportInnerFrame;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.RedisUtils;
import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils;
import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
@@ -223,9 +224,11 @@
        if (byId == null) {
            throw new BusinessException("未找到该设备");
        }
        boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getSn(), PoleBindingEnums.VONNOX);
        if (!belong) {
            throw new BusinessException("该设备不属于您,不能修改设备信息");
        if (SecurityUtils.getClientId() != null) {
            boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getSn(), PoleBindingEnums.VONNOX);
            if (!belong) {
                throw new BusinessException("该设备不属于您,不能修改设备信息");
            }
        }
        LedPlayerEntity led = new LedPlayerEntity();
        led.setId(id);
@@ -303,8 +306,6 @@
        list.add(playerPage);
        playerProgram.setPages(list);
        playerProgram.setNoticeUrl(VnnoxConstant.NOTIFY_URL);
        /**
         * 诺瓦推送大气数据 日志记录开始
         ////         */
@@ -321,15 +322,8 @@
    private List<PlayerWidget> generateWaterAndSensorWidget(A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage poleSensorEntity) {
        List widgetList = new ArrayList<>();
        List<String> list = new ArrayList<>();
//        if (Objects.nonNull(waterDataEntity)) {
//            list.add("水质环境监测实时数据:");
//            list.add("ph:"+waterDataEntity.getPh());
//            list.add("溶解氧:"+waterDataEntity.getDoData() + "(mg/L)");
//            list.add("电导率:"+waterDataEntity.getEc() + "(10^(-6)S)");
//            list.add("浊度:"+waterDataEntity.getNtu() + "NTU");
//        }
        if (Objects.nonNull(poleSensorEntity)) {
//            list.add("环境监测:");
            list.add("环境监测:");
            list.add("温度:" + poleSensorEntity.getTemperature() + "°");
            list.add("湿度:" + poleSensorEntity.getHumidity() + "%");
            list.add("pm25:" + poleSensorEntity.getPm25() + "μg/m³");