修改提交
This commit is contained in:
parent
806a3b7646
commit
32d09735d1
|
|
@ -84,6 +84,16 @@ public class RobotController extends BaseController {
|
|||
return service.getTaskDetails(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询任务详情
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("delTaskData")
|
||||
public AjaxResult delTaskData(@RequestBody PatrolTask vo) {
|
||||
return service.delTaskData(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 裸命令查询
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ public class Test {
|
|||
//登录接口
|
||||
String token=QxVideotape.login(TVideoConfigUtil.getMaps(),TVideoConfigUtil.Q2HTTPURL);
|
||||
//机器人 开启巡检
|
||||
String xml2= QxUtils.getRobotStartTask(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_START_TASK,"WTBLS204766");
|
||||
String res3=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,"201115200268437643",xml2);
|
||||
System.err.println(res3);
|
||||
// String xml2= QxUtils.getRobotStartTask(XxmSendUtils.CONTROLLER,XxmSendUtils.ROBOT_START_TASK,"WTBLS204766");
|
||||
// String res3=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,"201115200268437643",xml2);
|
||||
// System.err.println(res3);
|
||||
|
||||
String xml= QxUtils.getParamData(XxmSendUtils.QUERY,XxmSendUtils.ROBOT_TASK_LIST);
|
||||
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,"201115200268437643",xml);
|
||||
|
|
@ -37,8 +37,8 @@ public class Test {
|
|||
RobotTask vo=new RobotTask();
|
||||
vo.setPatrolTasks(list);
|
||||
String data= QxUtils.setRobotInspection(XxmSendUtils.SET,XxmSendUtils.ROBOT_TASK_LIST,vo);
|
||||
System.err.println(data);
|
||||
|
||||
String res2=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,"201115200268437643",data);
|
||||
System.err.println(res2);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class QxUtils {
|
|||
try{
|
||||
builder.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
|
||||
builder.append("<M Type=\"ComReq\">");
|
||||
builder.append("<C Type=\"").append(type).append("\">");
|
||||
builder.append("<C Lang=\"en\" Type=\"").append(type).append("\">");
|
||||
builder.append("<Res Type=\"ST\" Idx=\"0\" OptID=\"").append(opeId).append("\" >");
|
||||
builder.append("<Param>");
|
||||
builder.append("<PatrolTasks>");
|
||||
|
|
@ -190,7 +190,14 @@ public class QxUtils {
|
|||
if(StringUtil.isNotEmpty(time.getClock())){
|
||||
builder.append("Clock=\"").append(time.getClock()).append("\" ");
|
||||
}
|
||||
builder.append("/>");
|
||||
if(StringUtil.isNotEmpty(time.getDay())){
|
||||
builder.append("/>");
|
||||
}else{
|
||||
builder.append(">");
|
||||
builder.append("</Time>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
builder.append("</").append(model).append(">");
|
||||
|
|
@ -207,14 +214,14 @@ public class QxUtils {
|
|||
builder.append("<Position ");
|
||||
builder.append("X=\"").append(vo.getX()).append("\" ");
|
||||
builder.append("Y=\"").append(vo.getY()).append("\" ");
|
||||
builder.append("PositionID=\"").append(vo.getPositionId()).append("\" ");
|
||||
// builder.append("PositionID=\"").append(vo.getPositionId()).append("\" ");
|
||||
builder.append("Theta=\"").append(vo.getTheta()).append("\" ");
|
||||
builder.append("Height=\"0\" ");
|
||||
builder.append("Preset=\"0\" ");
|
||||
builder.append("PTZX=\"").append(vo.getPtzx()).append("\" ");
|
||||
builder.append("PTZY=\"").append(vo.getPtzy()).append("\" ");
|
||||
builder.append("PTZZ=\"").append(vo.getPtzz()).append("\" >");
|
||||
builder.append("<Actions> ");
|
||||
builder.append("<Actions>");
|
||||
String actions=getActions(vo.getActions());
|
||||
builder.append(actions);
|
||||
builder.append("</Position>");
|
||||
|
|
@ -228,13 +235,22 @@ public class QxUtils {
|
|||
if (actions!=null && !actions.isEmpty()){
|
||||
for (Action vo:actions){
|
||||
builder.append("<Action ");
|
||||
builder.append("Type=\"").append(vo.getType()).append("\" ");
|
||||
builder.append("Num=\"").append(vo.getNum()).append("\" ");
|
||||
builder.append("Interval=\"").append(vo.getInterval()).append("\" ");
|
||||
builder.append("Time=\"").append(vo.getTime()).append("\" />");
|
||||
if(StringUtil.isNotEmpty(vo.getType())){
|
||||
builder.append("Type=\"").append(vo.getType()).append("\" ");
|
||||
}
|
||||
if(StringUtil.isNotEmpty(vo.getNum())){
|
||||
builder.append("Num=\"").append(vo.getNum()).append("\" ");
|
||||
}
|
||||
if(StringUtil.isNotEmpty(vo.getInterval())){
|
||||
builder.append("Interval=\"").append(vo.getInterval()).append("\" ");
|
||||
}
|
||||
if(StringUtil.isNotEmpty(vo.getTime())){
|
||||
builder.append("Time=\"").append(vo.getTime()).append("\" ");
|
||||
}
|
||||
builder.append(">").append("</Action>");
|
||||
}
|
||||
}else{
|
||||
builder.append("<Action/>");
|
||||
builder.append("<Action />");
|
||||
}
|
||||
builder.append("</Actions>");
|
||||
return builder.toString();
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public class XmlUtils {
|
|||
actionVo.put("time",time);
|
||||
actionsArray.add(actionVo);
|
||||
}
|
||||
pointVo.put("Actions",actionsArray);
|
||||
pointVo.put("actions",actionsArray);
|
||||
}
|
||||
patrolTaskVo.put("positions",points);
|
||||
array.add(patrolTaskVo);
|
||||
|
|
|
|||
|
|
@ -67,4 +67,11 @@ public interface IRobotService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult getTaskDetails(PatrolTask vo);
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult delTaskData(PatrolTask vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,11 @@ public class RobotServiceImpl implements IRobotService {
|
|||
@Override
|
||||
public List<PatrolTask> getTaskList(PatrolTask task) {
|
||||
try{
|
||||
return mapper.getTaskList(task);
|
||||
List<PatrolTask> list= mapper.getTaskList(task);
|
||||
for (PatrolTask vo: list){
|
||||
getTaskSchedule(vo);
|
||||
}
|
||||
return list;
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
|
@ -46,10 +50,11 @@ public class RobotServiceImpl implements IRobotService {
|
|||
* 从平台进行热内查询添加
|
||||
*/
|
||||
public void addQueryList(){
|
||||
String puid="201115200268437643";
|
||||
//登录接口
|
||||
String token=QxVideotape.login(TVideoConfigUtil.getMaps(),TVideoConfigUtil.Q2HTTPURL);
|
||||
String xml= QxUtils.getParamData(XxmSendUtils.QUERY,XxmSendUtils.ROBOT_TASK_LIST);
|
||||
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,"201115200268437643",xml);
|
||||
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,puid,xml);
|
||||
JSONArray array= XmlUtils.getRobotTask(res);
|
||||
List<PatrolTask> list= JSONArray.parseArray(array.toString(),PatrolTask.class);
|
||||
//数据添加维护
|
||||
|
|
@ -58,6 +63,7 @@ public class RobotServiceImpl implements IRobotService {
|
|||
String uuid= UUID.randomUUID().toString().replaceAll("-","");
|
||||
vo.setId(uuid);
|
||||
vo.setTaskStatus("1");
|
||||
vo.setPuid(puid);
|
||||
mapper.addRobotTask(vo);
|
||||
addTaskPoints(vo);
|
||||
addTaskSchedule(vo);
|
||||
|
|
@ -315,6 +321,7 @@ public class RobotServiceImpl implements IRobotService {
|
|||
vo.setId(uuid);
|
||||
vo.setTaskStatus("0");
|
||||
vo.setTaskId(vo.getRobotId()+"_"+ DateUtils.dateTimeNow());
|
||||
vo.setVersion("1");
|
||||
mapper.addRobotTask(vo);
|
||||
addTaskPoints(vo);
|
||||
addTaskSchedule(vo);
|
||||
|
|
@ -328,19 +335,50 @@ public class RobotServiceImpl implements IRobotService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult issuedTask(PatrolTask vo) {
|
||||
try{
|
||||
String token=QxVideotape.login(TVideoConfigUtil.getMaps(),TVideoConfigUtil.Q2HTTPURL);
|
||||
String xml2= QxUtils.getParamData(XxmSendUtils.QUERY,XxmSendUtils.ROBOT_TASK_LIST);
|
||||
String res2=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,vo.getPuid(),xml2);
|
||||
JSONArray array= XmlUtils.getRobotTask(res2);
|
||||
List<PatrolTask> list2= JSONArray.parseArray(array.toString(),PatrolTask.class);
|
||||
RobotTask vo2=new RobotTask();
|
||||
vo2.setPatrolTasks(list2);
|
||||
String data= QxUtils.setRobotInspection(XxmSendUtils.SET,XxmSendUtils.ROBOT_TASK_LIST,vo2);
|
||||
String res3=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,vo.getPuid(),data);
|
||||
// mapper.updateTaskStatus(vo);
|
||||
//下发任务
|
||||
RobotTask robotTask=new RobotTask();
|
||||
//进行任务查询
|
||||
List<PatrolTask> list=mapper.queryTaskList();
|
||||
for (PatrolTask patrolTask:list){
|
||||
getTaskPositions(patrolTask);
|
||||
getTaskSchedule(patrolTask);
|
||||
}
|
||||
robotTask.setPatrolTasks(list);
|
||||
String xml= QxUtils.setRobotInspection(XxmSendUtils.SET,XxmSendUtils.ROBOT_TASK_LIST,robotTask);
|
||||
|
||||
|
||||
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,vo.getPuid(),xml);
|
||||
return AjaxResult.success(XmlUtils.getSuccess(res));
|
||||
}catch (Exception e){
|
||||
log.error(e.toString());
|
||||
}
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
|
||||
public AjaxResult updateRobotTask(String puid){
|
||||
String token=QxVideotape.login(TVideoConfigUtil.getMaps(),TVideoConfigUtil.Q2HTTPURL);
|
||||
mapper.updateTaskStatus(vo);
|
||||
//下发任务
|
||||
RobotTask robotTask=new RobotTask();
|
||||
//进行任务查询
|
||||
List<PatrolTask> list=mapper.queryTaskList();
|
||||
for (PatrolTask patrolTask:list){
|
||||
getTaskPositions(patrolTask);
|
||||
getTaskSchedule(patrolTask);
|
||||
getTaskPositions(patrolTask);
|
||||
getTaskSchedule(patrolTask);
|
||||
}
|
||||
robotTask.setPatrolTasks(list);
|
||||
String xml= QxUtils.setRobotInspection(XxmSendUtils.SET,XxmSendUtils.ROBOT_TASK_LIST,robotTask);
|
||||
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,vo.getPuid(),xml);
|
||||
String res=QxVideotape.sendXmlPost(token,TVideoConfigUtil.Q2HTTPURL,puid,xml);
|
||||
return AjaxResult.success(XmlUtils.getSuccess(res));
|
||||
}
|
||||
|
||||
|
|
@ -417,6 +455,46 @@ public class RobotServiceImpl implements IRobotService {
|
|||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult delTaskData(PatrolTask vo) {
|
||||
try{
|
||||
mapper.delTasks(vo.getId());
|
||||
List<Position> positions = vo.getPositions();
|
||||
if(positions!=null){
|
||||
for (Position position : positions) {
|
||||
mapper.delTaskPoint(position.getId());
|
||||
List<Action> actions = position.getActions();
|
||||
if(actions!=null){
|
||||
for (Action action : actions) {
|
||||
mapper.delTaskPointAction(action.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Schedule> schedules = vo.getSchedule();
|
||||
if (schedules != null) {
|
||||
for (Schedule schedule : schedules) {
|
||||
mapper.delSchedule(schedule.getId());
|
||||
List<Time> times = schedule.getTime();
|
||||
if(times!=null){
|
||||
for (Time time : times) {
|
||||
mapper.delScheduleTime(time.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return updateRobotTask(vo.getPuid());
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询任务时间
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ public class PatrolTask {
|
|||
*/
|
||||
private String taskStatus;
|
||||
|
||||
|
||||
private String puid;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ spring:
|
|||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.0.14
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 2005
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 7
|
||||
# 密码
|
||||
password: Xbzbns@Redis123!
|
||||
# password: Xbzbns@Redis123!
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.bonus.business.mapper.RobotMapper">
|
||||
<insert id="addRobotTask">
|
||||
insert into robot_tasks(
|
||||
id,task_id, enables,counts,task_name,vresion,robot_name,robot_id,map_name,map_id,charge_enable,task_status
|
||||
)values (#{id},#{taskId},#{enable},#{count},#{taskName},#{version},#{robotName},#{robotId},#{mapName},#{mapId},#{chargeEnable},#{taskStatus})
|
||||
id,task_id, enables,counts,task_name,vresion,robot_name,robot_id,map_name,map_id,charge_enable,task_status,puid
|
||||
)values (#{id},#{taskId},#{enable},#{count},#{taskName},#{version},#{robotName},#{robotId},#{mapName},#{mapId},#{chargeEnable},#{taskStatus},#{puid})
|
||||
</insert>
|
||||
<insert id="addTaskPoints">
|
||||
insert into robot_task_point(
|
||||
|
|
@ -37,7 +37,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
</insert>
|
||||
<update id="updateTaskStatus">
|
||||
update robot_tasks set task_status=1
|
||||
update robot_tasks set
|
||||
<if test="taskStatus!=null and taskStatus!=''">
|
||||
task_status=#{taskStatus}
|
||||
</if>
|
||||
<if test="enable!=null and enable!=''">
|
||||
enables=#{enable}
|
||||
</if>
|
||||
where id=#{id}
|
||||
</update>
|
||||
<update id="updateTask">
|
||||
|
|
@ -66,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
|
||||
<select id="getTaskList" resultType="com.bonus.business.vo.PatrolTask">
|
||||
select id, task_id , enables enable,
|
||||
select id, task_id taskId, enables enable,
|
||||
counts `count`, task_name taskName,
|
||||
vresion version, robot_name robotName,
|
||||
robot_id robotId, map_name mapName,puid,
|
||||
|
|
@ -103,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM
|
||||
robot_tasks
|
||||
WHERE
|
||||
task_status =1
|
||||
task_status =1 and enables=1
|
||||
</select>
|
||||
<select id="getTaskPoints" resultType="com.bonus.business.vo.Position">
|
||||
select id,task_id taskId, position_id positionId, position_x x,
|
||||
|
|
|
|||
Loading…
Reference in New Issue