| | |
| | | package com.sandu.ximon.admin.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import com.sandu.ximon.admin.config.VnnoxUrl; |
| | | import com.sandu.ximon.admin.service.LedPlayerEntityService; |
| | | import com.sandu.ximon.admin.utils.request.*; |
| | | import com.sandu.ximon.admin.utils.response.*; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.net.URISyntaxException; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Component("VnnoxAPIUtil") |
| | | @AllArgsConstructor |
| | |
| | | return response.getData(); |
| | | } |
| | | |
| | | |
| | | public List<LedPlayerEntity> saveCurrentInfo(List<LedPlayerEntity> list) { |
| | | List<String> playerIds = new ArrayList<>(); |
| | | if (list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | for (LedPlayerEntity playerEntity : list) { |
| | | playerIds.add(playerEntity.getPlayerId()); |
| | | } |
| | | |
| | | VnnoxSyncCurrentInfoRequest vnnoxSyncCurrentInfoRequest = new VnnoxSyncCurrentInfoRequest(); |
| | | vnnoxSyncCurrentInfoRequest.setPlayerIds(playerIds); |
| | | |
| | | String result = VnnoxRequestUtil.PostWithHeader( |
| | | VnnoxUrl.getUrl(VnnoxUrl.SYNC_CURRENT_INFO), |
| | | vnnoxSyncCurrentInfoRequest.toJson(), |
| | | new CommonHeader(CommonHeader.JSON, true) |
| | | ); |
| | | |
| | | VnnoxSyncCurrentInfoResponse response = JSON.parseObject(result, VnnoxSyncCurrentInfoResponse.class); |
| | | |
| | | for (LedPlayerEntity playerEntity : list) { |
| | | for (VnnoxPlayerInfoResponse res : response.getData()) { |
| | | if (res.getPlayerId().equals(playerEntity.getPlayerId())) { |
| | | playerEntity.setResolution(res.getWidth() + " * " + res.getHeight()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | } |