修改机器人接口

This commit is contained in:
haozq 2025-08-27 09:27:29 +08:00
parent 02f8bdb3ae
commit df862609e4
11 changed files with 99 additions and 40 deletions

View File

@ -104,7 +104,7 @@ public class RobotController extends BaseController {
@PostMapping("sedXml")
public AjaxResult getDetails(@RequestBody RobotVo robotVo) {
log.info("机器人puid{}",robotVo.getPuId());
return service.getDetails(robotVo);
}
@ -115,7 +115,7 @@ public class RobotController extends BaseController {
*/
@PostMapping("addPoint")
public AjaxResult addPoint(@RequestBody RobotLocationPoint vo) {
return service.addPoint(vo);
return service.addPoint(vo);
}
/**

View File

@ -13,19 +13,20 @@ import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.utils.AesUtils;
import com.bonus.common.utils.DateUtils;
import com.bonus.common.utils.uuid.UUID;
import lombok.extern.slf4j.Slf4j;
import java.io.File;
import java.util.List;
import java.util.Map;
@Slf4j
public class Test {
public static void main(String[] args) {
String xm=QxUtils.setLightModel(XxmSendUtils.ROBOT_LIGHT_MODE,"OFF");
System.err.println(xm);
String token=QxVideotape.login(TVideoConfigUtil.getMaps(),TVideoConfigUtil.Q2HTTPURL);
String xml= QxUtils.getParamData(XxmSendUtils.QUERY,XxmSendUtils.ROBOT_STATUS);
log.info("状态查询xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,"201115203440576651",xml);
log.info("返回结果--->{}",res);
}

View File

@ -127,13 +127,8 @@ public class ImageResizer {
String path="/temp/";
Path thisPath = Paths.get(filePath+path);
if (!Files.exists(thisPath)) {
try {
// 创建文件夹包括所有必需但不存在的父文件夹
Files.createDirectories(thisPath);
System.out.println("文件夹创建成功: " + thisPath);
} catch (IOException e) {
System.err.println("创建文件夹时出错: " + e.getMessage());
}
Files.createDirectories(thisPath);
System.out.println("文件夹创建成功: " + thisPath);
} else {
System.out.println("文件夹已存在: " + thisPath);
}

View File

@ -338,7 +338,7 @@ public class QxUtils {
// builder.append("PositionID=\"").append(vo.getPositionId()).append("\" ");
builder.append("Theta=\"").append(vo.getTheta()).append("\" ");
builder.append("Height=\"0\" ");
builder.append("Preset=\"0\" ");
builder.append("Preset=\"").append(vo.getPreset()).append("\" ");
builder.append("PTZX=\"").append(vo.getPtzx()).append("\" ");
builder.append("PTZY=\"").append(vo.getPtzy()).append("\" ");
builder.append("PTZZ=\"").append(vo.getPtzz()).append("\" >");

View File

@ -124,8 +124,6 @@ public class PersonFaceServiceImpl implements IPersonFaceService {
int n = 0;
StringBuilder sb = new StringBuilder();
for (PersonVo personVo : list) {
String addResult = IntelligentLibraryUtil.addPerson(personVo);
JSONObject addEntries = JSONUtil.parseObj(addResult);
if (addEntries.getInt("code") == 0) {

View File

@ -125,7 +125,6 @@ public class RobotEventXmlServiceImpl implements IRobotEventXmlService {
String userName=desc.attributeValue("Name");
RobotUserInfoVo vo=new RobotUserInfoVo(uuid,puid,path1,idCard,path2,userName,"1");
mapper.addTaskUserInfo(vo);
}
}
}

View File

@ -205,90 +205,122 @@ public class RobotServiceImpl implements IRobotService {
redisService.set("qx:token",token,60*60);
}
try{
log.info("机器人puid{}",robotVo.getPuId());
log.info("指令类型->type===={}",robotVo.getType());
if("1".equals(robotVo.getType())){
//查询机器人状态
String xml= QxUtils.getParamData(XxmSendUtils.QUERY,XxmSendUtils.ROBOT_STATUS);
log.info("状态查询xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
Map<String,String> map= XmlUtils.getRobotStatus(res);
return AjaxResult.success(map);
}else if("2".equals(robotVo.getType())){
//机器人定位
String xml= QxUtils.getParamData(XxmSendUtils.QUERY,XxmSendUtils.ROBOT_LOCATION);
log.info("机器人定位----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
Map<String,String> map= XmlUtils.getRobotLocation(res);
return AjaxResult.success(map);
}else if("3".equals(robotVo.getType())){
//地图图层
String xml= QxUtils.getParamData(XxmSendUtils.QUERY,XxmSendUtils.ROBOT_MAP);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
Map<String,String> map= XmlUtils.getRobotMap(res);
return AjaxResult.success(map);
}else if("4".equals(robotVo.getType())){
//机器人 使用的地图
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_MAP_IMAGE);
log.info("使用的地图----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
Map<String,String> map= XmlUtils.getRobotMap(res);
return AjaxResult.success(map);
}else if("5".equals(robotVo.getType())){
//机器人 前进
String xml= QxUtils.getControllerParam(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_MAP_FORWARD,robotVo.getSpeed());
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
return AjaxResult.success(XmlUtils.getSuccess(res));
log.info("前进----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("6".equals(robotVo.getType())){
//机器人 后退
String xml= QxUtils.getControllerParam(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_MAP_BACK,robotVo.getSpeed());
log.info("后退----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("7".equals(robotVo.getType())){
//机器人 左转
String xml= QxUtils.getControllerParam(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_MAP_LEFT,robotVo.getSpeed());
log.info("左转----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("8".equals(robotVo.getType())){
//机器人 右转
String xml= QxUtils.getControllerParam(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_MAP_RIGHT,robotVo.getSpeed());
log.info("右转----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("9".equals(robotVo.getType())){
//机器人 停止
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_ALL_STOP);
log.info("停止----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("10".equals(robotVo.getType())){
//机器人 去充电
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_GOTO_CHARGE);
log.info("去充电----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("11".equals(robotVo.getType())){
//机器人 去充电
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_GOTO_CHARGE);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("12".equals(robotVo.getType())){
//机器人 前往指定位置
String xml= QxUtils.getRobotGoLocation(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_GO_LOCATION,robotVo.getSpeed(),robotVo.getX(),robotVo.getY(),robotVo.getTheta());
log.info("前往指定位置----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("13".equals(robotVo.getType())){
//机器人 开启巡检
String xml= QxUtils.getRobotStartTask(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_START_TASK,robotVo.getTaskId());
log.info("开启巡检----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("14".equals(robotVo.getType())){
//机器人 停止巡检
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_STOP_TASK);
log.info("停止巡检----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("15".equals(robotVo.getType())){
//机器人 暂停巡检
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_ZT_TASK);
log.info("暂停巡检----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("16".equals(robotVo.getType())){
//机器人 继续巡检
String xml= QxUtils.getParamData(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_GO_TASK);
log.info("继续巡检----xml--->{}",xml);
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("17".equals(robotVo.getType())){
//设置声音大小
@ -304,16 +336,21 @@ public class RobotServiceImpl implements IRobotService {
//设置声音大小
String xml= QxUtils.setVideoSource(XxmSendUtils.ROBOT_VIDEO_SOURCE,robotVo.getSound());
String res= QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("19".equals(robotVo.getType())){
//设置警报灯
String xml=QxUtils.setLightModel(XxmSendUtils.ROBOT_LIGHT_MODE,robotVo.getValue());
log.info("设置警报灯----xml--->{}",xml);
String res= QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}else if("20".equals(robotVo.getType())){
//设置警报灯
String xml=QxUtils.setLightModel(XxmSendUtils.ROBOT_AUTO_CHARGE,robotVo.getValue());
log.info("设置警报灯----xml--->{}",xml);
String res= QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,robotVo.getPuId(),xml);
log.info("返回结果--->{}",res);
return AjaxResult.success(XmlUtils.getSuccess(res));
}

View File

@ -16,6 +16,7 @@ import com.bonus.common.config.RuoYiConfig;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.utils.DateUtils;
import com.bonus.common.utils.StringUtils;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.hibernate.validator.internal.util.StringHelper;
@ -292,17 +293,16 @@ public class SbdUserServiceImpl implements ISbdUserService {
List<String> idList=new ArrayList<>();
List<PersonVo> list;
String path= RuoYiConfig.getUploadPath();
String url= minioConfig.getEndpoint();
PageHelper.startPage(1, 10);
//全部下发
if("ALL".equals(vo.getIds())){
list=mapper.getSbdUserList(null);
for (PersonVo personVo:list){
String bast64=minioUtils.getMinioBast64(minioConfig.getBucketName(),personVo.getImage());
String lastPath=ImageResizer.transImageByJpg(path,bast64);
// File file=new File(path+personVo.getImage());
// String lastPath=ImageResizer.transImageByJpg(url,file);
personVo.setImage(lastPath);
idList.add(personVo.getId());
}
}else{
List<String> ids=Arrays.asList(vo.getIds().split(","));
@ -310,19 +310,41 @@ public class SbdUserServiceImpl implements ISbdUserService {
for (PersonVo personVo:list){
String bast64=minioUtils.getMinioBast64(minioConfig.getBucketName(),personVo.getImage());
String lastPath=ImageResizer.transImageByJpg(path,bast64);
// File file=new File(path+personVo.getImage());
// String lastPath=ImageResizer.transImageByJpg(path,file);
personVo.setImage(lastPath);
idList.add(personVo.getId());
}
}
//获取人员图片
AjaxResult ajaxResult=personFaceService.addPerson(list);
Object code=ajaxResult.get("code");
if(code!=null && "200".equals(code.toString())){
mapper.updateSbdUserStatus(idList);
}
return ajaxResult;
List<PersonVo> pushList=new ArrayList<>();
for (int i = 0; i <list.size() ; i++) {
pushList.add(list.get(i));
idList.add(list.get(i).getId());
if(i%10==0){
//获取人员图片
AjaxResult ajaxResult=personFaceService.addPerson(pushList);
Object code=ajaxResult.get("code");
if(code!=null && "200".equals(code.toString())){
mapper.updateSbdUserStatus(idList);
idList.clear();
}
pushList.clear();
}
}
//最后需要重新下发一次
if(!pushList.isEmpty()){
//获取人员图片
AjaxResult ajaxResult=personFaceService.addPerson(pushList);
Object code=ajaxResult.get("code");
if(code!=null && "200".equals(code.toString())){
mapper.updateSbdUserStatus(idList);
}
}
for (PersonVo personVo:list) {
File file=new File(personVo.getImage());
boolean del=file.delete();
System.err.println("--->删除状态"+del);
}
return AjaxResult.success("下发成功");
}
}catch (Exception e){
log.error(e.toString(),e);
@ -330,4 +352,11 @@ public class SbdUserServiceImpl implements ISbdUserService {
return AjaxResult.error("下发失败");
}
}

View File

@ -31,7 +31,7 @@ public class RobotLocationPoint {
/**
* 编码
*/
private String preset;
private String preset="0";
/**
* 球机角度
*/

View File

@ -17,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getPuIdNum" resultType="java.lang.Integer">
select count(1)
from sbd_robot_device
where puid=#{puid}
where puid=#{puid} and del_flag=0
</select>
<select id="getLastImage" resultType="com.bonus.business.vo.RobotTaskImageVo">
select task_image image,task_time taskTime

View File

@ -122,14 +122,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and rui.create_day between #{startDay} and #{endDay}
</if>
</where>
order by rui.create_time desc
order by rui.user_name desc , rui.create_time desc
</select>
<select id="getUserListLimit" resultType="com.bonus.business.vo.RobotUserInfoVo">
select puid,user_id ,rui.user_name userName,rui.image,rui.data_image dataImage,rui.create_time createTime ,
rsu.post,rsu.work_type workType,rsu.sex,rsu.age,create_day createDay
from robot_user_info rui
left join robot_sbd_user rsu on rsu.id_card=rui.user_id and rsu.del_flag=0
order by rui.create_time desc
order by rui.user_name desc , rui.create_time desc
limit 12
</select>
<select id="getGdWorker" resultType="com.bonus.business.vo.SbdUserVo">
@ -171,7 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join robot_sbd_user_status sus on sus.id=us.id
WHERE del_flag=0 AND image IS NOT NULL
<if test="list!=null">
and id IN(
and us.id IN(
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>