2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-04-22 1a8340a0bb7dd7cd72bb6ca5fb5a3e3accda2924
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -2,11 +2,13 @@
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.sandu.common.domain.CommonPage;
import com.sandu.common.domain.ResponseVO;
import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.util.ResponseUtil;
import com.sandu.common.util.SpringContextHolder;
import com.sandu.ximon.admin.dto.DeviceStatus;
import com.sandu.ximon.admin.param.PoleBindParam;
import com.sandu.ximon.admin.param.PoleBindingParam;
@@ -23,6 +25,7 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.sql.Wrapper;
import java.util.List;
/**
@@ -118,9 +121,15 @@
    public ResponseVO<Object> bindPole(@PathVariable Long poleId, @RequestBody @Validated PoleBindingParam param) {
        boolean result = poleService.bindPole(poleId, param);
        if (result) {
            //设备类型,0路灯,1led屏幕,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助
            //设备类型,0路灯,1nove,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助, 10熙讯
            switch (param.getDeviceType()) {
                case 0:
                    Pole pole = poleService.getById(poleId);
                    if (pole != null) {
                        pole.setPoleName(param.getDeviceName());
                        pole.setDeviceCode(param.getDeviceCode());
                        poleService.updateById(pole);
                    }
                    break;
                case 1:
                    break;
@@ -142,6 +151,8 @@
                    break;
                case 9:
                    break;
                case 10:
                    break;
                default:
                    break;
            }
@@ -156,12 +167,18 @@
     * 灯杆绑定设备
     */
    @PostMapping("/unBind/{poleId}")
    public ResponseVO<Object> unBindPole(@PathVariable Long poleId, @RequestBody @Validated PoleBindingParam param) {
    public ResponseVO<Object> unBindPole(@PathVariable Long poleId, @RequestBody PoleBindingParam param) {
        boolean result = poleService.unBindPole(poleId, param.getDeviceCode());
        if (result) {
            //设备类型,0路灯,1led屏幕,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助
            //设备类型,0路灯,1led屏幕,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助, 10熙讯
            switch (param.getDeviceType()) {
                case 0:
                    //删除灯杆的devicescode
                    Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId));
                    if (pole != null) {
                        pole.setDeviceCode(null);
                        poleService.updateById(pole);
                    }
                    break;
                case 1:
                    break;
@@ -183,6 +200,8 @@
                    break;
                case 9:
                    break;
                case 10:
                    break;
                default:
                    break;
            }