| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.VnnoxAPIUtil; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.mapper.LedPlayerEntityMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | |
| | | private final LedPlayerEntityMapper ledPlayerEntityMapper; |
| | | private VnnoxAPIUtil vnnoxAPIUtil; |
| | | |
| | | public LedPlayerEntity getBySn(String sn){ |
| | | public LedPlayerEntity getBySn(String sn) { |
| | | return getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, sn)); |
| | | } |
| | | public LedPlayerEntity getByPlayerId(String playerId){ |
| | | return getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getPlayerId,playerId)); |
| | | |
| | | public LedPlayerEntity getByPlayerId(String playerId) { |
| | | return getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getPlayerId, playerId)); |
| | | } |
| | | |
| | | public boolean saveLed(LedPlayerEntity ledPlayerEntity){ |
| | | public boolean saveLed(LedPlayerEntity ledPlayerEntity) { |
| | | return ledPlayerEntityMapper.saveLed(ledPlayerEntity); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 诺瓦硬件设备 |
| | | */ |
| | | public LedPlayerEntity getBySnAndPlayerId(String sn){ |
| | | public LedPlayerEntity getBySnAndPlayerSn(String sn) { |
| | | LedPlayerEntity one = getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, sn)); |
| | | if(one==null){ |
| | | if (one == null) { |
| | | throw new RuntimeException("诺瓦设备不存在"); |
| | | } |
| | | List list=new ArrayList(); |
| | | List list = new ArrayList(); |
| | | list.add(one); |
| | | List<LedPlayerEntity> led = vnnoxAPIUtil.syncCurrentInfo(list); |
| | | return led.get(0); |
| | | Map<String, String> screenShotUrl = SpringContextHolder.getBean(VnnoxService.class).getScreenShotUrl(one.getId().intValue()); |
| | | if (screenShotUrl.get("code").equals("200")) { |
| | | one.setScreenShotUrl(screenShotUrl.get("url")); |
| | | } else { |
| | | one.setScreenShotUrl("缩略图获取失败"); |
| | | } |
| | | return one; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public List<LedPlayerEntity> ledPlayerEntityList(BaseConditionVO baseConditionVO, String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<LedPlayerEntity> list; |
| | | //超管 |
| | | if (SecurityUtils.getClientId() == null) { |
| | | list = ledPlayerEntityMapper.ledPlayerEntityList(keyword, null); |
| | | } else { |
| | | list = ledPlayerEntityMapper.ledPlayerEntityList(keyword, SecurityUtils.getUserId()); |
| | | } |
| | | return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list)); |
| | | } |
| | | |
| | | } |