已修改18个文件
已添加34个文件
已删除4个文件
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * ä¸ä¼ 人id |
| | | */ |
| | | private Long userId; |
| | |
| | | /** |
| | | * æä»¶å¤§å° |
| | | */ |
| | | private Double fileSize; |
| | | private String fileSize; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String fileBase64; |
| | | private String fileUrl; |
| | | |
| | | /** |
| | | * |
| | |
| | | /** |
| | | * æä»¶å¤§å° |
| | | */ |
| | | private Double fileSize; |
| | | private String fileSize; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private String fileBase64; |
| | | private String fileUrl; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.beans.Transient; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | * @TableName led |
| | | */ |
| | | @Data |
| | | @TableName(value = "led") |
| | | public class LedPlayerEntity implements Serializable { |
| | | /** |
| | | * ææ¾å¨ID |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * ææ¾å¨åç§°(server) |
| | | */ |
| | | private String playerName; |
| | | |
| | | /** |
| | | * ææ¾å¨ID(Vnnox) |
| | | */ |
| | | private String playerId; |
| | | |
| | | /** |
| | | * ææ¾å¨å¯ä¸æ è¯,å¦æä¸ºnull代表没æç»å®ææ¾å¨(Vnnox) |
| | | */ |
| | | private String sn; |
| | | |
| | | /** |
| | | * å建æ¶é´æ³ |
| | | */ |
| | | private Long createTimestamp; |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | @TableField(exist = false) |
| | | private Long streetlightId; |
| | | // playeré
置信æ¯(é³éãå±å¹å¼å
³ç¶æãæ¨éçèç®ID) |
| | | @TableField(exist = false) |
| | | private LedPlayerInfoEntity playerInfo; |
| | | // ææ¾å¨ç±»å, 1-åæ¥ææ¾å¨ï¼2-弿¥ææ¾å¨(Vnnox) |
| | | @TableField(exist = false) |
| | | private Integer playerType; |
| | | // ææ¾å¨å½åå¨çº¿ç¶æï¼0-离线ï¼1-å¨çº¿(Vnnox) |
| | | @TableField(exist = false) |
| | | private Integer onlineStatus; |
| | | // ææ¾å¨å½åçæ¬å· |
| | | @TableField(exist = false) |
| | | private String version; |
| | | // ææ¾å¨å½åç³»ç»çæ¬å· |
| | | @TableField(exist = false) |
| | | private String osVersion; |
| | | // ææ¾å¨æåå¿è·³æ¶é´(new)(Vnnox) |
| | | @TableField(exist = false) |
| | | private String lastOnlineTime; |
| | | // IPå°å(Vnnox) |
| | | @TableField(exist = false) |
| | | private String ip; |
| | | // ææ¾å¨å°ºå¯¸å®½åº¦ |
| | | @TableField(exist = false) |
| | | private Integer width; |
| | | // ææ¾å¨å°ºå¯¸é«åº¦ |
| | | @TableField(exist = false) |
| | | private Integer height; |
| | | // å±å¹ç¼©ç¥å¾URL |
| | | @TableField(exist = false) |
| | | private String screenShotUrl; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * led设å¤è°æ´ä¿¡æ¯ |
| | | */ |
| | | @Data |
| | | public class LedPlayerInfoEntity { |
| | | |
| | | // 0:é»å± 1:äº®å± |
| | | private Integer screenStatus; |
| | | // å±å¹é³é |
| | | private Integer vol; |
| | | // å±å¹äº®åº¦ |
| | | private Integer brightness; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 夿ledæ¯å¦æ³¨å |
| | | */ |
| | | @Data |
| | | public class LedV2RegisterResultEntity { |
| | | |
| | | // æ¯å¦æ³¨å |
| | | private Integer register; |
| | | // ç»ææç¤º |
| | | private String msg; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @Entity com.sandu.ximon.dao.domain.LedPlayerEntity |
| | | */ |
| | | @Mapper |
| | | public interface LedPlayerEntityMapper extends BaseMapper<LedPlayerEntity> { |
| | | |
| | | boolean saveLed(LedPlayerEntity ledPlayerEntity); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.AdvisementPlayerFile"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <result property="userId" column="user_id" jdbcType="BIGINT"/> |
| | | <result property="userName" column="user_name" jdbcType="VARCHAR"/> |
| | | <result property="clientId" column="client_id" jdbcType="BIGINT"/> |
| | | <result property="fileName" column="file_name" jdbcType="VARCHAR"/> |
| | | <result property="fileSize" column="file_size" jdbcType="DOUBLE"/> |
| | | <result property="fileBase64" column="file_base64" jdbcType="VARCHAR"/> |
| | | <result property="fileSize" column="file_size" jdbcType="VARCHAR"/> |
| | | <result property="fileUrl" column="file_url" jdbcType="VARCHAR"/> |
| | | <result property="fileType" column="file_type" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,user_id,user_name, |
| | | client_id,file_name,file_size, |
| | | file_base64,file_type,create_time |
| | | id,name,user_id, |
| | | user_name,client_id,file_name, |
| | | file_size,file_url,file_type, |
| | | create_time |
| | | </sql> |
| | | </mapper> |
| | |
| | | <result property="userName" column="user_name" jdbcType="VARCHAR"/> |
| | | <result property="clientId" column="client_id" jdbcType="BIGINT"/> |
| | | <result property="fileName" column="file_name" jdbcType="VARCHAR"/> |
| | | <result property="fileSize" column="file_size" jdbcType="DOUBLE"/> |
| | | <result property="fileBase64" column="file_base64" jdbcType="VARCHAR"/> |
| | | <result property="fileSize" column="file_size" jdbcType="VARCHAR"/> |
| | | <result property="fileUrl" column="file_url" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,user_id,user_name, |
| | | client_id,file_name,file_size, |
| | | file_base64,create_time |
| | | file_url,create_time |
| | | </sql> |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.sandu.ximon.dao.mapper.LedPlayerEntityMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LedPlayerEntity"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="playerName" column="player_name" jdbcType="VARCHAR"/> |
| | | <result property="playerId" column="player_id" jdbcType="VARCHAR"/> |
| | | <result property="sn" column="sn" jdbcType="VARCHAR"/> |
| | | <result property="createTimestamp" column="create_timestamp" jdbcType="BIGINT"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,player_name,player_id, |
| | | sn,create_timestamp |
| | | </sql> |
| | | <insert id="saveLed" parameterType="com.sandu.ximon.dao.domain.LedPlayerEntity"> |
| | | insert into led (player_name,player_id,sn,create_timestamp) values (#{playerName},#{playerId},#{sn},#{createTimestamp}) |
| | | </insert> |
| | | </mapper> |
| | |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.scheduling.annotation.EnableAsync; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | @SpringBootApplication(scanBasePackages = {"com.sandu.ximon.admin","com.sandu.common","com.sandu.ximon.dao"}) |
| | | public class AdminApplication { |
| | |
| | | package com.sandu.ximon.admin.config; |
| | | |
| | | import com.sandu.common.config.BaseRedisConfig; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.core.*; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | | /** |
| | | * @author chenjiantian |
| | |
| | | */ |
| | | @Configuration |
| | | public class RedisConfig extends BaseRedisConfig { |
| | | @Autowired |
| | | private RedisConnectionFactory factory; |
| | | |
| | | @Bean |
| | | public RedisTemplate<String, Object> redisTemplate() { |
| | | RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>(); |
| | | redisTemplate.setKeySerializer(new StringRedisSerializer()); |
| | | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); |
| | | redisTemplate.setHashValueSerializer(new StringRedisSerializer()); |
| | | redisTemplate.setValueSerializer(new StringRedisSerializer()); |
| | | redisTemplate.setConnectionFactory(factory); |
| | | return redisTemplate; |
| | | } |
| | | |
| | | @Bean |
| | | public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForHash(); |
| | | } |
| | | |
| | | @Bean |
| | | public ValueOperations<String, String> valueOperations(RedisTemplate<String, String> redisTemplate) { |
| | | return redisTemplate.opsForValue(); |
| | | } |
| | | |
| | | @Bean |
| | | public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForList(); |
| | | } |
| | | |
| | | @Bean |
| | | public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForSet(); |
| | | } |
| | | |
| | | @Bean |
| | | public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) { |
| | | return redisTemplate.opsForZSet(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.config; |
| | | |
| | | import com.google.gson.Gson; |
| | | |
| | | public class VnnoxConstant { |
| | | |
| | | // VNNOX MINIO save bucket suffix(companyId) |
| | | public static final String MINIO_PREFIX = "vnnox."; |
| | | |
| | | public static final String REDIS_TOKEN_NAME = "vnnox_token"; |
| | | public static final String REDIS_SCREEN_STATUS = "vnnox_screen_status:"; |
| | | public static final String REDIS_VOL = "vnnox_vol:"; |
| | | public static final String REDIS_BRIGHTNESS = "vnnox_brightness:"; |
| | | public static final String REDIS_PROGRESS = "vnnox_progress:"; |
| | | public static final String REDIS_SCREEN_SHOT = "vnnox_screen_shot:"; |
| | | |
| | | public static final Long REDIS_MAX_SAVE_TIME = 180 * 24 * 60 * 60L; |
| | | public static final Long SCREEN_SHOT_TIMEOUT = 30 * 60L; |
| | | |
| | | public static final String NOTIFY_URL = "http://47.106.172.9:8888/machine-fast/serv/vnnox/progress"; |
| | | public static final String SCREEN_SHOT_NOTIFY_URL = "http://47.106.172.9:8888/machine-fast/serv/vnnox/screenshot"; |
| | | |
| | | public static final String username = "zhxm"; |
| | | public static final String password = "xm2512209."; |
| | | |
| | | public static final Gson GSON = new Gson(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.config; |
| | | |
| | | public class VnnoxUrl { |
| | | |
| | | private static String url = "https://openapi.vnnox.com"; |
| | | // è·åææä¿¡æ¯ |
| | | public static final String GET_TOKEN = "/v1/oauth/token"; |
| | | // è·åLEDå表 |
| | | public static String GET_PLAYER_LIST = "/v1/player/getPlayerList"; |
| | | // è·åå½åç¶æ |
| | | public static String SYNC_CURRENT_INFO = "/v1/player/get/syncCurrentInfo"; |
| | | // ä¿®æ¹å±å¹ç¶æ |
| | | public static String SCREEN_STATUS = "/v1/player/immediateControl/screenStatus"; |
| | | // ä¿®æ¹é³é |
| | | public static String CHANGE_VOL = "/v1/player/immediateControl/volume"; |
| | | // ä¿®æ¹äº®åº¦ |
| | | public static String CHANGE_BRIGHTNESS = "/v1/player/immediateControl/brightness"; |
| | | // æ®éèç® |
| | | public static String NORMAL_PROGRAM = "/v1/player/program/normal"; |
| | | // æªå¾ |
| | | public static String SCREEN_SHOT = "/v1/player/control/screenshot"; |
| | | // éå¯ |
| | | public static String REBOOT = "/v1/player/immediateControl/reboot"; |
| | | |
| | | public static String getUrl(String urlSuffix) { |
| | | return url + urlSuffix; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("v1/IpVolumeFile") |
| | | @RequestMapping("/v1/IpVolumeFile") |
| | | public class IpVolumeFileController { |
| | | |
| | | private final IpVolumeFileService ipVolumeFileService; |
| | |
| | | return ResponseUtil.success(ipVolumeFileService.addFile(fileParam)); |
| | | } |
| | | |
| | | @PostMapping("/delete/{id}") |
| | | @PostMapping("/delete/{fileId}") |
| | | public ResponseVO<Object> deleteFile(@PathVariable Long fileId){ |
| | | return ResponseUtil.success(ipVolumeFileService.deleteFile(fileId)); |
| | | } |
| | | |
| | | @PostMapping("/list}") |
| | | public ResponseVO<Object> list(@RequestBody ReceiveParam receiveParam){ |
| | | return ResponseUtil.success(ipVolumeFileService.list(ipVolumeFileService.listFile(receiveParam))); |
| | | @PostMapping("/list") |
| | | public ResponseVO<Object> list(){ |
| | | return ResponseUtil.success(ipVolumeFileService.list()); |
| | | } |
| | | } |
| | |
| | | return ResponseUtil.success(ledProgramService.addProgram(ledProgramParam)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | public ResponseVO<Object> updateLEDProgram(@RequestBody @Validated LEDProgramParam ledProgramParam) { |
| | | return ResponseUtil.success(ledProgramService.updateProgram(ledProgramParam)); |
| | | @PostMapping("/update/{pid}") |
| | | public ResponseVO<Object> updateLEDProgram(@PathVariable Long pid, @RequestBody @Validated LEDProgramParam ledProgramParam) { |
| | | return ResponseUtil.success(ledProgramService.updateProgram(pid,ledProgramParam)); |
| | | } |
| | | |
| | | @PostMapping("/delete/{id}") |
| | | public ResponseVO<Object> deleteLEDProgram(@PathVariable Long id) { |
| | | return ResponseUtil.success(ledProgramService.deleteProgram(id)); |
| | | @PostMapping("/delete/{pid}") |
| | | public ResponseVO<Object> deleteLEDProgram(@PathVariable Long pid) { |
| | | return ResponseUtil.success(ledProgramService.deleteProgram(pid)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.LEDProgramFileParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.service.LEDProgramFileService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | return ResponseUtil.success(ledProgramFileService.addProgramFile(param)); |
| | | } |
| | | |
| | | @PostMapping("/delete{fileId}") |
| | | @PostMapping("/delete/{fileId}") |
| | | public ResponseVO<Object> addLEDProgram(@PathVariable Long fileId) { |
| | | return ResponseUtil.success(ledProgramFileService.deleteFile(fileId)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> listfile() { |
| | | return ResponseUtil.success(ledProgramFileService.list(ledProgramFileService.listFile())); |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¯ææ¨¡å以å设置åç»å°å¯¹åºç¯æ |
| | | * ç¯ææ¨¡å以å设置åç»å°å¯¹åºç¯æ å¼ç¨ |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | |
| | | return ResponseUtil.success(playPlanNvService.addPlan(param)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | public ResponseVO<Object> updateLEDPlan(@RequestBody @Validated Long planId, PlayPlanParam param) { |
| | | @PostMapping("/update/{planId}") |
| | | public ResponseVO<Object> updateLEDPlan(@PathVariable Long planId,@RequestBody @Validated PlayPlanParam param) { |
| | | return ResponseUtil.success(playPlanNvService.updatePlan(planId, param)); |
| | | } |
| | | |
| | |
| | | return ResponseUtil.success(playPlanNvService.deletePlan(plianId)); |
| | | } |
| | | |
| | | @PostMapping("/push{plianId}") |
| | | @PostMapping("/push/{plianId}") |
| | | public ResponseVO<Object> pushToLed(@PathVariable Long plianId) { |
| | | return ResponseUtil.success(playPlanNvService.pushToLed(plianId)); |
| | | } |
| | | @GetMapping("/listPaln") |
| | | public ResponseVO<Object> list() { |
| | | return ResponseUtil.success(playPlanNvService.list()); |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 设置ä¸å
ç |
| | | */ |
| | | @PostMapping("/setMac") |
| | | @PostMapping("/setMac/{poleId}") |
| | | public ResponseVO<Object> setMac(@PathVariable Long poleId) { |
| | | return ResponseUtil.success(poleService.setMac(poleId)); |
| | | } |
| | |
| | | /** |
| | | * æ¢å¤ç¯æåºå设置 |
| | | */ |
| | | @PostMapping("/poleReset") |
| | | @PostMapping("/poleReset/{poleId}") |
| | | public ResponseVO<Object> poleReset(@PathVariable Long poleId) { |
| | | return ResponseUtil.success(poleService.poleReset(poleId)); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | 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.VnnoxService; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResult; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | | import com.sandu.ximon.dao.enums.AdministratorEnums; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | | * @Date 2021/12/23 9:35 |
| | | * @Version 1.0 |
| | | * 诺ç¦LEDå¤ç |
| | | */ |
| | | @RestController |
| | | //@AllArgsConstructor |
| | | @RequestMapping("/v1/Vnnox") |
| | | public class VnnoxController { |
| | | |
| | | @Autowired |
| | | private VnnoxService vnnoxService; |
| | | @Autowired |
| | | private LedPlayerEntityService ledPlayerEntityService; |
| | | |
| | | @GetMapping("/screenShot") |
| | | public ResponseVO<Object> screenShot(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | Map<String, String> map = vnnoxService.getScreenShotUrl(vnnoxWebRequest.getId()); |
| | | return ResponseUtil.success(map.get("url")); |
| | | } |
| | | |
| | | @GetMapping("/reboot") |
| | | public ResponseVO<Object> reboot(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | VnnoxResult vnnoxResult = vnnoxService.reboot(vnnoxWebRequest.getPlayerList()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | } |
| | | |
| | | @GetMapping("/screenStatusChange") |
| | | public ResponseVO<Object> screenStatusChange(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | VnnoxResult vnnoxResult = vnnoxService.screenStatusChange(vnnoxWebRequest.getPlayerList(),vnnoxWebRequest.getScreenStatus()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | } |
| | | |
| | | @GetMapping("/volChange") |
| | | public ResponseVO<Object> volChange(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | VnnoxResult vnnoxResult = vnnoxService.volChange(vnnoxWebRequest.getPlayerList(),vnnoxWebRequest.getVol()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | } |
| | | |
| | | @GetMapping("/brightnessChange") |
| | | public ResponseVO<Object> brightnessChange(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | VnnoxResult vnnoxResult = vnnoxService.brightnessChange(vnnoxWebRequest.getPlayerList(),vnnoxWebRequest.getBrightness()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | } |
| | | |
| | | /* @RequestMapping("/changeLedName") |
| | | public R changeLedName(@RequestBody VnnoxParam vnnoxWebRequest) { |
| | | vnnoxService.changeLedName(vnnoxWebRequest.getId(),vnnoxWebRequest.getPlayerName()); |
| | | return ResponseUtil.success(); |
| | | }*/ |
| | | |
| | | @PostMapping("/validateSN") |
| | | public ResponseVO<Object> validateSN(@RequestBody Map map) { |
| | | String sn = (String)map.get("sn"); |
| | | LedV2RegisterResultEntity ledV2RegisterResultEntity = vnnoxService.validateSN(sn); |
| | | return ResponseUtil.success(ledV2RegisterResultEntity); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> list() { |
| | | if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | return ResponseUtil.success(""); |
| | | }else { |
| | | return ResponseUtil.success(ledPlayerEntityService.list()); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | public class IpVolumeFileParam { |
| | | |
| | | private String fileName; |
| | | private Double fileSize; |
| | | private String fileBase64; |
| | | private String fileSize; |
| | | private String fileUrl; |
| | | private String fileType; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.param; |
| | | |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class VnnoxParam { |
| | | |
| | | // playerID |
| | | private Integer id; |
| | | // playerå®ä½List |
| | | private List<LedPlayerEntity> playerList; |
| | | // playerIds |
| | | private List<String> playerIds; |
| | | // å±å¹ç¶æ 0:å
³é 1:å¼å¯ |
| | | private Integer screenStatus; |
| | | // å±å¹é³é |
| | | private Integer vol; |
| | | // å±å¹äº®åº¦ |
| | | private Integer brightness; |
| | | // æä»¶ID |
| | | private Integer fileId; |
| | | // ç¯æID |
| | | private Long streetlightId; |
| | | |
| | | private String playerName; |
| | | |
| | | private String content; |
| | | |
| | | // èç®é¨å |
| | | private Integer pid; |
| | | |
| | | } |
| | |
| | | public boolean addFile(IpVolumeFileParam fileParam) { |
| | | AdvisementPlayerFile file = new AdvisementPlayerFile(); |
| | | file.setUserId(SecurityUtils.getClientId()); |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | file.setUserName(SecurityUtils.getUsername()); |
| | | } |
| | | if(clientService.getClientId()!=null){ |
| | | file.setClientId(clientService.getClientId()); |
| | | } |
| | | file.setFileName(fileParam.getFileName()); |
| | | file.setFileSize(fileParam.getFileSize()); |
| | | file.setFileBase64(fileParam.getFileBase64()); |
| | | file.setFileUrl(fileParam.getFileUrl()); |
| | | return save(file); |
| | | } |
| | | |
| | |
| | | public Long getClientId(){ |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Client one = getOne(Wrappers.lambdaQuery(Client.class).eq(Client::getId, userId)); |
| | | if(one.getSuperiorId()!=null){ |
| | | if(one!=null&&one.getSuperiorId()!=null){ |
| | | return one.getSuperiorId(); |
| | | }else { |
| | | return userId; |
| | |
| | | public boolean addFile(IpVolumeFileParam fileParam) { |
| | | IpVolumeFile file = new IpVolumeFile(); |
| | | file.setUserId(SecurityUtils.getClientId()); |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | file.setUserName(SecurityUtils.getUsername()); |
| | | } |
| | | |
| | | if(clientService.getClientId()!=null){ |
| | | file.setClientId(clientService.getClientId()); |
| | | } |
| | | file.setFileName(fileParam.getFileName()); |
| | | file.setFileSize(fileParam.getFileSize()); |
| | | file.setFileBase64(fileParam.getFileBase64()); |
| | | file.setFileUrl(fileParam.getFileUrl()); |
| | | return save(file); |
| | | } |
| | | |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.LEDProgramFileParam; |
| | |
| | | return removeById(id); |
| | | } |
| | | |
| | | public LambdaQueryWrapper<LEDProgramFile> listFile(){ |
| | | LambdaQueryWrapper<LEDProgramFile> ledProgramFileLambdaQueryWrapper = Wrappers.lambdaQuery(LEDProgramFile.class); |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | |
| | | return ledProgramFileLambdaQueryWrapper.eq(LEDProgramFile::getUserId,SecurityUtils.getUserId()); |
| | | }else { |
| | | return ledProgramFileLambdaQueryWrapper; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public boolean updateProgram(LEDProgramParam receiveParam) { |
| | | public boolean updateProgram(Long pid,LEDProgramParam receiveParam) { |
| | | |
| | | LEDProgram byId = getById(receiveParam.getId()); |
| | | LEDProgram byId = getById(pid); |
| | | if (byId == null) { |
| | | throw new BusinessException("æªæ¾å°è¯¥èç®"); |
| | | } |
| | | |
| | | LEDProgram led = new LEDProgram(); |
| | | led.setId(receiveParam.getId()); |
| | | led.setId(pid); |
| | | //led.setUserId(SecurityUtils.getClientId()); |
| | | led.setName(receiveParam.getName()); |
| | | led.setPreview(receiveParam.getPreviewUrl()); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.mapper.LedPlayerEntityMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | | * @Date 2021/12/22 15:27 |
| | | * @Version 1.0 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class LedPlayerEntityService extends BaseServiceImpl<LedPlayerEntityMapper, LedPlayerEntity> { |
| | | private final LedPlayerEntityMapper ledPlayerEntityMapper; |
| | | |
| | | public LedPlayerEntity getBySn(String sn){ |
| | | return getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, sn)); |
| | | } |
| | | |
| | | public boolean saveLed(LedPlayerEntity ledPlayerEntity){ |
| | | return ledPlayerEntityMapper.saveLed(ledPlayerEntity); |
| | | } |
| | | |
| | | |
| | | /* public void listLed(String keyWord){ |
| | | |
| | | Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::get) |
| | | }*/ |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.VnnoxAPIUtil; |
| | | import com.sandu.ximon.admin.utils.request.VnnoxScreenStatusType; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxPlayerListResponse; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxPlayerResponse; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResult; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | | * @Date 2021/12/22 14:18 |
| | | * @Version 1.0 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class VnnoxService { |
| | | |
| | | // @Autowired |
| | | private VnnoxAPIUtil vnnoxAPIUtil; |
| | | // @Autowired |
| | | private RedisUtils redisUtils; |
| | | // @Autowired |
| | | private LedPlayerEntityService ledPlayerEntityService; |
| | | |
| | | /** |
| | | * è®¾å¤æ ¡éªæ³¨å |
| | | * |
| | | * @param sn |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public LedV2RegisterResultEntity validateSN(String sn) { |
| | | LedV2RegisterResultEntity ledV2RegisterResultEntity = new LedV2RegisterResultEntity(); |
| | | |
| | | // å¤ææ°æ®åºæ¯å¦åå¨ï¼è¥ä¸åå¨ï¼å¤ææ¯å¦å·²ç»æ³¨åå°Vnnoxæå¡å¨ |
| | | //LedPlayerEntity ledPlayerEntity = vnnoxDao.getBySN(sn); |
| | | // LambdaQueryWrapper<LedPlayerEntity> eq = Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getSn, sn); |
| | | LedPlayerEntity ledPlayerEntity = ledPlayerEntityService.getBySn(sn); |
| | | if (null != ledPlayerEntity) { |
| | | ledV2RegisterResultEntity.setRegister(1); |
| | | ledV2RegisterResultEntity.setMsg("设å¤å·²åå¨!"); |
| | | return ledV2RegisterResultEntity; |
| | | } |
| | | |
| | | Integer page = 0; |
| | | Integer limit = 200; |
| | | List<VnnoxPlayerResponse> playerList; |
| | | // è·åVnnoxæå¡å¨å表 |
| | | VnnoxPlayerListResponse response = vnnoxAPIUtil.getPlayerList(limit, page); |
| | | playerList = response.getRows(); |
| | | Integer total = response.getTotal() - limit; |
| | | while (total > 0) { |
| | | page = page + 1; |
| | | total = total - limit; |
| | | response = vnnoxAPIUtil.getPlayerList(limit, page); |
| | | playerList.addAll(response.getRows()); |
| | | } |
| | | ledPlayerEntity = new LedPlayerEntity(); |
| | | for (VnnoxPlayerResponse res : playerList) { |
| | | if (res.getSn().equals(sn)) { |
| | | ledPlayerEntity.setSn(sn); |
| | | ledPlayerEntity.setPlayerId(res.getPlayerId()); |
| | | ledPlayerEntity.setPlayerName(res.getName()); |
| | | ledPlayerEntity.setCreateTimestamp(new Date().getTime()); |
| | | ledPlayerEntityService.saveLed(ledPlayerEntity); |
| | | ledV2RegisterResultEntity.setRegister(1); |
| | | ledV2RegisterResultEntity.setMsg("è®¾å¤æ ¡éªéè¿ï¼è®¾å¤æ³¨åæå!"); |
| | | return ledV2RegisterResultEntity; |
| | | } |
| | | } |
| | | |
| | | ledV2RegisterResultEntity.setRegister(0); |
| | | ledV2RegisterResultEntity.setMsg("è®¾å¤æªæ³¨åå°å¹³å°!"); |
| | | return ledV2RegisterResultEntity; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å±å¹ç¶æè°æ´-POST-JSON |
| | | * |
| | | * @param playerList |
| | | * @param screenStatus |
| | | * @return |
| | | */ |
| | | public VnnoxResult screenStatusChange(List<LedPlayerEntity> playerList, Integer screenStatus) { |
| | | VnnoxScreenStatusType type; |
| | | if (screenStatus.equals(0)) { |
| | | type = VnnoxScreenStatusType.CLOSE; |
| | | } else { |
| | | type = VnnoxScreenStatusType.OPEN; |
| | | } |
| | | |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.screenStatus( |
| | | playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), |
| | | type |
| | | ); |
| | | // æ ¹æ®å±å¹ç¶æè°æ´REDISæ è¯ä½ |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_SCREEN_STATUS + playerId, screenStatus, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | | } |
| | | return vnnoxResult; |
| | | } |
| | | |
| | | public VnnoxResult volChange(List<LedPlayerEntity> playerList, Integer vol) { |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.volChange( |
| | | playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), |
| | | vol |
| | | ); |
| | | // æ ¹æ®é³éè°æ´REDISæ è¯ä½ |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_VOL + playerId, vol, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | | } |
| | | return vnnoxResult; |
| | | } |
| | | |
| | | public VnnoxResult brightnessChange(List<LedPlayerEntity> playerList, Integer brightness) { |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.brightnessChange( |
| | | playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), |
| | | brightness |
| | | ); |
| | | // æ ¹æ®äº®åº¦è°æ´REDISæ è¯ä½ |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_BRIGHTNESS + playerId, brightness, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | | } |
| | | return vnnoxResult; |
| | | |
| | | } |
| | | |
| | | public Map<String, String> getScreenShotUrl(Integer id) { |
| | | Map<String, String> map = new HashMap(); |
| | | |
| | | LedPlayerEntity playerEntity = ledPlayerEntityService.getById(id); |
| | | try { |
| | | redisUtils.delete(VnnoxConstant.REDIS_SCREEN_SHOT + playerEntity.getPlayerId()); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.screenShot(playerEntity.getPlayerId()); |
| | | |
| | | if (null == vnnoxResult) { |
| | | map.put("code", "500"); |
| | | map.put("msg", "设å¤å·²ä¸çº¿"); |
| | | return map; |
| | | } |
| | | |
| | | if (vnnoxResult.getSuccess().size() == 0) { |
| | | map.put("code", "500"); |
| | | map.put("msg", "è·å缩ç¥å¾å¤±è´¥!"); |
| | | return map; |
| | | } |
| | | String url = null; |
| | | Integer checkCount = 0; |
| | | while (checkCount < 10) { |
| | | url = redisUtils.get(VnnoxConstant.REDIS_SCREEN_SHOT + playerEntity.getPlayerId()); |
| | | if (null != url) { |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(2000); |
| | | checkCount = checkCount + 1; |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | map.put("url", url); |
| | | map.put("code", "200"); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | public VnnoxResult reboot(List<LedPlayerEntity> playerList) { |
| | | return vnnoxAPIUtil.reboot( |
| | | playerList.stream().map( |
| | | item -> item.getPlayerId() |
| | | ).collect(Collectors.toList()) |
| | | ); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.google.gson.Gson; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * Rediså·¥å
·ç±» |
| | | * |
| | | * @author Mark sunlightcs@gmail.com |
| | | */ |
| | | @Component("RedisUtils") |
| | | |
| | | public class RedisUtils { |
| | | @Autowired |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | @Autowired |
| | | private ValueOperations<String, String> valueOperations; |
| | | |
| | | private HashOperations<String, String, Object> hashOperations; |
| | | |
| | | private ListOperations<String, Object> listOperations; |
| | | |
| | | private SetOperations<String, Object> setOperations; |
| | | |
| | | private ZSetOperations<String, Object> zSetOperations; |
| | | /** é»è®¤è¿ææ¶é¿ï¼åä½ï¼ç§ */ |
| | | public final static long DEFAULT_EXPIRE = 60 * 60 * 24; |
| | | /** ä¸è®¾ç½®è¿ææ¶é¿ */ |
| | | public final static long NOT_EXPIRE = -1; |
| | | private final static Gson gson = new Gson(); |
| | | |
| | | /** |
| | | * |
| | | * @param key |
| | | * @param value |
| | | * @param expire ç§æ° |
| | | * @return |
| | | */ |
| | | public boolean set(String key, Object value, long expire){ |
| | | valueOperations.set(key, toJson(value)); |
| | | if(expire != NOT_EXPIRE){ |
| | | return redisTemplate.expire(key, expire, TimeUnit.SECONDS); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static RedisUtils getBean(){ |
| | | return (RedisUtils)SpringContextUtils.getBean("RedisUtils"); |
| | | } |
| | | |
| | | public boolean set(String key, Object value){ |
| | | return set(key, value, DEFAULT_EXPIRE); |
| | | } |
| | | |
| | | public <T> T get(String key, Class<T> clazz, long expire) { |
| | | String value = valueOperations.get(key); |
| | | if(expire != NOT_EXPIRE){ |
| | | redisTemplate.expire(key, expire, TimeUnit.SECONDS); |
| | | } |
| | | return value == null ? null : fromJson(value, clazz); |
| | | } |
| | | |
| | | public <T> T get(String key, Class<T> clazz) { |
| | | return get(key, clazz, NOT_EXPIRE); |
| | | } |
| | | |
| | | public String get(String key, long expire) { |
| | | String value = valueOperations.get(key); |
| | | if(expire != NOT_EXPIRE){ |
| | | redisTemplate.expire(key, expire, TimeUnit.SECONDS); |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | public String get(String key) { |
| | | return get(key, NOT_EXPIRE); |
| | | } |
| | | |
| | | public boolean delete(String key) { |
| | | return redisTemplate.delete(key); |
| | | } |
| | | |
| | | |
| | | public Set<String> allKeys(){ |
| | | return redisTemplate.keys("*"); |
| | | } |
| | | |
| | | public Set<String> keys(String str) { |
| | | return redisTemplate.keys(str); |
| | | } |
| | | |
| | | /** |
| | | * Object转æJSONæ°æ® |
| | | */ |
| | | private String toJson(Object object){ |
| | | if(object instanceof Integer || object instanceof Long || object instanceof Float || |
| | | object instanceof Double || object instanceof Boolean || object instanceof String){ |
| | | return String.valueOf(object); |
| | | } |
| | | return gson.toJson(object); |
| | | } |
| | | |
| | | /** |
| | | * JSONæ°æ®ï¼è½¬æObject |
| | | */ |
| | | private <T> T fromJson(String json, Class<T> clazz){ |
| | | return gson.fromJson(json, clazz); |
| | | } |
| | | |
| | | |
| | | public String listToJson(List list) { |
| | | return JSON.toJSONString(list); |
| | | } |
| | | |
| | | public List jsonToList(String json, Class clazz){ |
| | | if(json.length() == 0) { |
| | | return null; |
| | | } |
| | | JSONArray jsonArray = JSON.parseArray(json); |
| | | return jsonArray.toJavaList(clazz); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils; |
| | | |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class SpringContextUtil implements ApplicationContextAware { |
| | | /** |
| | | * ä¸ä¸æå¯¹è±¡å®ä¾ |
| | | */ |
| | | private static ApplicationContext applicationContext; |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | SpringContextUtil.applicationContext = applicationContext; |
| | | } |
| | | |
| | | /** |
| | | * è·åapplicationContext |
| | | * |
| | | * @return |
| | | */ |
| | | public static ApplicationContext getApplicationContext() { |
| | | return applicationContext; |
| | | } |
| | | |
| | | /** |
| | | * éè¿nameè·å Bean. |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public static Object getBean(String name) { |
| | | return getApplicationContext().getBean(name); |
| | | } |
| | | |
| | | /** |
| | | * éè¿classè·åBean. |
| | | * |
| | | * @param clazz |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> T getBean(Class<T> clazz) { |
| | | return getApplicationContext().getBean(clazz); |
| | | } |
| | | |
| | | /** |
| | | * éè¿name,以åClazzè¿åæå®çBean |
| | | * |
| | | * @param name |
| | | * @param clazz |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> T getBean(String name, Class<T> clazz) { |
| | | return getApplicationContext().getBean(name, clazz); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils; |
| | | |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * Spring Context å·¥å
·ç±» |
| | | * |
| | | * @author Mark sunlightcs@gmail.com |
| | | */ |
| | | @Component |
| | | public class SpringContextUtils implements ApplicationContextAware { |
| | | public static ApplicationContext applicationContext; |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) |
| | | throws BeansException { |
| | | SpringContextUtils.applicationContext = applicationContext; |
| | | } |
| | | |
| | | public static Object getBean(String name) { |
| | | return applicationContext.getBean(name); |
| | | } |
| | | |
| | | public static <T> T getBean(String name, Class<T> requiredType) { |
| | | return applicationContext.getBean(name, requiredType); |
| | | } |
| | | |
| | | public static boolean containsBean(String name) { |
| | | return applicationContext.containsBean(name); |
| | | } |
| | | |
| | | public static boolean isSingleton(String name) { |
| | | return applicationContext.isSingleton(name); |
| | | } |
| | | |
| | | public static Class<? extends Object> getType(String name) { |
| | | return applicationContext.getType(name); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import com.sandu.ximon.admin.config.VnnoxUrl; |
| | | import com.sandu.ximon.admin.utils.request.*; |
| | | import com.sandu.ximon.admin.utils.response.*; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Component("VnnoxAPIUtil") |
| | | @AllArgsConstructor |
| | | public class VnnoxAPIUtil { |
| | | |
| | | //@Autowired |
| | | private RedisUtils redisUtils; |
| | | |
| | | public static VnnoxAPIUtil getBean() { |
| | | return (VnnoxAPIUtil) SpringContextUtil.getBean("VnnoxAPIUtil"); |
| | | } |
| | | |
| | | /** |
| | | * è·åtoken |
| | | */ |
| | | public void getToken () { |
| | | String result = VnnoxRequestUtil.PostWithHeader( |
| | | VnnoxUrl.getUrl(VnnoxUrl.GET_TOKEN), |
| | | new VnnoxGetTokenRequest().toJson(), |
| | | new CommonHeader(CommonHeader.FORM, false) |
| | | ); |
| | | |
| | | CommonResponse commonResponse = JSON.parseObject(result,CommonResponse.class); |
| | | VnnoxGetTokenResponse response = new VnnoxGetTokenResponse().parse(commonResponse); |
| | | // å°tokenä¿åå°redisç¼åä¸ |
| | | redisUtils.set(VnnoxConstant.REDIS_TOKEN_NAME,response.getToken(),(long)(response.getExpire()-30)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åææ¾å¨å表 |
| | | * |
| | | * @param count æ¯æ¬¡è¯»åæ°éï¼é»è®¤20ï¼åå¼èå´ï¼1~100 |
| | | * @param start ä»ç¬¬å æ¡è®°å½å¼å§è¯»åï¼é»è®¤0 |
| | | * @return |
| | | */ |
| | | public VnnoxPlayerListResponse getPlayerList(Integer count, Integer start) { |
| | | |
| | | String result = VnnoxRequestUtil.GetWithHeader( |
| | | VnnoxUrl.getUrl(VnnoxUrl.GET_PLAYER_LIST), |
| | | new VnnoxGetPlayerListRequest(count, start).toJson(), |
| | | new CommonHeader(CommonHeader.JSON, true) |
| | | ); |
| | | VnnoxPlayerListResponse response = |
| | | new VnnoxPlayerListResponse().parse(JSON.parseObject(result, CommonResponse.class)); |
| | | return response; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åå±å¹ä¿¡æ¯-POST-JSON |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public List<LedPlayerEntity> syncCurrentInfo(List<LedPlayerEntity> list) { |
| | | List<String> playerIds = new ArrayList<>(); |
| | | |
| | | 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.setPlayerType(res.getPlayerType()); |
| | | playerEntity.setOnlineStatus(res.getOnlineStatus()); |
| | | playerEntity.setVersion(res.getVersion()); |
| | | playerEntity.setOsVersion(res.getOsVersion()); |
| | | playerEntity.setLastOnlineTime(res.getLastOnlineTime()); |
| | | playerEntity.setIp(res.getIp()); |
| | | playerEntity.setWidth(res.getWidth()); |
| | | playerEntity.setHeight(res.getHeight()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * è°æ´å±å¹ç¶æï¼äº®å±/é»å±ï¼-POST-JSON |
| | | * |
| | | * @param playerIds |
| | | * @param type |
| | | * @return |
| | | */ |
| | | public VnnoxResult screenStatus(List<String> playerIds, VnnoxScreenStatusType type) { |
| | | VnnoxScreenStatusRequest vnnoxScreenStatusRequest = new VnnoxScreenStatusRequest(); |
| | | vnnoxScreenStatusRequest.setPlayerIds(playerIds); |
| | | vnnoxScreenStatusRequest.setStatus(type); |
| | | |
| | | String result = VnnoxRequestUtil.PostWithHeader( |
| | | VnnoxUrl.getUrl(VnnoxUrl.SCREEN_STATUS), |
| | | vnnoxScreenStatusRequest.toJson(), |
| | | new CommonHeader(CommonHeader.JSON, true) |
| | | ); |
| | | |
| | | VnnoxResultResponse response = JSON.parseObject(result, VnnoxResultResponse.class); |
| | | |
| | | return response.getData(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * é³éè°æ´-POST-JSON |
| | | * |
| | | * @param playerIds |
| | | * @param vol |
| | | * @return |
| | | */ |
| | | public VnnoxResult volChange(List<String> playerIds, Integer vol) { |
| | | |
| | | VnnoxBaseRequest request = new VnnoxBaseRequest(); |
| | | request.setPlayerIds(playerIds); |
| | | request.setValue(vol); |
| | | |
| | | String result = VnnoxRequestUtil.PostWithHeader( |
| | | VnnoxUrl.getUrl(VnnoxUrl.CHANGE_VOL), |
| | | request.toJson(), |
| | | new CommonHeader(CommonHeader.JSON, true) |
| | | ); |
| | | VnnoxResultResponse response = JSON.parseObject(result, VnnoxResultResponse.class); |
| | | |
| | | return response.getData(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * å±å¹äº®åº¦è°æ´ |
| | | * |
| | | * @param playerIds |
| | | * @param brightness |
| | | * @return |
| | | */ |
| | | public VnnoxResult brightnessChange(List<String> playerIds, Integer brightness) { |
| | | VnnoxBaseRequest request = new VnnoxBaseRequest(); |
| | | request.setPlayerIds(playerIds); |
| | | request.setValue(brightness); |
| | | |
| | | String result = VnnoxRequestUtil.PostWithHeader( |
| | | VnnoxUrl.getUrl(VnnoxUrl.CHANGE_BRIGHTNESS), |
| | | request.toJson(), |
| | | new CommonHeader(CommonHeader.JSON, true) |
| | | ); |
| | | VnnoxResultResponse response = JSON.parseObject(result, VnnoxResultResponse.class); |
| | | |
| | | return response.getData(); |
| | | } |
| | | |
| | | /** |
| | | * å±å¹æªå¾ |
| | | * |
| | | * @param playerId |
| | | * @return |
| | | */ |
| | | public VnnoxResult screenShot(String playerId) { |
| | | List<String> players = new ArrayList<>(); |
| | | players.add(playerId); |
| | | VnnoxBaseRequest request = new VnnoxBaseRequest(); |
| | | request.setPlayerIds(players); |
| | | request.setNoticeUrl(VnnoxConstant.SCREEN_SHOT_NOTIFY_URL); |
| | | |
| | | String result = VnnoxRequestUtil.PostWithHeader( |
| | | VnnoxUrl.getUrl(VnnoxUrl.SCREEN_SHOT), |
| | | request.toJson(), |
| | | new CommonHeader(CommonHeader.JSON, true) |
| | | ); |
| | | VnnoxResultResponse response = JSON.parseObject(result, VnnoxResultResponse.class); |
| | | |
| | | return response.getData(); |
| | | } |
| | | |
| | | /** |
| | | * 设å¤éå¯ |
| | | * |
| | | * @param playerIdList |
| | | * @return |
| | | */ |
| | | public VnnoxResult reboot(List<String> playerIdList) { |
| | | VnnoxBaseRequest request = new VnnoxBaseRequest(); |
| | | request.setPlayerIds(playerIdList); |
| | | request.setNoticeUrl(VnnoxConstant.SCREEN_SHOT_NOTIFY_URL); |
| | | |
| | | String result = VnnoxRequestUtil.PostWithHeader( |
| | | VnnoxUrl.getUrl(VnnoxUrl.REBOOT), |
| | | request.toJson(), |
| | | new CommonHeader(CommonHeader.JSON, true) |
| | | ); |
| | | VnnoxResultResponse response = JSON.parseObject(result, VnnoxResultResponse.class); |
| | | |
| | | return response.getData(); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils; |
| | | |
| | | import com.sandu.ximon.admin.utils.request.CommonHeader; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.message.BasicHeader; |
| | | import org.apache.http.protocol.HTTP; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | |
| | | public class VnnoxRequestUtil { |
| | | |
| | | private static final String UTF8 = "utf-8"; |
| | | |
| | | |
| | | public static String get(String url){ |
| | | CloseableHttpClient client = HttpClients.createDefault(); |
| | | HttpGet get = new HttpGet(url); |
| | | String result = null; |
| | | try { |
| | | HttpResponse httpResponse = client.execute(get); |
| | | InputStream inStream = httpResponse.getEntity().getContent(); |
| | | |
| | | result = streamToString(inStream,UTF8); |
| | | |
| | | inStream.close(); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static String GetWithHeader (String url, String params, CommonHeader header) { |
| | | CloseableHttpClient client = HttpClients.createDefault(); |
| | | HttpGet get = new HttpGet(url); |
| | | for(String key: header.keySet()) { |
| | | get.setHeader(key, header.get(key)); |
| | | } |
| | | String result = null; |
| | | try { |
| | | StringEntity s = new StringEntity(params, UTF8); |
| | | s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, |
| | | "application/json")); |
| | | HttpResponse httpResponse = client.execute(get); |
| | | InputStream inStream = httpResponse.getEntity().getContent(); |
| | | |
| | | result = streamToString(inStream, UTF8); |
| | | |
| | | inStream.close(); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public static String PostWithHeader (String URL, String json, CommonHeader header) { |
| | | CloseableHttpClient client = HttpClients.createDefault(); |
| | | HttpPost post = new HttpPost(URL); |
| | | for(String key: header.keySet()) { |
| | | post.setHeader(key, header.get(key)); |
| | | } |
| | | String result = null; |
| | | try { |
| | | StringEntity s = new StringEntity(json, UTF8); |
| | | s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, |
| | | "application/json")); |
| | | post.setEntity(s); |
| | | HttpResponse httpResponse = client.execute(post); |
| | | InputStream inStream = httpResponse.getEntity().getContent(); |
| | | |
| | | result = streamToString(inStream,UTF8); |
| | | |
| | | inStream.close(); |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | public static String streamToString(InputStream in, String encoding){ |
| | | // å°æµè½¬æ¢ä¸ºå符串 |
| | | try { |
| | | StringBuffer sb = new StringBuffer(); |
| | | byte[] b = new byte[1024]; |
| | | for (int n; (n = in.read(b)) != -1;) { |
| | | sb.append(new String(b, 0, n, encoding)); |
| | | } |
| | | return sb.toString(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("æå requestBody å¼å¸¸", e); |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.request; |
| | | |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.VnnoxAPIUtil; |
| | | import lombok.Data; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | @Data |
| | | public class CommonHeader extends HashMap<String, String> { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(CommonHeader.class); |
| | | |
| | | public static final String FORM = "form"; |
| | | public static final String JSON = "json"; |
| | | |
| | | public CommonHeader(String type,boolean hasToken){ |
| | | super.put("username", VnnoxConstant.username); |
| | | if(type.equals(FORM)) { |
| | | super.put("Content-Type","application/x-www-form-urlencoded"); |
| | | } else if(type.equals(JSON)) { |
| | | super.put("Content-Type","application/json"); |
| | | } |
| | | if(hasToken) { |
| | | String token = null; |
| | | while(token == null) { |
| | | token = RedisUtils.getBean().get(VnnoxConstant.REDIS_TOKEN_NAME); |
| | | if(null == token) { |
| | | VnnoxAPIUtil.getBean().getToken(); |
| | | logger.info("å è½½vnnox token"); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | super.put("token", token); |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.request; |
| | | |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class VnnoxBaseRequest implements VnnoxRequest { |
| | | |
| | | private List<String> playerIds; |
| | | |
| | | private Integer value; |
| | | |
| | | private String noticeUrl; |
| | | |
| | | @Override |
| | | public String toJson() { |
| | | return VnnoxConstant.GSON.toJson(this); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.request; |
| | | |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VnnoxGetPlayerListRequest implements VnnoxRequest{ |
| | | |
| | | private Integer count; |
| | | |
| | | private Integer start; |
| | | |
| | | private String name; |
| | | |
| | | public VnnoxGetPlayerListRequest(Integer count, Integer start){ |
| | | this.count = count; |
| | | this.start = start; |
| | | } |
| | | |
| | | @Override |
| | | public String toJson() { |
| | | return VnnoxConstant.GSON.toJson(this); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.request; |
| | | |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VnnoxGetTokenRequest implements VnnoxRequest{ |
| | | |
| | | private String username = VnnoxConstant.username; |
| | | |
| | | private String password = VnnoxConstant.password; |
| | | |
| | | @Override |
| | | public String toJson() { |
| | | return VnnoxConstant.GSON.toJson(this); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.request; |
| | | |
| | | public interface VnnoxRequest { |
| | | |
| | | String toJson(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.request; |
| | | |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class VnnoxScreenStatusRequest implements VnnoxRequest{ |
| | | |
| | | private List<String> playerIds; |
| | | |
| | | private VnnoxScreenStatusType status; |
| | | |
| | | @Override |
| | | public String toJson() { |
| | | return VnnoxConstant.GSON.toJson(this); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.request; |
| | | |
| | | /** |
| | | * å±å¹ç¶æ |
| | | */ |
| | | public enum VnnoxScreenStatusType { |
| | | |
| | | OPEN, |
| | | |
| | | CLOSE |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.request; |
| | | |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class VnnoxSyncCurrentInfoRequest implements VnnoxRequest{ |
| | | |
| | | private List<String> playerIds; |
| | | |
| | | @Override |
| | | public String toJson() { |
| | | return VnnoxConstant.GSON.toJson(this); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | public class CommonResponse { |
| | | |
| | | private Long logid; |
| | | |
| | | private Integer status; |
| | | |
| | | private Map data; |
| | | |
| | | public String getDataJson(){ |
| | | return JSON.toJSONString(data); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VnnoxGetTokenResponse implements VnnoxResponse<VnnoxGetTokenResponse> { |
| | | |
| | | // è·åçåè¯ |
| | | private String token; |
| | | // åè¯æææ¶é´ï¼åä½ï¼ç§ |
| | | private Integer expire; |
| | | |
| | | @Override |
| | | public VnnoxPlayerListResponse parse(com.aliyuncs.CommonResponse commonEntity) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public VnnoxGetTokenResponse parse(CommonResponse commonEntity) { |
| | | return JSON.parseObject(commonEntity.getDataJson(),VnnoxGetTokenResponse.class); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VnnoxPlayerInfoResponse { |
| | | // ææ¾å¨ID |
| | | private String playerId; |
| | | // ææ¾å¨ç±»å,1-åæ¥ææ¾å¨ï¼2-弿¥ææ¾å¨ |
| | | private Integer playerType; |
| | | // ææ¾å¨åç§° |
| | | private String name; |
| | | // ææ¾å¨å½åå¨çº¿ç¶æï¼0-离线ï¼1-å¨çº¿ |
| | | private Integer onlineStatus; |
| | | // ææ¾å¨å¯ä¸æ è¯,å¦æä¸ºnull代表没æç»å®ææ¾å¨ |
| | | private String sn; |
| | | // ææ¾å¨å½åçæ¬å· |
| | | private String version; |
| | | // ææ¾å¨å½åç³»ç»çæ¬å· |
| | | private String osVersion; |
| | | // ææ¾å¨ipå°å |
| | | private String ip; |
| | | // ææ¾å¨å°ºå¯¸å®½åº¦ |
| | | private Integer width; |
| | | // ææ¾å¨å°ºå¯¸é«åº¦ |
| | | private Integer height; |
| | | // ææ¾å¨æåå¿è·³æ¶é´(new) |
| | | private String lastOnlineTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class VnnoxPlayerListResponse implements VnnoxResponse<VnnoxPlayerListResponse> { |
| | | |
| | | |
| | | private Integer total; |
| | | |
| | | private VnnoxPlayerPageInfoResponse pageInfo; |
| | | |
| | | private List<VnnoxPlayerResponse> rows; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public VnnoxPlayerListResponse parse(com.aliyuncs.CommonResponse commonEntity) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public VnnoxPlayerListResponse parse(CommonResponse commonEntity) { |
| | | return JSON.parseObject(commonEntity.getDataJson(),VnnoxPlayerListResponse.class); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VnnoxPlayerPageInfoResponse { |
| | | |
| | | private Integer start; |
| | | |
| | | private Integer count; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VnnoxPlayerResponse { |
| | | |
| | | // ææ¾å¨ID |
| | | private String playerId; |
| | | // ææ¾å¨ç±»å,1-åæ¥ææ¾å¨ï¼2-弿¥ææ¾å¨ |
| | | private Integer playerType; |
| | | // ææ¾å¨åç§° |
| | | private String name; |
| | | // ææ¾å¨å½åå¨çº¿ç¶æï¼0-离线ï¼1-å¨çº¿ |
| | | private Integer onlineStatus; |
| | | // ææ¾å¨å¯ä¸æ è¯,å¦æä¸ºnull代表没æç»å®ææ¾å¨ |
| | | private String sn; |
| | | // ææ¾å¨å½åçæ¬å· |
| | | private String version; |
| | | // ææ¾å¨æåå¿è·³æ¶é´(new) |
| | | private String lastOnlineTime; |
| | | // IPå°å |
| | | private String ip; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | public interface VnnoxResponse<T> { |
| | | |
| | | VnnoxPlayerListResponse parse(com.aliyuncs.CommonResponse commonEntity); |
| | | |
| | | T parse(CommonResponse commonEntity); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class VnnoxResult { |
| | | |
| | | private List<String> success; |
| | | |
| | | private List<String> fail; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class VnnoxResultResponse { |
| | | |
| | | private String logid; |
| | | |
| | | private Integer status; |
| | | |
| | | private VnnoxResult data; |
| | | |
| | | private String errmsg; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.utils.response; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class VnnoxSyncCurrentInfoResponse { |
| | | |
| | | private Long logid; |
| | | |
| | | private Integer status; |
| | | |
| | | private List<VnnoxPlayerInfoResponse> data; |
| | | |
| | | } |