| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | |
| | |
| | | /** |
| | | * ä¸ä¼ æ¶é´ |
| | | */ |
| | | private Date createTime; |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * è§é¢æ¶é¿ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * æ°è¯ºç¦è®¾å¤è¡¨ |
| | | * |
| | | * @TableName new_nova_led |
| | | */ |
| | | @NoArgsConstructor |
| | | @TableName(value = "new_nova_led") |
| | | @Data |
| | | public class NewNovaLed implements Serializable { |
| | | /** |
| | | * ææ¾å¨ID |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * ææ¾å¨åç§°(æ°æ®åº) |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * ææ¾å¨åç§°(server) |
| | | */ |
| | | private String playerName; |
| | | |
| | | /** |
| | | * ææ¾å¨ID(Vnnox) |
| | | */ |
| | | private String playerId; |
| | | |
| | | /** |
| | | * ææ¾å¨å¯ä¸æ è¯,å¦æä¸ºnull代表没æç»å®ææ¾å¨(Vnnox) |
| | | */ |
| | | private String sn; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * å辨ç |
| | | */ |
| | | private Integer onlineSign; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | // /** |
| | | // * 产ååç§° |
| | | // */ |
| | | // @JsonIgnore |
| | | // @TableField(exist = false) |
| | | // private String productName; |
| | | // |
| | | // /** |
| | | // * æ¾ç¤ºå±å®½åº¦,åä½ä¸ºåç´ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Integer width; |
| | | // |
| | | // /** |
| | | // * æ¾ç¤ºå±é«åº¦,åä½ä¸ºåç´ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Integer height; |
| | | // |
| | | // /** |
| | | // * æè½¬è§åº¦:0ï¼90ï¼180ï¼270 |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Integer rotation; |
| | | // |
| | | // /** |
| | | // * æ¾ç¤ºå±å«å |
| | | // */ |
| | | // @JsonIgnore |
| | | // @TableField(exist = false) |
| | | // private String aliasName; |
| | | // |
| | | // /** |
| | | // * æ¯å¦æäººå·²ç»ç»é |
| | | // */ |
| | | // @JsonIgnore |
| | | // @TableField(exist = false) |
| | | // private Boolean logined; |
| | | // |
| | | // /** |
| | | // * è¥å·²ç»æäººç»éï¼ä»£è¡¨å·²ç»ç»éçç¨æ·åå表 |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private List<String> username; |
| | | // |
| | | // /** |
| | | // * tcpè¿æ¥ç«¯å£ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Integer tcpPort; |
| | | // |
| | | // /** |
| | | // * ftpè¿æ¥ç«¯å£ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Integer ftpPort; |
| | | // |
| | | // /** |
| | | // * ç³»ç»è®¾ç½®ftpç«¯å£ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Integer syssetFtpPort; |
| | | // |
| | | // /** |
| | | // * ç³»ç»è®¾ç½®tcpç«¯å£ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Integer syssetTcpPort; |
| | | // |
| | | // /** |
| | | // * ç»ç«¯è¿åçkey,åä¸ftpçå¯ç ç产è§å |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private String key; |
| | | // |
| | | // /** |
| | | // * ç³»ç»å¹³å°ä¿¡æ¯ï¼ææ¶ä¼åºç°rk3368,rk312xï¼ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private String platform; |
| | | // |
| | | // /** |
| | | // * True表示ç»ç«¯æ¯æå 坿¨¡å¼ï¼å½ç¶å¦ææ¯æ°çç»ç«¯ä¸å®æ¯True |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Boolean privacy; |
| | | // |
| | | // |
| | | // /** |
| | | // * å½åå±ä½ç¶æï¼terminalStateå
±æ6个å¼,åå«ä»£è¡¨ï¼ |
| | | // * 0ï¼æªè¿æ¥ä»»ä½ç»ç«¯ï¼å½åå¤äºæªè¿æ¥ç¶æ |
| | | // * 1ï¼è¿æ¥æå使¯æªç»å½ç¶æ |
| | | // * 2ï¼è¢«ä»äººç»å½ç¶æ |
| | | // * 3ï¼ç»å½æåç¶æ |
| | | // * 4ï¼å¯ç éè¯¯ç¶æ |
| | | // * 5ï¼ç¦»çº¿ç¶æï¼å¤äºæç´¢ä¸å°çç¶æï¼ä½æ¯æ¾ç»è¢«æç´¢å°è¿ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Integer terminalState; |
| | | // |
| | | // /** |
| | | // * è®°å½ç¹å»å¿½ç¥å¯ç çæ¶é´æ³ |
| | | // */ |
| | | // @JsonIgnore |
| | | // @TableField(exist = false) |
| | | // private Long ignoreTime; |
| | | // |
| | | // /** |
| | | // * æ¯å¦è®°ä½å¯ç ï¼true表示记ä½ï¼falseï¼è¡¨ç¤ºæ²¡æ |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private Boolean hasPassword; |
| | | // |
| | | // /** |
| | | // * å¯ç |
| | | // */ |
| | | // @TableField(exist = false) |
| | | // private String password; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.dao.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.sandu.ximon.dao.domain.NewNovaLed; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãnew_nova_led(æ°è¯ºç¦è®¾å¤è¡¨)ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2022-11-09 11:10:48 |
| | | * @Entity com.sandu.ximon.dao.domain.NewNovaLed |
| | | */ |
| | | @Mapper |
| | | public interface NewNovaLedMapper extends BaseMapper<NewNovaLed> { |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.NewNovaLedMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.NewNovaLed"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <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="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="resolution" column="resolution" jdbcType="VARCHAR"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,name,player_name, |
| | | player_id,sn,create_time, |
| | | resolution,update_time |
| | | </sql> |
| | | </mapper> |
| | |
| | | <select id="getPoleByBinding" resultType="com.sandu.ximon.dao.domain.Pole"> |
| | | SELECT t2.* |
| | | FROM `pole_binding` t1 |
| | | LEFT JOIN pole t2 ON t1.pole_id = t2.id |
| | | LEFT JOIN pole t2 ON t1.pole_id = t2.id AND t1.device_type=0 |
| | | <where> |
| | | t1.device_code = #{Mac} |
| | | AND t1.device_type=0 |
| | | <if test="type != null"> |
| | | AND t1.device_type = #{type} |
| | | </if> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.common.file.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/11/9 |
| | | */ |
| | | @Data |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "new-nova-file.upload") |
| | | public class NovaFileConfig { |
| | | |
| | | /** |
| | | * æå¡å¨åå¨çæ ¹è·¯å¾ |
| | | */ |
| | | private String uploadRootPath; |
| | | /** |
| | | * æå¡å¨ipåç«¯å£ |
| | | */ |
| | | private String realUrl; |
| | | } |
| | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.file.*; |
| | | import com.sandu.common.file.config.FileProperties; |
| | | import com.sandu.common.file.config.NovaFileConfig; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Override |
| | | public FileUploadDto uploadFile(MultipartFile multipartFile) { |
| | | FileProperties fileProperties = SpringContextHolder.getBean(FileProperties.class); |
| | | NovaFileConfig fileProperties = SpringContextHolder.getBean(NovaFileConfig.class); |
| | | String originalFilename = multipartFile.getOriginalFilename(); |
| | | long size = multipartFile.getSize(); |
| | | String suffix = FileUtil.getSuffix(originalFilename); |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!--æ°è¯ºç¦ä¾èµ--> |
| | | <!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna --> |
| | | <dependency> |
| | | <groupId>net.java.dev.jna</groupId> |
| | | <artifactId>jna</artifactId> |
| | | <version>5.6.0</version> |
| | | </dependency> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform --> |
| | | <dependency> |
| | | <groupId>net.java.dev.jna</groupId> |
| | | <artifactId>jna-platform</artifactId> |
| | | <version>5.6.0</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.newnova.conf; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/11/9 |
| | | */ |
| | | @Data |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "new-nova") |
| | | public class FilePathConfig { |
| | | |
| | | /** |
| | | * ä¾èµåæ¾è·¯å¾ |
| | | */ |
| | | private String stringPath; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.newnova.led; |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.newnova.param.NewNovaLedParam; |
| | | import com.sandu.ximon.admin.newnova.utils.NovaAPIUtil; |
| | | import com.sandu.ximon.admin.newnova.vo.StatusVO; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.net.URISyntaxException; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/11/9 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/v1/nova/led") |
| | | public class NewNovaLedController { |
| | | private final PermissionConfig permissionConfig; |
| | | private final NewNovaLedService newNovaLedService; |
| | | private final NovaAPIUtil novaApiUtil; |
| | | |
| | | @PostMapping("/validateSN") |
| | | public ResponseVO<Object> validateSN(@RequestBody @Validated NewNovaLedParam param) { |
| | | if (!permissionConfig.check(MenuEnum.VNNOX_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺å°å¯¹åºç¨æ·æé"); |
| | | } |
| | | boolean b= newNovaLedService.saveLed(param); |
| | | return ResponseUtil.success("ledV2RegisterResultEntity"); |
| | | } |
| | | @PostMapping("/test") |
| | | public ResponseVO<Object> validateSN() { |
| | | StatusVO mzva51930N2113017308 = novaApiUtil.login("MZVA51930N2113017308"); |
| | | return ResponseUtil.success(mzva51930N2113017308); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.newnova.led; |
| | | |
| | | 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.newnova.param.NewNovaLedParam; |
| | | import com.sandu.ximon.dao.domain.NewNovaLed; |
| | | import com.sandu.ximon.dao.mapper.NewNovaLedMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/11/9 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class NewNovaLedService extends BaseServiceImpl<NewNovaLedMapper, NewNovaLed> { |
| | | |
| | | |
| | | /** |
| | | * å±å¹æ³¨å |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public boolean saveLed(NewNovaLedParam param) { |
| | | NewNovaLed one = getOne(Wrappers.lambdaQuery(NewNovaLed.class).eq(NewNovaLed::getSn, param.getSn())); |
| | | if (one != null) { |
| | | throw new BusinessException("设å¤å·²åå¨,请å¿é夿³¨åï¼"); |
| | | } |
| | | NewNovaLed led = new NewNovaLed(); |
| | | led.setSn(param.getSn()); |
| | | led.setName(param.getName()); |
| | | return save(led); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.newnova.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/11/9 |
| | | */ |
| | | @Data |
| | | public class NewNovaLedParam { |
| | | |
| | | @NotBlank(message = "snç ä¸è½ä¸ºç©º") |
| | | private String sn; |
| | | |
| | | private String name; |
| | | |
| | | } |
| | |
| | | package com.sandu.ximon.admin.newnova.utils; |
| | | |
| | | import com.sun.jna.Native; |
| | | |
| | | /* |
| | | * 使ç¨åé
读: |
| | | * 1 å
³äºå¯è½åççæç´¢ä¸å°Tå¡çåå ï¼ |
| | |
| | | public class APITest { |
| | | static Boolean g_bAPIReturn = false; |
| | | static int g_code = 0; |
| | | static String g_sn = "BZSA79353N1310006847"; //BZSA07313J0350000997 |
| | | static String g_sn = "MZVA51930N2113017308"; //BZSA07313J0350000997 |
| | | |
| | | static void waitAPIReturn() throws InterruptedException |
| | | { |
| | | while (!g_bAPIReturn) |
| | | { |
| | | static void waitAPIReturn() throws InterruptedException { |
| | | while (!g_bAPIReturn) { |
| | | Thread.sleep(1000); |
| | | } |
| | | g_bAPIReturn = false; |
| | | } |
| | | |
| | | static void testApi() throws InterruptedException |
| | | { |
| | | static void testApi() throws InterruptedException { |
| | | System.setProperty("jna.encoding", "UTF-8"); |
| | | ViplexCore instance = (ViplexCore) Native.loadLibrary("viplexcore",ViplexCore.class); |
| | | // ViplexCore instance = (ViplexCore) Native.loadLibrary("viplexcore",ViplexCore.class); |
| | | //å½éè¦éæå°é¡¹ç®ä¸æ¶ï¼è¯·ä¿®æ¹ä¸é¢å è½½åºçä½ç½®ä¸ºä½ ä¸è½½çsdkåºçç»å¯¹è·¯å¾ï¼windowsä¸å¦ï¼ |
| | | //ViplexCore instance = (ViplexCore) Native.loadLibrary("D:\\ViplexCore3.3.0.01_x64\\bin\\viplexcore.dll",ViplexCore.class); |
| | | ViplexCore instance = (ViplexCore) Native.loadLibrary("C:\\Users\\Administrator\\Desktop\\novaWin\\bin\\viplexcore.dll", ViplexCore.class); |
| | | |
| | | //å½éè¦éæå°é¡¹ç®ä¸æ¶ï¼è¯·ä¿®æ¹æ¤å¤å è½½åºçä½ç½®ä¸ºä½ ä¸è½½çsdkåºçç»å¯¹è·¯å¾ï¼linuxä¸å¦ï¼ |
| | | //ViplexCore instance = (ViplexCore) Native.loadLibrary("home/user/desktop/ViplexCore_3.3.0.01_CentOS/bin/libviplexcore.so",ViplexCore.class); |
| | | // ViplexCore instance = (ViplexCore) Native.loadLibrary("C:\\Users\\Administrator\\Desktop\\novaLinux\\bin\\libviplexcore.so",ViplexCore.class); |
| | | ViplexCore.CallBack callBack = new ViplexCore.CallBack() { |
| | | |
| | | @Override |
| | |
| | | }; |
| | | |
| | | String rootDir = System.getProperty("user.dir") + "/temp"; |
| | | System.out.println("ä¿åè·¯å¾:" + rootDir); |
| | | rootDir = rootDir.replaceAll( "\\\\","/"); |
| | | String createProgram = "{\"name\":\"Demo\",\"width\":500,\"height\":500,\"tplID\":1,\"winInfo\":{\"height\":100,\"width\":100,\"left\":0,\"top\":0,\"zindex\":0,\"index\":0}}"; |
| | | String editProgram = "{\"programID\":1,\"pageID\":1,\"pageInfo\":{\"name\":\"èç®\",\"widgetContainers\":[{\"audioGroup\":\"\",\"backgroundColor\":\"#00000000\",\"backgroundDrawable\":\"\",\"contents\":{\"widgetGroups\":[],\"widgets\":[{\"id\":1,\"enable\":true,\"repeatCount\":1,\"layout\":{\"y\":\"0\",\"height\":\"100%\",\"x\":\"0\",\"width\":\"100%\"},\"backgroundColor\":\"#00000000\",\"backgroundDrawable\":\"\",\"backgroundMusic\":\"\",\"zOrder\":0,\"displayRatio\":\"FULL\",\"outAnimation\":{\"type\":0,\"duration\":0},\"dataSource\":\"62ea7e60c493c1f860ae256eef8ec89c.png\",\"type\":\"PICTURE\",\"constraints\":[{\"cron\":[],\"endTime\":\"4017-12-30T23:59:59Z+8:00\",\"startTime\":\"1970-01-01T00:00:00Z+8:00\"}],\"border\":{\"borderThickness\":\"2px,3px,5%,6\",\"style\":0,\"backgroundColor\":\"#ff000000\",\"name\":\"border\",\"cornerRadius\":\"2%\",\"effects\":{\"headTailSpacing\":\"\",\"isHeadTail\":false,\"speedByPixelEnable\":true,\"speed\":0,\"animation\":\"CLOCK_WISE\"}},\"inAnimation\":{\"type\":0,\"duration\":1000},\"duration\":3605000,\"name\":\"test.png\",\"originalDataSource\":\"./test.png\",\"functionStorage\":\"\",\"isSupportSpecialEffects\":false}]},\"enable\":true,\"id\":1,\"itemsSource\":\"\",\"layout\":{\"height\":\"1.0\",\"width\":\"1.0\",\"x\":\"0.0\",\"y\":\"0.0\"},\"name\":\"widgetContainers1\",\"pickCount\":0,\"pickPolicy\":\"ORDER\",\"zOrder\":0}]}}"; |
| | | String createProgram = "{\"name\":\"jiemu1\",\"width\":240,\"height\":144}"; |
| | | String editProgram = "{\"programID\":13,\"pageID\":1,\"pageInfo\":{\"name\":\"èç®01\",\"widgetContainers\":[{\"contents\":{\"widgets\":[{\"constraints\":[{\"cron\":[\"0 0 0 ? * 1,2,3,4,5,6,7\"],\"endTime\":\"4017-12-30T23:59:59Z+8:00\",\"startTime\":\"1970-01-01T00:00:00Z+8:00\"}],\"duration\":5000,\"dataSource\":\"62ea7e60c493c1f860ae256eef8ec89c.png\",\"type\":\"PICTURE\",\"name\":\"test.png\",\"originalDataSource\":\"C:/Users/Administrator/Desktop/novaWin/demo/java/test.png\"}]},\"id\":1,\"name\":\"widgetContainers1\"}]}}"; |
| | | String genrateProgram = String.format( |
| | | "{\"programID\":1,\"outPutPath\":\"%s/\",\"mediasPath\":[{\"oldPath\":\"test\",\"newPath\":\"test\"}]}", |
| | | "{\"programID\":13,\"outPutPath\":\"%s/\"}", |
| | | rootDir); |
| | | String trasfromProgram = String.format( |
| | | "{\"sn\": \"%s\",\"iconPath\": \"\",\"iconName\": \"\",\"sendProgramFilePaths\": {\"programPath\": \"%s/program1\",\"mediasPath\": {\"./test.png\": \"test.png\"}},\"programName\": \"program1\",\"deviceIdentifier\": \"Demo\",\"startPlayAfterTransferred\": true,\"insertPlay\": true}", |
| | | "{\"sn\": \"%s\",\"iconPath\": \"\",\"iconName\": \"\",\"sendProgramFilePaths\": {\"programPath\": \"%s/program13\",\"mediasPath\": {\"C:/Users/Administrator/Desktop/novaWin/demo/java/test.png\": \"test.png\"}},\"programName\": \"jiemu1\",\"deviceIdentifier\": \"Demo\",\"startPlayAfterTransferred\": true,\"insertPlay\": true}", |
| | | g_sn, |
| | | rootDir); |
| | | |
| | | |
| | | Boolean bTestVideo = false; |
| | | if (bTestVideo) |
| | | { |
| | | editProgram = "{\"programID\":1,\"pageID\":1,\"pageInfo\":{\"name\":\"Demo\",\"widgetContainers\":[{\"contents\":{\"widgets\":[{\"constraints\":[{\"cron\":[\"0 0 0 ? * 1,2,3,4,5,6,7\"],\"endTime\":\"4017-12-30T23:59:59Z 8:00\",\"startTime\":\"1970-01-01T00:00:00Z 8:00\"}],\"duration\":5000,\"dataSource\":\"219c7dd3260d6bf98ebf61b6da440ffd.avi\",\"type\":\"VIDEO\",\"name\":\"test.vai\",\"originalDataSource\":\"./test.avi\"}]},\"id\":1,\"name\":\"widgetContainers1\"}]}}"; |
| | | |
| | | trasfromProgram = String.format( |
| | | "{\"sn\":\"%s\",\"iconPath\": \"\",\"iconName\": \"\",\"sendProgramFilePaths\": {\"programPath\": \"%s/program1\",\"mediasPath\": {\"./test.avi\": \"test.avi\"}},\"programName\": \"program1\",\"deviceIdentifier\": \"Demo\",\"startPlayAfterTransferred\": true,\"insertPlay\": true}", |
| | | g_sn, |
| | | rootDir); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | Boolean testText = false; |
| | | if (testText) { |
| | | editProgram = "{\"programID\":1,\"pageID\":1,\"pageInfo\":{\"name\":\"jiemu\",\"widgetContainers\":[{\"contents\":{\"widgets\":[{\"constraints\":[{\"cron\":[\"0 0 0 ? * 1,2,3,4,5,6,7\"],\"endTime\":\"4017-12-30T23:59:59Z+8:00\",\"startTime\":\"1970-01-01T00:00:00Z+8:00\"}],\"duration\":5000,\"metadata\":{\"content\":{\"autoPaging\":true,\"backgroundMusic\":{\"duration\":0,\"isTextSync\":false},\"displayStyle\":{\"scrollAttributes\":{\"effects\":{\"animation\":\"MARQUEE_LEFT\",\"speed\":3}},\"type\":\"SCROLL\"},\"paragraphs\":[{\"backgroundColor\":\"#00000000\",\"horizontalAlignment\":\"CENTER\",\"letterSpacing\":0,\"lineSpacing\":0,\"lines\":[{\"segs\":[{\"content\":\"ç®ä½ç¹é«æ¥æ¬èªíêµì´.English123\"}]}],\"verticalAlignment\":\"CENTER\"}],\"textAttributes\":[{\"backgroundColor\":\"#ff000000\",\"attributes\":{\"font\":{\"family\":[\"Arial\"],\"isUnderline\":false,\"size\":20,\"style\":\"NORMAL\"},\"letterSpacing\":0,\"textColor\":\"#ffff0000\"}}]}},\"name\":\"text\",\"type\":\"ARCH_TEXT\"}]},\"id\":1,\"name\":\"widgetContainers1\"}]}}"; |
| | | trasfromProgram = String.format( |
| | | "{\"sn\": \"%s\",\"iconPath\": \"\",\"iconName\": \"\",\"sendProgramFilePaths\": {\"programPath\": \"%s/program1\",\"mediasPath\": {}},\"programName\": \"program1\",\"deviceIdentifier\": \"Demo\",\"startPlayAfterTransferred\": true,\"insertPlay\": true}", |
| | | g_sn, |
| | | rootDir); |
| | | } |
| | | // Boolean bTestVideo = false; |
| | | // if (bTestVideo) { |
| | | // editProgram = "{\"programID\":1,\"pageID\":1,\"pageInfo\":{\"name\":\"Demo\",\"widgetContainers\":[{\"contents\":{\"widgets\":[{\"constraints\":[{\"cron\":[\"0 0 0 ? * 1,2,3,4,5,6,7\"],\"endTime\":\"4017-12-30T23:59:59Z 8:00\",\"startTime\":\"1970-01-01T00:00:00Z 8:00\"}],\"duration\":5000,\"dataSource\":\"219c7dd3260d6bf98ebf61b6da440ffd.avi\",\"type\":\"VIDEO\",\"name\":\"test.vai\",\"originalDataSource\":\"./test.avi\"}]},\"id\":1,\"name\":\"widgetContainers1\"}]}}"; |
| | | // |
| | | // trasfromProgram = String.format( |
| | | // "{\"sn\":\"%s\",\"iconPath\": \"\",\"iconName\": \"\",\"sendProgramFilePaths\": {\"programPath\": \"%s/program1\",\"mediasPath\": {\"./test.avi\": \"test.avi\"}},\"programName\": \"program1\",\"deviceIdentifier\": \"Demo\",\"startPlayAfterTransferred\": true,\"insertPlay\": true}", |
| | | // g_sn, |
| | | // rootDir); |
| | | // } |
| | | // |
| | | // |
| | | // Boolean testText = false; |
| | | // if (testText) { |
| | | // editProgram = "{\"programID\":1,\"pageID\":1,\"pageInfo\":{\"name\":\"jiemu\",\"widgetContainers\":[{\"contents\":{\"widgets\":[{\"constraints\":[{\"cron\":[\"0 0 0 ? * 1,2,3,4,5,6,7\"],\"endTime\":\"4017-12-30T23:59:59Z+8:00\",\"startTime\":\"1970-01-01T00:00:00Z+8:00\"}],\"duration\":5000,\"metadata\":{\"content\":{\"autoPaging\":true,\"backgroundMusic\":{\"duration\":0,\"isTextSync\":false},\"displayStyle\":{\"scrollAttributes\":{\"effects\":{\"animation\":\"MARQUEE_LEFT\",\"speed\":3}},\"type\":\"SCROLL\"},\"paragraphs\":[{\"backgroundColor\":\"#00000000\",\"horizontalAlignment\":\"CENTER\",\"letterSpacing\":0,\"lineSpacing\":0,\"lines\":[{\"segs\":[{\"content\":\"ç®ä½ç¹é«æ¥æ¬èªíêµì´.English123\"}]}],\"verticalAlignment\":\"CENTER\"}],\"textAttributes\":[{\"backgroundColor\":\"#ff000000\",\"attributes\":{\"font\":{\"family\":[\"Arial\"],\"isUnderline\":false,\"size\":20,\"style\":\"NORMAL\"},\"letterSpacing\":0,\"textColor\":\"#ffff0000\"}}]}},\"name\":\"text\",\"type\":\"ARCH_TEXT\"}]},\"id\":1,\"name\":\"widgetContainers1\"}]}}"; |
| | | // trasfromProgram = String.format( |
| | | // "{\"sn\": \"%s\",\"iconPath\": \"\",\"iconName\": \"\",\"sendProgramFilePaths\": {\"programPath\": \"%s/program1\",\"mediasPath\": {}},\"programName\": \"program1\",\"deviceIdentifier\": \"Demo\",\"startPlayAfterTransferred\": true,\"insertPlay\": true}", |
| | | // g_sn, |
| | | // rootDir); |
| | | // } |
| | | |
| | | String companyInfo = "{\"company\":\"NovaStar\",\"phone\":\"029-68216000\",\"email\":\"hr@novastar.tech\"}"; |
| | | instance.nvSetDevLang("Java"); |
| | |
| | | // Thread.sleep(2000); |
| | | |
| | | System.out.println("ViplexCore Demo nvLoginAsync(ç»å½) begin... "); |
| | | String loginParam = String.format("{\"sn\":\"%s\",\"username\":\"admin\",\"rememberPwd\":1,\"password\":\"1234567890\",\"loginType\":0}" |
| | | String loginParam = String.format("{\"sn\":\"MZVA51930N2113017308\",\"ip\":\"\",\"username\":\"admin\",\"rememberPwd\":0,\"password\":\"123456\",\"loginType\":0}" |
| | | , g_sn); |
| | | instance.nvLoginAsync(loginParam, callBack); |
| | | waitAPIReturn(); |
| | | if (g_code != 0) { |
| | | System.out.println("ViplexCore Demo nvLoginAsync(ç»å½) 失败ï¼"); |
| | | System.out.println("é误ç :" + g_code); |
| | | return; |
| | | } |
| | | System.out.println("ViplexCore Demo nvCreateProgramAsync(å建èç®) begin... "); |
| | |
| | | waitAPIReturn(); |
| | | |
| | | |
| | | String requestDatapath = "{\"filePath\":\"./test.png\"}"; |
| | | String requestDatapath = "{\"filePath\":\"C:/Users/Administrator/Desktop/novaWin/demo/java/test.png\"}"; |
| | | System.out.println("ViplexCore Demo nvGetFileMD5Async(è·åMD5) begin... "); |
| | | instance.nvGetFileMD5Async(requestDatapath, callBack); |
| | | waitAPIReturn(); |
| | |
| | | waitAPIReturn(); |
| | | |
| | | System.out.println("ViplexCore Demo nvStartTransferProgramAsync(åéèç®) begin... "); |
| | | System.out.println(trasfromProgram); |
| | | instance.nvStartTransferProgramAsync(trasfromProgram, callBack); |
| | | Thread.sleep(10000); |
| | | g_bAPIReturn = false; |
| | |
| | | String requestDatasn = String.format("{\"sn\":\"%s\"}", g_sn); |
| | | instance.nvGetProgramInfoAsync(requestDatasn, callBack); |
| | | waitAPIReturn(); |
| | | |
| | | System.out.println("ViplexCore Demo nvSetVolumeAsync(设置é³é) begin... "); |
| | | String setVolumeParam = String.format("{\"sn\":\"%s\",\"volumeInfo\":{\"ratio\":60.0}}", g_sn); |
| | | instance.nvSetVolumeAsync(setVolumeParam, callBack); |
| | | waitAPIReturn(); |
| | | |
| | | System.out.println("ViplexCore Demo nvGetVolumeAsync(è·åé³é) begin... "); |
| | | String getVolumeParam = String.format("{\"sn\":\"%s\"}", g_sn); |
| | | instance.nvGetVolumeAsync(getVolumeParam, callBack); |
| | | waitAPIReturn(); |
| | | // |
| | | // System.out.println("ViplexCore Demo nvSetVolumeAsync(设置é³é) begin... "); |
| | | // String setVolumeParam = String.format("{\"sn\":\"%s\",\"volumeInfo\":{\"ratio\":60.0}}", g_sn); |
| | | // instance.nvSetVolumeAsync(setVolumeParam, callBack); |
| | | // waitAPIReturn(); |
| | | // |
| | | // System.out.println("ViplexCore Demo nvGetVolumeAsync(è·åé³é) begin... "); |
| | | // String getVolumeParam = String.format("{\"sn\":\"%s\"}", g_sn); |
| | | // instance.nvGetVolumeAsync(getVolumeParam, callBack); |
| | | // waitAPIReturn(); |
| | | } |
| | | |
| | | public static void main(String[] args) throws InterruptedException{ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.newnova.utils; |
| | | |
| | | import com.sandu.ximon.admin.newnova.conf.FilePathConfig; |
| | | import com.sandu.ximon.admin.newnova.vo.StatusVO; |
| | | import com.sandu.ximon.admin.utils.CountDownLatchUtil; |
| | | import com.sun.jna.Native; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/11/9 |
| | | */ |
| | | @Component |
| | | @AllArgsConstructor |
| | | public class NovaAPIUtil { |
| | | |
| | | |
| | | // @Value("${new-nova.string-path}") |
| | | // public String getStringPath() { |
| | | // return stringPath; |
| | | // } |
| | | |
| | | private final FilePathConfig filePathConfig; |
| | | private final CountDownLatchUtil countDownLatchUtil; |
| | | private static Boolean g_bAPIReturn = false; |
| | | private static int g_code = 0; |
| | | private static String g_sn = "BZSA79353N1310006847"; //BZSA07313J0350000997 |
| | | |
| | | private static Map loginInfo = new LinkedHashMap(); |
| | | |
| | | |
| | | |
| | | // private static ViplexCore.CallBack callBack = new ViplexCore.CallBack() { |
| | | // |
| | | // @Override |
| | | // public void dataCallBack(int code, String data) { |
| | | // // TODO Auto-generated method stub |
| | | // g_code = code; |
| | | // String strCode = "\nViplexCore Demo code:" + code; |
| | | // String strData = "\nViplexCore Demo data:" + data; |
| | | // System.out.println(strCode); |
| | | // System.out.println(strData); |
| | | // g_bAPIReturn = true; |
| | | // } |
| | | // |
| | | // }; |
| | | |
| | | |
| | | static void waitAPIReturn() throws InterruptedException { |
| | | while (!g_bAPIReturn) { |
| | | Thread.sleep(1000); |
| | | } |
| | | g_bAPIReturn = false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ç»å½ |
| | | */ |
| | | public StatusVO login(String sn) { |
| | | |
| | | ViplexCore instance = (ViplexCore) Native.loadLibrary(filePathConfig.getStringPath(), ViplexCore.class); |
| | | String rootDir = System.getProperty("user.dir") + "/temp"; |
| | | String companyInfo = "{\"company\":\"NovaStar\",\"phone\":\"029-68216000\",\"email\":\"hr@novastar.tech\"}"; |
| | | instance.nvSetDevLang("Java"); |
| | | System.out.println("nvInit(sdk åå§å):"); |
| | | System.out.println(instance.nvInit(rootDir, companyInfo)); |
| | | ViplexCore.CallBack callBack = new ViplexCore.CallBack() { |
| | | |
| | | @Override |
| | | public void dataCallBack(int code, String data) { |
| | | // TODO Auto-generated method stub |
| | | g_code = code; |
| | | String strCode = "\nViplexCore Demo code:" + code; |
| | | String strData = "\nViplexCore Demo data:" + data; |
| | | System.out.println(strCode); |
| | | System.out.println(strData); |
| | | g_bAPIReturn = true; |
| | | } |
| | | |
| | | }; |
| | | |
| | | |
| | | System.out.println("ViplexCore Demo nvSearchTerminalAsync(æç´¢) begin... "); |
| | | StatusVO statusVO = new StatusVO(); |
| | | instance.nvSearchTerminalAsync(callBack); |
| | | // countDownLatchUtil.push(); |
| | | // instance.nvSearchTerminalAsync(new ViplexCore.CallBack() { |
| | | // |
| | | // @Override |
| | | // public void dataCallBack(int code, String data) { |
| | | // // TODO Auto-generated method stub |
| | | // g_code = code; |
| | | // statusVO.setStatusCode(code); |
| | | // statusVO.setStatusData(data); |
| | | // System.out.println("\nViplexCore Demo code:" + code); |
| | | // System.out.println("\nViplexCore Demo data:" + data); |
| | | // g_bAPIReturn = true; |
| | | // } |
| | | // |
| | | // }); |
| | | |
| | | |
| | | |
| | | try { |
| | | Thread.sleep(3000); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | g_bAPIReturn = false; |
| | | |
| | | |
| | | System.out.println("ViplexCore Demo nvLoginAsync(ç»å½) begin... "); |
| | | String loginParam = String.format("{\"sn\":\"" + sn + "\",\"ip\":\"\",\"username\":\"admin\",\"rememberPwd\":0,\"password\":\"1234567890\",\"loginType\":0}" |
| | | , g_sn); |
| | | instance.nvLoginAsync(loginParam, new ViplexCore.CallBack() { |
| | | |
| | | @Override |
| | | public void dataCallBack(int code, String data) { |
| | | // TODO Auto-generated method stub |
| | | g_code = code; |
| | | statusVO.setStatusCode(code); |
| | | statusVO.setStatusData(data); |
| | | System.out.println("\nViplexCore Demo code:" + code); |
| | | System.out.println("\nViplexCore Demo data:" + data); |
| | | g_bAPIReturn = true; |
| | | } |
| | | |
| | | }); |
| | | try { |
| | | waitAPIReturn(); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (g_code != 0) { |
| | | System.out.println("ViplexCore Demo nvLoginAsync(ç»å½) 失败ï¼"); |
| | | System.out.println("é误ç :" + g_code); |
| | | return statusVO; |
| | | } |
| | | //ç»éæåä¹ååå
¥mapä¿åç»å½ä¿¡æ¯ |
| | | loginInfo.put(sn, instance); |
| | | return statusVO; |
| | | } |
| | | |
| | | /** |
| | | * å建èç® |
| | | */ |
| | | public int createPro(String sn) throws InterruptedException { |
| | | ViplexCore instance = (ViplexCore) loginInfo.get(sn); |
| | | |
| | | System.out.println("ViplexCore Demo nvCreateProgramAsync(å建èç®) begin... "); |
| | | // instance.nvCreateProgramAsync(createProgram, callBack); |
| | | waitAPIReturn(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.newnova.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author LiuHaoNan |
| | | * @date 2022/11/9 |
| | | */ |
| | | @Data |
| | | public class StatusVO { |
| | | |
| | | private int statusCode; |
| | | |
| | | private String statusData; |
| | | |
| | | } |
| | |
| | | key-id: LTAI5tPdpt5wvJyLipRijFSP |
| | | key-secret: 1ahYfCKd0yTddsUnuDLQzI23MLh4VQ |
| | | bucket-name: ximonsmart |
| | | |
| | | #æ°è¯ºç¦ |
| | | new-nova: |
| | | #ä¾èµå°å |
| | | string-path: C:\Users\Administrator\Desktop\novaWin\bin\viplexcore.dll |
| | | |
| | | new-nova-file: |
| | | upload: |
| | | #æä»¶æå¡å¨è·¯å¾ |
| | | upload-root-path: E:\file\novafile |
| | | storage: local |
| | | #æå¡å¨æä»¶åç¼ |
| | | real-url: http://localhost/ |