2021与蓝度共同重构项目,服务端
liuhaonan
2022-04-13 3f65fcaa359cadeffa9cec2c757ab879d0aad739
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/VnnoxController.java
@@ -9,11 +9,14 @@
import com.sandu.ximon.admin.param.VnnoxParam;
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.service.LedPlayerEntityService;
import com.sandu.ximon.admin.service.PoleBindingService;
import com.sandu.ximon.admin.service.PoleService;
import com.sandu.ximon.admin.service.VnnoxService;
import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
import com.sandu.ximon.admin.utils.response.VnnoxResult;
import com.sandu.ximon.dao.domain.LedPlayerEntity;
import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity;
import com.sandu.ximon.dao.domain.PoleBinding;
import com.sandu.ximon.dao.enums.AdministratorEnums;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -40,6 +43,10 @@
    private LedPlayerEntityService ledPlayerEntityService;
    @Autowired
    private VnnoxAPIUtil vnnoxAPIUtil;
    @Autowired
    private PoleBindingService bindingService;
    @Autowired
    private PoleService poleService;
    /**
     * 截屏
@@ -129,7 +136,6 @@
    public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        LambdaQueryWrapper<LedPlayerEntity> wrapper = Wrappers.lambdaQuery(LedPlayerEntity.class);
        if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
            //wrapper.eq(LedPlayerEntity::get)
            return ResponseUtil.success(""); //  todo
@@ -142,6 +148,16 @@
                    );
            List<LedPlayerEntity> list = ledPlayerEntityService.list(wrapper);
            List<LedPlayerEntity> entities = vnnoxService.setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
            entities.forEach(
                    led -> {
                        PoleBinding binding = bindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class)
                                .eq(PoleBinding::getDeviceType, 1).eq(PoleBinding::getDeviceCode, led.getSn()));
                        if (binding != null) {
                            led.setPoleId(poleService.getById(binding.getPoleId()).getId());
                            led.setPoleName(poleService.getById(binding.getPoleId()).getPoleName());
                        }
                    }
            );
            return ResponseUtil.success(entities);
        }
    }
@@ -168,4 +184,9 @@
            return ResponseUtil.success(online);
        }
    }
    @GetMapping("/getVnnoxInfo/{sn}")
    public ResponseVO<Object> getBySnAndPlayerId(@PathVariable String sn) {
        return ResponseUtil.success(ledPlayerEntityService.getBySnAndPlayerId(sn));
    }
}