2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-05-10 120fdb31f376deaf55001286bdeef26d268eeab2
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -19,12 +19,15 @@
import com.sandu.ximon.admin.service.IpVolumeService;
import com.sandu.ximon.admin.service.MonitorService;
import com.sandu.ximon.admin.service.PoleService;
import com.sandu.ximon.admin.vo.PoleBindVO;
import com.sandu.ximon.dao.domain.Pole;
import com.sandu.ximon.dao.enums.MenuEnum;
import com.sandu.ximon.dao.enums.PoleBindingEnums;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@@ -67,6 +70,31 @@
        return ResponseUtil.success(poleService.deletePole(poleId));
    }
    @PostMapping("/listDetail")
    public ResponseVO<Object> listPoleDetail(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) {
        if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        List<Pole> results = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param);
        List<PoleBindVO> listResult = new ArrayList<>();
        for (Pole pole : results) {
            PoleBindVO bindByPoleId = poleService.getBindByPoleId(pole.getId());
            bindByPoleId.setPole(pole);
            listResult.add(bindByPoleId);
        }
        CommonPage commonPage = CommonPage.restPage(listResult);
        int size = results.size();
        commonPage.setTotal((long) size);
        commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1);
        if (size % baseConditionVO.getPageSize() == 0) {
            commonPage.setTotalPage(size / baseConditionVO.getPageSize());
        }
        return ResponseUtil.success(commonPage);
    }
    @PostMapping("/list")
    public ResponseVO<Object> listPole(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) {
        if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) {
@@ -74,6 +102,7 @@
        }
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        List<Pole> results = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param);
        CommonPage commonPage = CommonPage.restPage(results);
        int size = results.size();
        commonPage.setTotal((long) size);
@@ -82,7 +111,6 @@
            commonPage.setTotalPage(size / baseConditionVO.getPageSize());
        }
        return ResponseUtil.success(commonPage);
        // return ResponseUtil.success(poles);
    }
    @GetMapping("/listPoleAndState")
@@ -141,8 +169,8 @@
        boolean result = poleService.bindPole(poleId, param);
        if (result) {
            //设备类型,0路灯,1nove,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助, 10熙讯, 11农耕
            switch (param.getDeviceType()) {
                case 0:
            switch (param.getDeviceType().toString()) {
                case PoleBindingEnums.LIGHT:
                    Pole pole = poleService.getById(poleId);
                    if (pole != null) {
                        pole.setPoleName(param.getDeviceName());
@@ -150,29 +178,29 @@
                        poleService.updateById(pole);
                    }
                    break;
                case 1:
                case PoleBindingEnums.VONNOX:
                    break;
                case 2:
                case PoleBindingEnums.CHARGING_PILE:
                    break;
                case 3:
                case PoleBindingEnums.ATMOSPHERIC:
                    break;
                case 4:
                case PoleBindingEnums.WATER:
                    break;
                case 5:
                case PoleBindingEnums.IPVOLUME:
                    broadcastTerminalV2Service.updateBingdingState(true, Integer.valueOf(param.getDeviceCode()).intValue());
                    break;
                case 6:
                case PoleBindingEnums.LCD_ADVERTISING:
                    break;
                case 7:
                case PoleBindingEnums.MONITOR:
                    monitorService.updateBingdingState(true, param.getDeviceCode());
                    break;
                case 8:
                case PoleBindingEnums.LIGHTPOLEHEELING:
                    break;
                case 9:
                case PoleBindingEnums.FOR_HELP:
                    break;
                case 10:
                case PoleBindingEnums.XIXUN:
                    break;
                case 11:
                case PoleBindingEnums.ATMOSPHERIC_NONG_GENG:
                    break;
                default:
                    break;
@@ -195,37 +223,37 @@
        boolean result = poleService.unBindPole(poleId, param.getDeviceCode());
        if (result) {
            //设备类型,0路灯,1led屏幕,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助, 10熙讯, 11农耕
            switch (param.getDeviceType()) {
                case 0:
            switch (param.getDeviceType().toString()) {
                case PoleBindingEnums.LIGHT:
                    //删除灯杆的devicescode
                    Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId));
                    if (pole != null) {
                        poleService.updateDeviceCode(pole.getId());
                    }
                    break;
                case 1:
                case PoleBindingEnums.VONNOX:
                    break;
                case 2:
                case PoleBindingEnums.CHARGING_PILE:
                    break;
                case 3:
                case PoleBindingEnums.ATMOSPHERIC:
                    break;
                case 4:
                case PoleBindingEnums.WATER:
                    break;
                case 5:
                case PoleBindingEnums.IPVOLUME:
                    broadcastTerminalV2Service.updateBingdingState(false, Integer.valueOf(param.getDeviceCode()).intValue());
                    break;
                case 6:
                case PoleBindingEnums.LCD_ADVERTISING:
                    break;
                case 7:
                case PoleBindingEnums.MONITOR:
                    monitorService.updateBingdingState(false, param.getDeviceCode());
                    break;
                case 8:
                case PoleBindingEnums.LIGHTPOLEHEELING:
                    break;
                case 9:
                case PoleBindingEnums.FOR_HELP:
                    break;
                case 10:
                case PoleBindingEnums.XIXUN:
                    break;
                case 11:
                case PoleBindingEnums.ATMOSPHERIC_NONG_GENG:
                    break;
                default:
                    break;