2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-04-22 2dd5433edfc33ac48ffd31455820883c305a6ab8
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -57,11 +57,13 @@
    private final PoleBindingService poleBindingService;
    private final PoleGroupRelationService groupRelationService;
    private final ClientService clientService;
    private final PoleMapper poleMapper;
    public boolean addPole(PoleParam param) {
        Pole pole = new Pole();
        BeanUtils.copyProperties(param, pole);
        pole.setPoleCode(generatePoleCode());
        pole.setDeviceType(-1);
        return save(pole);
    }
@@ -819,9 +821,12 @@
    public Pole getPoleByMac(Long poleId) {
        Pole one = getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId));
        ArrayList<String> macs = new ArrayList<>();
        macs.add(one.getDeviceCode());
        List<DeviceStatus> deviceStatuses = listStatusByDeviceCode(macs);
        if (deviceStatuses.get(0).getStatus() == 0) {
        if (one.getDeviceCode() == null || one.getDeviceType() == null || one.getDeviceType() == -1) {
            one.setOnLineState("虚拟灯杆");
        } else if (deviceStatuses.get(0).getStatus() == 0) {
            one.setOnLineState("离线");
        } else if (deviceStatuses.get(0).getStatus() == 1) {
            one.setOnLineState("在线");
@@ -845,4 +850,9 @@
//        return energy;
//    }
   public boolean updateDeviceCode(Long poleId){
       return poleMapper.updateDeviceCode(poleId);
    }
}