diff --git a/lzbi-admin/src/main/resources/application-dev.yml b/lzbi-admin/src/main/resources/application-dev.yml index 207b039..512041d 100644 --- a/lzbi-admin/src/main/resources/application-dev.yml +++ b/lzbi-admin/src/main/resources/application-dev.yml @@ -76,12 +76,12 @@ spring: datasource: # 主库数据源 master: - url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true - username: luenmei - password: 123456 - #url: jdbc:mysql://localhost:3306/lmlz_dcdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true - #username: root - #password: root123456 + #url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true + #username: luenmei + #password: 123456 + url: jdbc:mysql://localhost:3306/lmlz_dcdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true + username: root + password: root123456 # # 计费数据库 # charge: # driverClassName: oracle.jdbc.OracleDriver @@ -89,19 +89,22 @@ spring: # username: lmjt_sys # password: lmjt_sys # 从库数据源 - slave: + #slave: # 从数据源开关/默认关闭 - url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: luenmei - password: 123456 - workDB: - driverClassName: org.postgresql.Driver - type: com.alibaba.druid.pool.DruidDataSource - url: jdbc:postgresql://10.10.10.56:5432/dctestdb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai - username: postgres - password: 123456 + #url: jdbc:mysql://10.10.10.56:13306/lzdc_bi_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + #username: luenmei + #password: 123456 + #workDB: + #driverClassName: org.postgresql.Driver + #type: com.alibaba.druid.pool.DruidDataSource + #url: jdbc:postgresql://10.10.10.56:5432/dctestdb?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai + #username: postgres + #password: 123456 primary: master - +luenmeilz: +#视频设备监控地址 + vedioServer: + url: 10.10.10.40:18000 # 日志配置 logging: file: diff --git a/lzbi-admin/src/main/resources/application.yml b/lzbi-admin/src/main/resources/application.yml index 81e0beb..3466c76 100644 --- a/lzbi-admin/src/main/resources/application.yml +++ b/lzbi-admin/src/main/resources/application.yml @@ -27,6 +27,7 @@ luenmeilz: baiduWeatherURL: https://api.map.baidu.com/weather/v1/ #百度天气的apk baiduWeatherAK: nrZCrGvhjZ9pgnWyeggvg0SRU8BuRA6w + # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 diff --git a/lzbi-module/src/main/java/com/lzbi/bi/controller/DCVedioScreenControler.java b/lzbi-module/src/main/java/com/lzbi/bi/controller/DCVedioScreenControler.java new file mode 100644 index 0000000..aa46c79 --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/bi/controller/DCVedioScreenControler.java @@ -0,0 +1,86 @@ +package com.lzbi.bi.controller; + +import cn.hutool.Hutool; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.digest.MD5; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson2.JSONObject; +import com.lzbi.common.core.controller.BaseController; +import com.lzbi.common.core.domain.AjaxResult; +import com.lzbi.common.utils.SecurityUtils; +import com.lzbi.common.utils.StringUtils; +import com.lzbi.common.utils.sign.Md5Utils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.util.DigestUtils; +import org.springframework.web.bind.annotation.*; + +import java.util.Optional; + +/** + * @auth create by Administrator + * @date 2023/12/27 + * DCVedioScreenControler + */ +@Api("视频监控大屏接口") +@RestController +@RequestMapping("/vedio") +public class DCVedioScreenControler extends BaseController { + @Autowired + RedisTemplate redisTemplate; + @Value("${luenmeilz.vedioServer.url}") + String vedio_server_url; + //String md532Upper=md532Lower.toUpperCase(); + //16位,小写 + //String md516Lower =md532Lower.substring(8, 24); + //16位,大写 + //String md516Upper=md532Lower.substring(8, 24).toUpperCase(); + @ApiOperation("根据用户对照信息并获取视频的用户登录token") + @GetMapping("/getToken") + public AjaxResult getToken2(){ + return AjaxResult.success(getToken()); + } + private String getToken(){ + String userName=SecurityUtils.getUsername(); + String token= redisTemplate.opsForValue().get("vedio:" + userName); + if(StringUtils.isNull(token)){//没有tokean需要重新获取 + String vedio_userName="easycvr" ;//SecurityUtils.getUsername(); + String vedio_password="lmlz@2019"; // + //根据平台用户名查询 对应的监控用户名和密码,如果不需要则默认给出easycvr lmlz@2019 + String passwordMd532 = DigestUtils.md5DigestAsHex(vedio_password.getBytes()); + HttpRequest get = HttpUtil.createGet(StrUtil.format("{}/api/v1/login?username={}&password={}", vedio_server_url, userName, passwordMd532)); + HttpResponse execute = get.execute(); + if(execute.getStatus()==200){ + //解析token + token= Optional.ofNullable(JSONObject.parseObject(execute.body()).getString("token")).orElse(""); + redisTemplate.opsForValue().set("vedio:" + userName,token); + } + + } + return token; + } + @ApiOperation("获取设备列表") + @GetMapping("/getDevcieList") + public AjaxResult getDeviceList(){ + + String token=getToken(); + HttpRequest get = HttpUtil.createGet(StrUtil.format("{}/api/v1/devices?device={}&start={}&limit={}&token={}", vedio_server_url,0,0,100,token)); + return AjaxResult.success(get.execute().body()); + } + @ApiOperation("获取通道列表") + @ApiImplicitParams({ + @ApiImplicitParam(name = "depId", value = "上级部门编码默认0", dataType = "Long", dataTypeClass = Long.class), + }) + @GetMapping("/getChanleList") + public AjaxResult getChanelList(){ + String token=""; + return AjaxResult.success(token); + } +}