add:1.添加复位按钮接口。2.添加手机app导出任务excel接口。
This commit is contained in:
@@ -298,6 +298,13 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- EasyExcel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.1.1</version>
|
||||
</dependency>
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.agv.entity;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -21,60 +22,77 @@ public class TaskInfo implements Serializable {
|
||||
private String taskUuid;
|
||||
|
||||
@TableField("task_code")
|
||||
@ExcelProperty("任务号(taskCode)")
|
||||
private String taskCode;
|
||||
|
||||
@TableField("task_type")
|
||||
@ExcelProperty("任务类型(taskType)")
|
||||
private String taskType;
|
||||
|
||||
@TableField("task_type_name")
|
||||
private String taskTypeName;
|
||||
|
||||
@TableField("en_task_type_name")
|
||||
@ExcelProperty("任务类型名称(英文)")
|
||||
private String enTaskTypeName;
|
||||
|
||||
@TableField("zh_task_type_name")
|
||||
@ExcelProperty("任务类型名称(中文)")
|
||||
private String zhTaskTypeName;
|
||||
|
||||
@TableField("task_status")
|
||||
@ExcelProperty("任务状态(taskStatus)")
|
||||
private String taskStatus;
|
||||
|
||||
@TableField("task_status_name")
|
||||
private String taskStatusName;
|
||||
|
||||
@TableField("en_task_status_name")
|
||||
@ExcelProperty("任务状态名称(英文)")
|
||||
private String enTaskStatusName;
|
||||
|
||||
@TableField("zh_task_status_name")
|
||||
@ExcelProperty("任务状态名称(中文)")
|
||||
private String zhTaskStatusName;
|
||||
|
||||
@TableField("next_point_code")
|
||||
@ExcelProperty("目标点(nextPointCode)")
|
||||
private String nextPointCode;
|
||||
|
||||
@TableField("next_point_code2")
|
||||
@ExcelProperty("下一个点")
|
||||
private String nextPointCode2;
|
||||
|
||||
@TableField("is_delete")
|
||||
@ExcelProperty("是否已经删除")
|
||||
private String isDelete;
|
||||
|
||||
@TableField("seq_num")
|
||||
@ExcelProperty("排序号")
|
||||
private BigDecimal seqNum;
|
||||
|
||||
@TableField("date")
|
||||
@ExcelProperty("日期")
|
||||
private String date;
|
||||
|
||||
@TableField("create_by")
|
||||
@ExcelProperty("创建者")
|
||||
private String createBy;
|
||||
|
||||
@TableField("create_time")
|
||||
@ExcelProperty("创建时间")
|
||||
private String createTime;
|
||||
|
||||
@TableField("is_manualfinished")
|
||||
@ExcelProperty("人工是否完成")
|
||||
private String isManualfinished;
|
||||
|
||||
@TableField("update_by")
|
||||
@ExcelProperty("修改者")
|
||||
private String updateBy;
|
||||
|
||||
@TableField("update_time")
|
||||
@ExcelProperty("修改时间")
|
||||
private String updateTime;
|
||||
|
||||
@TableField("step")
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.agv.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import org.nl.agv.entity.TaskInfo;
|
||||
import org.nl.agv.service.TaskService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/12/9
|
||||
*/
|
||||
@SaIgnore
|
||||
@RestController
|
||||
@RequestMapping("/api/taskExcel")
|
||||
public class ExcelDownloadController {
|
||||
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
@GetMapping("/taskInfo")
|
||||
public void taskInfo(HttpServletResponse response, @RequestParam long recentMonth) throws IOException {
|
||||
|
||||
List<TaskInfo> taskInfoList = taskService.findTaskByRecentMonth(recentMonth);
|
||||
|
||||
// 设置响应头
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("任务信息.xlsx", "UTF-8"));
|
||||
|
||||
// 使用EasyExcel写入数据到响应输出流
|
||||
EasyExcel.write(response.getOutputStream(), TaskInfo.class)
|
||||
.sheet("任务信息")
|
||||
.doWrite(taskInfoList);
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,13 @@ public class VehicleInfoController{
|
||||
return new ResponseEntity<>(vehicleInfoService.Shut_down(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/resetButton")
|
||||
@Log("复位按钮")
|
||||
@ApiOperation("复位按钮")
|
||||
public ResponseEntity<Object> resetButton() {
|
||||
return new ResponseEntity<>(vehicleInfoService.ResetButton(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryControlStatus")
|
||||
@Log("查询车辆控制按钮状态")
|
||||
@ApiOperation("查询车辆控制按钮状态")
|
||||
|
||||
@@ -5,6 +5,7 @@ package org.nl.agv.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.agv.entity.TaskInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -87,4 +88,5 @@ public interface TaskService extends IService<TaskInfo> {
|
||||
*/
|
||||
Map<String, Object> findTaskStatusByCode(Map<String, String> jsonObject);
|
||||
|
||||
List<TaskInfo> findTaskByRecentMonth(long recentMonth);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,13 @@ public interface VehicleInfoService {
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> Shut_down(Map<String, String> jsonObject);
|
||||
/**
|
||||
* 复位按钮
|
||||
*
|
||||
* @param
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> ResetButton();
|
||||
/**
|
||||
* 跳过起点
|
||||
*
|
||||
|
||||
@@ -744,7 +744,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
if (ObjectUtil.isNotEmpty(taskjo) && StrUtil.equals("0", debugInfoJson.getString("PathFollow_Enable")) && debugInfoJson.getString("CurNodeID").equals(taskjo.getString("next_point_code"))) {
|
||||
//普通任务
|
||||
if (TaskTypeEnum.COMMON.getCode().equals(taskjo.getString("task_type"))) {
|
||||
updateTaskStatus(taskjo, null);
|
||||
updateTaskStatus(taskjo, TaskStatusEnum.END);
|
||||
if (StringUtils.isNotBlank(taskjo.getString("next_point_code2"))) {
|
||||
createReturnTask(taskjo);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import edu.wpi.rail.jrosbridge.services.ServiceResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -52,6 +53,9 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -605,6 +609,21 @@ public class TaskServiceServiceImpl extends ServiceImpl<TaskInfoMapper, TaskInfo
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskInfo> findTaskByRecentMonth(long recentMonth) {
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate startDate = today.minusMonths(recentMonth);
|
||||
|
||||
// 开始时间:几个月前那天的0点
|
||||
LocalDateTime startDateTime = startDate.atStartOfDay();
|
||||
// 结束时间:今天的23:59:59
|
||||
LocalDateTime endDateTime = today.atTime(LocalTime.MAX);
|
||||
|
||||
return taskInfoMapper.selectList(new LambdaQueryWrapper<>(TaskInfo.class)
|
||||
.ge(TaskInfo::getCreateTime,startDateTime)
|
||||
.le(TaskInfo::getCreateTime,endDateTime));
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Map<String, Object> confirmPoint1(Map<String, String> jsonObject) {
|
||||
// String pointCode = jsonObject.get("point_code");
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -165,6 +166,15 @@ public class VehicleInfoServiceImpl implements VehicleInfoService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> ResetButton() {
|
||||
sendToAgvUtil.sendTalker();
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", LangUtils.getMsgLanguage("OperationSuccess", null));
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> skipStartPoint(Map<String, String> jsonObject) {
|
||||
String a = "{\n" + " \"header\": {\n" + " \"stamp\": {\n" + " \"secs\": 0,\n" + " \"nsecs\": 0\n" + " },\n" + " \"frame_id\": \"\",\n" + " \"seq\": 0\n" + " },\n" + " \"id\": 257,\n" + " \"is_rtr\": false,\n" + " \"is_extended\": false,\n" + " \"is_error\": false,\n" + " \"dlc\": 8,\n" + " \"data\": [32, 0, 0, 1, 0, 0, 0, 1]\n" + "}";
|
||||
|
||||
@@ -78,6 +78,32 @@ public class sendToAgvUtil{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static ServiceResponse sendTalker() {
|
||||
//Ros ros = RosUtil.getRos();
|
||||
Ros ros = RosUtil.getRos();
|
||||
ros.connect();
|
||||
Topic echo = new Topic(ros, "/js_can", "lu_ps20l_msgs/Msg_CANFrame");
|
||||
JSONArray data = new JSONArray();
|
||||
data.add(32);
|
||||
data.add(0);
|
||||
data.add(0);
|
||||
data.add(1);
|
||||
data.add(0);
|
||||
data.add(0);
|
||||
data.add(0);
|
||||
data.add(4);
|
||||
String a = "{\n" + " \"header\": {\n" + " \"stamp\": {\n" + " \"secs\": 0,\n" + " \"nsecs\": 0\n" + " },\n" + " \"frame_id\": \"\",\n" + " \"seq\": 0\n" + " },\n" + " \"id\": 257,\n" + " \"is_rtr\": false,\n" + " \"is_extended\": false,\n" + " \"is_error\": false,\n" + " \"dlc\": 8,\n" + " \"data\": [32, 0, 0, 1, 0, 0, 0, 4]\n" + "}";
|
||||
JSONObject taskjo = JSONObject.parseObject(a);
|
||||
taskjo.put("data", data);
|
||||
Log.info("下发复位按钮参数:{}",taskjo);
|
||||
Message toSend = new Message(taskjo.toString());
|
||||
echo.publish(toSend);
|
||||
ros.disconnect();
|
||||
Log.info("下发复位按钮完成");
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONObject change(String point_code) {
|
||||
//范围是-32768 ~ 32767
|
||||
JSONObject returnjo = new JSONObject();
|
||||
|
||||
@@ -4,7 +4,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
@@ -56,6 +56,7 @@ demo:
|
||||
security:
|
||||
# 排除路径
|
||||
excludes:
|
||||
- /api/taskExcel
|
||||
# 认证
|
||||
- /auth/login
|
||||
- /auth/code
|
||||
|
||||
Reference in New Issue
Block a user