修改机器人接口
This commit is contained in:
parent
e1b9bc06df
commit
5559f732c6
|
|
@ -21,24 +21,24 @@
|
|||
<version>5.3.2</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!-- <!– SpringCloud Alibaba Sentinel –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-devtools</artifactId>-->
|
||||
<!-- <optional>true</optional> <!– 表示依赖不会传递 –>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- swagger3-->
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.bonus;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
|
|
@ -12,7 +11,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@EnableScheduling
|
||||
@EnableDiscoveryClient
|
||||
//@EnableDiscoveryClient
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class BonusBusinessApplication
|
||||
{
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ public class RobotController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 查询录音文件
|
||||
* 删除录音文件
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -65,6 +65,11 @@ public class XxmSendUtils {
|
|||
*/
|
||||
public static String ROBOT_MAP_STOP="C_ST_RobotStopBase";
|
||||
|
||||
/**
|
||||
* 全部停止
|
||||
*/
|
||||
public static String ROBOT_ALL_STOP="C_ST_RobotStop";
|
||||
|
||||
/**
|
||||
* 机器人-前往充电桩
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -192,9 +192,7 @@ public class RobotEventXmlServiceImpl implements IRobotEventXmlService {
|
|||
String res= QxVideotape.sendDevicePost(token, TVideoConfigUtil.Q2HTTPURL,puid,xml);
|
||||
Map<String,String> map= XmlUtils.getRobotTaskImage(res);
|
||||
// 上传文件路径-配置生成
|
||||
String dateTimeNow=DateUtils.dateTimeNow();
|
||||
long millis=System.currentTimeMillis();
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
|
||||
String url=map.get("url").split("\\?")[0];
|
||||
String lastPath=fileService.uploadFile(url,"task");
|
||||
//生成图路径
|
||||
|
|
@ -203,8 +201,8 @@ public class RobotEventXmlServiceImpl implements IRobotEventXmlService {
|
|||
String uuid= UUID.randomUUID().toString().replaceAll("-","");
|
||||
RobotTaskImageVo vo;
|
||||
if(imageUrl!=null){
|
||||
String bast641=fileService.getFileBast64(lastPath);
|
||||
String bast642=fileService.getFileBast64(imageUrl.getImage());
|
||||
String bast641=fileService.getFileBast64(lastPath);
|
||||
String bast642=fileService.getFileBast64(imageUrl.getImage());
|
||||
double value = ImageSimilarity.calculateSimilarity(bast641, bast642);
|
||||
String formattedValue = String.format("%.2f", value*100);
|
||||
vo=new RobotTaskImageVo(uuid,taskId,positionId,taskTime,lastPath,imageUrl.getImage(),imageUrl.getTaskTime(),formattedValue);
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ public class RobotServiceImpl implements IRobotService {
|
|||
return AjaxResult.success(XmlUtils.getSuccess(res));
|
||||
}else if("9".equals(robotVo.getType())){
|
||||
//机器人 停止
|
||||
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_MAP_STOP);
|
||||
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_ALL_STOP);
|
||||
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
|
||||
return AjaxResult.success(XmlUtils.getSuccess(res));
|
||||
}else if("10".equals(robotVo.getType())){
|
||||
|
|
@ -360,6 +360,9 @@ public class RobotServiceImpl implements IRobotService {
|
|||
|
||||
@Override
|
||||
public AjaxResult addTasks(PatrolTask vo) {
|
||||
if(StringHelper.isNullOrEmptyString(vo.getRobotId())){
|
||||
vo.setRobotId("BNS_ROBOT");
|
||||
}
|
||||
String uuid= UUID.randomUUID().toString().replaceAll("-","");
|
||||
vo.setId(uuid);
|
||||
vo.setTaskStatus("0");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.business.service.impl;
|
||||
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||
import com.bonus.business.mapper.SbdUserMapper;
|
||||
import com.bonus.business.minio.FileServiceImpl;
|
||||
import com.bonus.business.robot.util.IdUtils;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
# 数据源配置
|
||||
spring:
|
||||
application:
|
||||
name: bonus-robot
|
||||
cloud:
|
||||
nacos:
|
||||
username: nacos
|
||||
password: Jjsp@nacos2023
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:18848
|
||||
namespace: robot
|
||||
name: sbdRobot
|
||||
# application:
|
||||
# name: bonus-robot
|
||||
# cloud:
|
||||
# nacos:
|
||||
# username: nacos
|
||||
# password: Jjsp@nacos2023
|
||||
# discovery:
|
||||
# server-addr: 127.0.0.1:18848
|
||||
# namespace: robot
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
|
|
@ -18,10 +20,14 @@ spring:
|
|||
# url: jdbc:mysql://192.168.0.14:4417/sbd_robot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: Bonus@admin123!
|
||||
# master:
|
||||
# url: jdbc:mysql://127.0.0.1:3306/sbd_robot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: mroot
|
||||
# password: bonus@admin123
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/sbd_robot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: mroot
|
||||
password: bonus@admin123
|
||||
url: jdbc:mysql://127.0.0.1:23306/wunan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: youotech123#
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
@ -79,7 +85,7 @@ spring:
|
|||
# secretKey: bonus@admin123
|
||||
# bucketName: robot
|
||||
minio:
|
||||
endpoint: http://192.168.0.14:9090
|
||||
accessKey: minio
|
||||
secretKey: bonus@admin123
|
||||
endpoint: http://10.138.55.114:9000
|
||||
accessKey: minioadmin
|
||||
secretKey: minioadmin
|
||||
bucketName: robot
|
||||
|
|
@ -7,7 +7,7 @@ ruoyi:
|
|||
# 版权年份
|
||||
copyrightYear: 2025
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: F:/Files/robot/upload
|
||||
profile: D:/files/upload
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
|
|
@ -19,7 +19,7 @@ server:
|
|||
port: 58080
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
context-path: /sbdRobot
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
|
|
@ -73,6 +73,7 @@ spring:
|
|||
port: 6379
|
||||
# 数据库索引
|
||||
database: 7
|
||||
password: youotech123#
|
||||
# 密码
|
||||
# password: Xbzbns@Redis123!
|
||||
# 连接超时时间
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ public class AuthWriteUtils {
|
|||
public static List<String> getWriteUrl(){
|
||||
List<String> whiteUrl=new ArrayList<>();
|
||||
whiteUrl.add("/robot/push/**");
|
||||
return whiteUrl;
|
||||
whiteUrl.add("/sbdRobot/robot/push/**");
|
||||
return whiteUrl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,22 +31,33 @@ import static com.bonus.framework.security.filter.JwtUtils.parseToken;
|
|||
@Component
|
||||
public class SbdUserJwtTokenFilter implements HandlerInterceptor {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String uri="/sbdRobot/robot/push/xmlAnalysis";
|
||||
System.err.println(uri);
|
||||
if (StringUtils.matches(uri, AuthWriteUtils.getWriteUrl())) {
|
||||
System.err.println(1);
|
||||
}else{
|
||||
System.err.println(2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
String uri=request.getRequestURI();
|
||||
System.err.println(uri);
|
||||
if (StringUtils.matches(uri, AuthWriteUtils.getWriteUrl())) {
|
||||
return true;
|
||||
}
|
||||
String token=request.getHeader("token");
|
||||
if(StringHelper.isNullOrEmptyString(token)){
|
||||
returnJson(response,"请先登录!",401);
|
||||
return false;
|
||||
}else {
|
||||
if("test".equals(token)){
|
||||
return true;
|
||||
if(StringHelper.isNullOrEmptyString(token)){
|
||||
returnJson(response,"请先登录!",401);
|
||||
return false;
|
||||
}else {
|
||||
if("test".equals(token)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String sessionKey = JwtUtils.getValue(token,"seesion");
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);
|
||||
|
|
|
|||
30
pom.xml
30
pom.xml
|
|
@ -47,22 +47,22 @@
|
|||
<dependencies>
|
||||
<!-- Nacos Discovery -->
|
||||
<!-- SpringCloud 微服务 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-dependencies</artifactId>-->
|
||||
<!-- <version>${spring-cloud.version}</version>-->
|
||||
<!-- <type>pom</type>-->
|
||||
<!-- <scope>import</scope>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- SpringCloud Alibaba 微服务 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<!-- <!– SpringCloud Alibaba 微服务 –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-alibaba-dependencies</artifactId>-->
|
||||
<!-- <version>${spring-cloud-alibaba.version}</version>-->
|
||||
<!-- <type>pom</type>-->
|
||||
<!-- <scope>import</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- 覆盖SpringFramework的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
|
|
|||
Loading…
Reference in New Issue