| | |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/src/main/resources/libs/artemis-http-client-1.1.8.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpmime</artifactId> |
| | | <version>4.5.14</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <!-- <build>--> |
| | |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.xxpt.gateway.shared.api.request.OapiMediaUploadRequest; |
| | | import com.alibaba.xxpt.gateway.shared.api.response.OapiMediaUploadResponse; |
| | | import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient; |
| | | import com.alibaba.xxpt.gateway.shared.client.http.GetClient; |
| | | import com.alibaba.xxpt.gateway.shared.client.http.IntelligentPostClient; |
| | | import com.alibaba.xxpt.gateway.shared.client.http.PostClient; |
| | | import com.aliyun.oss.OSS; |
| | | import com.aliyun.oss.OSSClientBuilder; |
| | |
| | | public CommonResult<String> getVideo(@PathVariable String mediaId) { |
| | | String accessToken = getToken(); |
| | | |
| | | |
| | | //executableClient保证单例 |
| | | IntelligentPostClient intelligentPostClient = executableClient.newIntelligentPostClient("/media/upload"); |
| | | OapiMediaUploadRequest oapiMediaUploadRequest = new OapiMediaUploadRequest(); |
| | | //调用接口凭证 |
| | | oapiMediaUploadRequest.setAccess_token(accessToken); |
| | | //媒体文件类型,分别有图片(image)、语音(voice)、普通文件(file) |
| | | oapiMediaUploadRequest.setType("file"); |
| | | //orm-data中媒体文件标识,有filename、filelength、content-type等信息 |
| | | oapiMediaUploadRequest.setMedia("filename"); |
| | | intelligentPostClient.addFile(new File("F:\\视频\\7月29日.mp4")); |
| | | //获取结果 |
| | | OapiMediaUploadResponse apiResult = intelligentPostClient.post(oapiMediaUploadRequest); |
| | | |
| | | |
| | | MultipartFile file = getDownload(accessToken, mediaId); |
| | | String url = ossService.uploadImages(file); |
| | | return CommonResult.success(url); |
| | |
| | | @Autowired |
| | | private VideoUtil videoUtil; |
| | | |
| | | // @Scheduled(cron = "0/9 * * * * ?") // 每秒执行 |
| | | // @Scheduled(cron = "0 0/1 * ?") |
| | | // @Scheduled(cron = "0 */5 * * * ?") // 每5分钟执行 |
| | | @Scheduled(cron = "0 0 1 * * ?") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void scheduledTask() { |
| | | System.out.println("海康:开始执行"); |
| | | |
| | | findVideoList(1, 20); |
| | | findVideoList(1, 5); |
| | | |
| | | } |
| | | |
| | |
| | | private final String APP_SECRET = "LElVf9Ct3ykStZHCmFNZ"; |
| | | |
| | | public PageResult<Camera> callPostCameras(Integer pageNo, Integer pageSize, String treeCode) throws Exception { |
| | | System.out.println("海康视频-callPostCameras"); |
| | | |
| | | ArtemisConfig config = new ArtemisConfig(); |
| | | System.out.println("海康视频-config"); |
| | | config.setHost(HOST); // 代理API网关nginx服务器ip端口 |
| | | config.setAppKey(APP_KEY); // 秘钥appkey |
| | | config.setAppSecret(APP_SECRET);// 秘钥appSecret |
| | | System.out.println("海康视频-初始化config"); |
| | | |
| | | final String getSecurityApi = ARTEMIS_PATH + "/api/resource/v1/cameras"; // 接口路径 |
| | | Map<String, String> path = new HashMap<String, String>(2) { |
| | | { |
| | |
| | | timeout: 0 |
| | | |
| | | datasource: |
| | | url: jdbc:mysql://42.193.1.25:3306/sccg?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false |
| | | url: jdbc:mysql://42.193.1.25:3306/sccg1020?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false |
| | | username: root |
| | | password: 321$YcYl@1970! |
| | | type: com.alibaba.druid.pool.DruidDataSource |