add:1.添加复位按钮接口。2.添加手机app导出任务excel接口。
This commit is contained in:
@@ -298,6 +298,13 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- EasyExcel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
</dependency>
|
||||||
<!-- excel工具 -->
|
<!-- excel工具 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.agv.entity;
|
package org.nl.agv.entity;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@@ -21,60 +22,77 @@ public class TaskInfo implements Serializable {
|
|||||||
private String taskUuid;
|
private String taskUuid;
|
||||||
|
|
||||||
@TableField("task_code")
|
@TableField("task_code")
|
||||||
|
@ExcelProperty("任务号(taskCode)")
|
||||||
private String taskCode;
|
private String taskCode;
|
||||||
|
|
||||||
@TableField("task_type")
|
@TableField("task_type")
|
||||||
|
@ExcelProperty("任务类型(taskType)")
|
||||||
private String taskType;
|
private String taskType;
|
||||||
|
|
||||||
@TableField("task_type_name")
|
@TableField("task_type_name")
|
||||||
private String taskTypeName;
|
private String taskTypeName;
|
||||||
|
|
||||||
@TableField("en_task_type_name")
|
@TableField("en_task_type_name")
|
||||||
|
@ExcelProperty("任务类型名称(英文)")
|
||||||
private String enTaskTypeName;
|
private String enTaskTypeName;
|
||||||
|
|
||||||
@TableField("zh_task_type_name")
|
@TableField("zh_task_type_name")
|
||||||
|
@ExcelProperty("任务类型名称(中文)")
|
||||||
private String zhTaskTypeName;
|
private String zhTaskTypeName;
|
||||||
|
|
||||||
@TableField("task_status")
|
@TableField("task_status")
|
||||||
|
@ExcelProperty("任务状态(taskStatus)")
|
||||||
private String taskStatus;
|
private String taskStatus;
|
||||||
|
|
||||||
@TableField("task_status_name")
|
@TableField("task_status_name")
|
||||||
private String taskStatusName;
|
private String taskStatusName;
|
||||||
|
|
||||||
@TableField("en_task_status_name")
|
@TableField("en_task_status_name")
|
||||||
|
@ExcelProperty("任务状态名称(英文)")
|
||||||
private String enTaskStatusName;
|
private String enTaskStatusName;
|
||||||
|
|
||||||
@TableField("zh_task_status_name")
|
@TableField("zh_task_status_name")
|
||||||
|
@ExcelProperty("任务状态名称(中文)")
|
||||||
private String zhTaskStatusName;
|
private String zhTaskStatusName;
|
||||||
|
|
||||||
@TableField("next_point_code")
|
@TableField("next_point_code")
|
||||||
|
@ExcelProperty("目标点(nextPointCode)")
|
||||||
private String nextPointCode;
|
private String nextPointCode;
|
||||||
|
|
||||||
@TableField("next_point_code2")
|
@TableField("next_point_code2")
|
||||||
|
@ExcelProperty("下一个点")
|
||||||
private String nextPointCode2;
|
private String nextPointCode2;
|
||||||
|
|
||||||
@TableField("is_delete")
|
@TableField("is_delete")
|
||||||
|
@ExcelProperty("是否已经删除")
|
||||||
private String isDelete;
|
private String isDelete;
|
||||||
|
|
||||||
@TableField("seq_num")
|
@TableField("seq_num")
|
||||||
|
@ExcelProperty("排序号")
|
||||||
private BigDecimal seqNum;
|
private BigDecimal seqNum;
|
||||||
|
|
||||||
@TableField("date")
|
@TableField("date")
|
||||||
|
@ExcelProperty("日期")
|
||||||
private String date;
|
private String date;
|
||||||
|
|
||||||
@TableField("create_by")
|
@TableField("create_by")
|
||||||
|
@ExcelProperty("创建者")
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
@TableField("create_time")
|
@TableField("create_time")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
private String createTime;
|
private String createTime;
|
||||||
|
|
||||||
@TableField("is_manualfinished")
|
@TableField("is_manualfinished")
|
||||||
|
@ExcelProperty("人工是否完成")
|
||||||
private String isManualfinished;
|
private String isManualfinished;
|
||||||
|
|
||||||
@TableField("update_by")
|
@TableField("update_by")
|
||||||
|
@ExcelProperty("修改者")
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
@TableField("update_time")
|
@TableField("update_time")
|
||||||
|
@ExcelProperty("修改时间")
|
||||||
private String updateTime;
|
private String updateTime;
|
||||||
|
|
||||||
@TableField("step")
|
@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);
|
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")
|
@PostMapping("/queryControlStatus")
|
||||||
@Log("查询车辆控制按钮状态")
|
@Log("查询车辆控制按钮状态")
|
||||||
@ApiOperation("查询车辆控制按钮状态")
|
@ApiOperation("查询车辆控制按钮状态")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package org.nl.agv.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.nl.agv.entity.TaskInfo;
|
import org.nl.agv.entity.TaskInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,4 +88,5 @@ public interface TaskService extends IService<TaskInfo> {
|
|||||||
*/
|
*/
|
||||||
Map<String, Object> findTaskStatusByCode(Map<String, String> jsonObject);
|
Map<String, Object> findTaskStatusByCode(Map<String, String> jsonObject);
|
||||||
|
|
||||||
|
List<TaskInfo> findTaskByRecentMonth(long recentMonth);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,13 @@ public interface VehicleInfoService {
|
|||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
*/
|
*/
|
||||||
Map<String, Object> Shut_down(Map<String, String> jsonObject);
|
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 (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"))) {
|
if (TaskTypeEnum.COMMON.getCode().equals(taskjo.getString("task_type"))) {
|
||||||
updateTaskStatus(taskjo, null);
|
updateTaskStatus(taskjo, TaskStatusEnum.END);
|
||||||
if (StringUtils.isNotBlank(taskjo.getString("next_point_code2"))) {
|
if (StringUtils.isNotBlank(taskjo.getString("next_point_code2"))) {
|
||||||
createReturnTask(taskjo);
|
createReturnTask(taskjo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import cn.hutool.core.util.IdUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import edu.wpi.rail.jrosbridge.services.ServiceResponse;
|
import edu.wpi.rail.jrosbridge.services.ServiceResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -52,6 +53,9 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -605,6 +609,21 @@ public class TaskServiceServiceImpl extends ServiceImpl<TaskInfoMapper, TaskInfo
|
|||||||
return returnjo;
|
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
|
// @Override
|
||||||
// public Map<String, Object> confirmPoint1(Map<String, String> jsonObject) {
|
// public Map<String, Object> confirmPoint1(Map<String, String> jsonObject) {
|
||||||
// String pointCode = jsonObject.get("point_code");
|
// String pointCode = jsonObject.get("point_code");
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
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
|
@Override
|
||||||
public Map<String, Object> skipStartPoint(Map<String, String> jsonObject) {
|
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" + "}";
|
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;
|
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) {
|
public static JSONObject change(String point_code) {
|
||||||
//范围是-32768 ~ 32767
|
//范围是-32768 ~ 32767
|
||||||
JSONObject returnjo = new JSONObject();
|
JSONObject returnjo = new JSONObject();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ spring:
|
|||||||
freemarker:
|
freemarker:
|
||||||
check-template-location: false
|
check-template-location: false
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: prod
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
data:
|
data:
|
||||||
@@ -56,6 +56,7 @@ demo:
|
|||||||
security:
|
security:
|
||||||
# 排除路径
|
# 排除路径
|
||||||
excludes:
|
excludes:
|
||||||
|
- /api/taskExcel
|
||||||
# 认证
|
# 认证
|
||||||
- /auth/login
|
- /auth/login
|
||||||
- /auth/code
|
- /auth/code
|
||||||
|
|||||||
Reference in New Issue
Block a user