2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-02-28 d877cf557db5452093087fabb4479a10497ee218
ximon-admin/src/main/java/com/sandu/ximon/admin/service/VnnoxService.java
@@ -1,5 +1,6 @@
package com.sandu.ximon.admin.service;
import com.sandu.common.execption.BusinessException;
import com.sandu.ximon.admin.config.VnnoxConstant;
import com.sandu.ximon.admin.utils.RedisUtils;
import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
@@ -13,6 +14,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -42,7 +44,7 @@
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public LedV2RegisterResultEntity validateSN(String sn) {
    public LedV2RegisterResultEntity validateSN(String name,String sn) throws URISyntaxException {
        LedV2RegisterResultEntity ledV2RegisterResultEntity = new LedV2RegisterResultEntity();
        //  判断数据库是否存在,若不存在,判断是否已经注册到Vnnox服务器
@@ -56,16 +58,16 @@
        }
        Integer page = 0;
        Integer limit = 200;
        Integer limit = 100;
        List<VnnoxPlayerResponse> playerList;
        //  获取Vnnox服务器列表
        VnnoxPlayerListResponse response = vnnoxAPIUtil.getPlayerList(limit, page);
        VnnoxPlayerListResponse response = vnnoxAPIUtil.getPlayerList(limit, page,name);
        playerList = response.getRows();
        Integer total = response.getTotal() - limit;
        while (total > 0) {
            page = page + 1;
            total = total - limit;
            response = vnnoxAPIUtil.getPlayerList(limit, page);
            response = vnnoxAPIUtil.getPlayerList(limit, page,name);
            playerList.addAll(response.getRows());
        }
        ledPlayerEntity = new LedPlayerEntity();
@@ -189,4 +191,16 @@
        );
    }
    public boolean updateDataName(Long  id, String name){
        LedPlayerEntity byId = ledPlayerEntityService.getById(id);
        if(byId==null){
            throw new BusinessException("未找到该设备");
        }
        LedPlayerEntity led=new LedPlayerEntity();
        led.setId(id);
        led.setName(name);
        return ledPlayerEntityService.updateById(led);
    }
}