opt:1.管理后台系统优化国际化。2.添加巡航模式任务接口。
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package org.nl.schedule.modular.setting.controller;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.nl.schedule.modular.setting.param.NetworkParam;
|
||||
import org.nl.schedule.modular.setting.service.ScheduleSettingService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/3/2
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schedule/setting")
|
||||
public class ScheduleSettingController {
|
||||
|
||||
@Resource
|
||||
private ScheduleSettingService scheduleSettingService;
|
||||
|
||||
@PostMapping("/networkOperation")
|
||||
public ResponseEntity<Object> networkOperation(@RequestBody NetworkParam param){
|
||||
return new ResponseEntity<>(scheduleSettingService.networkOperation(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.schedule.modular.setting.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/3/2
|
||||
*/
|
||||
@Data
|
||||
public class NetworkParam {
|
||||
/**
|
||||
* 命令 取值范围:[connect,disconnect,status,scan],分别是连接,断开,wifi状态,扫描wifi
|
||||
*/
|
||||
private String command;
|
||||
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String agvId;
|
||||
|
||||
/**
|
||||
* wifi名称
|
||||
*/
|
||||
private String ssid;
|
||||
|
||||
/**
|
||||
* wifi密码
|
||||
*/
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.schedule.modular.setting.service;
|
||||
|
||||
import org.nl.response.WebResponse;
|
||||
import org.nl.schedule.modular.setting.param.NetworkParam;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/3/2
|
||||
*/
|
||||
public interface ScheduleSettingService {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
WebResponse networkOperation(NetworkParam param);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.nl.schedule.modular.setting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.response.WebResponse;
|
||||
import org.nl.schedule.modular.setting.param.NetworkParam;
|
||||
import org.nl.schedule.modular.setting.service.ScheduleSettingService;
|
||||
import org.nl.util.URLConstant;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/3/2
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ScheduleSettingServiceImpl implements ScheduleSettingService {
|
||||
|
||||
@Override
|
||||
public WebResponse networkOperation(NetworkParam param) {
|
||||
if (ObjectUtil.isEmpty(param)){
|
||||
throw new BadRequestException(LangProcess.msg("schedule_wifi_param_empty"));
|
||||
}
|
||||
log.info("调度网络操作参数:{}", param);
|
||||
HttpResponse result = null;
|
||||
try {
|
||||
result = HttpRequest.post(URLConstant.SCHEDULE_IP_PORT+"/system/network/wifi")
|
||||
.body(String.valueOf(JSONObject.toJSON(param)))
|
||||
.execute();
|
||||
if (result !=null && result.isOk()){
|
||||
log.info("调度网络操作响应结果:{}",result.body());
|
||||
return WebResponse.requestParamOk(JSON.parseObject(result.body()));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.info("调度网络操作参数失败");
|
||||
}
|
||||
throw new BadRequestException(LangProcess.msg("schedule_wifi_param_error"));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.schedule.modular.task.provider;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
@@ -7,6 +8,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.api.schedule.task.api.ScheduleTaskAPI;
|
||||
import org.nl.api.schedule.task.core.ScheduleAPICreateCruiseTaskParam;
|
||||
import org.nl.api.schedule.task.core.ScheduleAPICreateOneClickTaskParam;
|
||||
import org.nl.api.schedule.task.core.ScheduleAPICreateTaskParam;
|
||||
import org.nl.config.language.LangProcess;
|
||||
@@ -15,6 +17,8 @@ import org.nl.schedule.core.util.ScheduleUtil;
|
||||
import org.nl.util.URLConstant;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/12/1
|
||||
@@ -181,4 +185,51 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse createCruiseTask(ScheduleAPICreateCruiseTaskParam param) {
|
||||
String task_code = param.getTask_code();
|
||||
List<String> destinations = param.getDestinations();
|
||||
String type = param.getType();
|
||||
if (StrUtil.isBlank(task_code)){
|
||||
throw new BadRequestException(LangProcess.msg("schedule_task_code_empty"));
|
||||
}
|
||||
if (ObjectUtil.isEmpty(destinations)){
|
||||
throw new BadRequestException(LangProcess.msg("schedule_destinations_empty"));
|
||||
}
|
||||
if (StrUtil.isBlank(type)){
|
||||
throw new BadRequestException(LangProcess.msg("schedule_operation_type_empty"));
|
||||
}
|
||||
|
||||
JSONObject request_body = new JSONObject();
|
||||
request_body.put("deadline", ScheduleUtil.getNextDay(1));
|
||||
if (StrUtil.isNotBlank(param.getVehicle_number())){
|
||||
request_body.put("intendedVehicle", param.getVehicle_number());
|
||||
}
|
||||
JSONArray body_destinations = new JSONArray();
|
||||
for (String destination : destinations){
|
||||
JSONObject body_destination = new JSONObject();
|
||||
body_destination.put("locationName", destination);
|
||||
body_destination.put("operation", type);
|
||||
body_destinations.add(body_destination);
|
||||
}
|
||||
request_body.put("destinations", body_destinations);
|
||||
if (StrUtil.isNotBlank(param.getPriority())){
|
||||
request_body.put("priority", Integer.parseInt(param.getPriority()));
|
||||
}
|
||||
|
||||
log.info("下发调度巡航任务参数:{}", request_body);
|
||||
HttpResponse result = null;
|
||||
try {
|
||||
result = HttpRequest
|
||||
.post(URLConstant.SCHEDULE_IP_PORT+"/tasks/"+param.getTask_code())
|
||||
.body(String.valueOf(request_body))
|
||||
.execute();
|
||||
|
||||
log.info("下发调度巡航任务响应结果:{}",result.body());
|
||||
}catch (Exception e){
|
||||
log.error("下发调度巡航任务失败:{}",e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,4 +78,9 @@ public class VehicleInfoDto{
|
||||
* 最后更新时间
|
||||
*/
|
||||
private String lastUpdated;
|
||||
|
||||
/**
|
||||
* 车辆模式(0配送,1循环)
|
||||
*/
|
||||
private String vehicleMode;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.api.setting.api.SettingAPI;
|
||||
import org.nl.api.sys.anomalyInfo.api.ErrorInfoAPI;
|
||||
import org.nl.api.task.api.TaskAPI;
|
||||
import org.nl.response.WebResponse;
|
||||
@@ -43,6 +44,9 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
@Resource
|
||||
private ErrorInfoAPI errorInfoAPI;
|
||||
|
||||
@Resource
|
||||
private SettingAPI settingAPI;
|
||||
|
||||
/**
|
||||
* 定时更新车辆信息(每秒执行)
|
||||
*/
|
||||
@@ -60,6 +64,8 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
if (vehicle.getError_code()!=0) {
|
||||
vehicle.setError_info(errorInfoAPI.queryErrorInfoByCode(vehicle.getError_code()));
|
||||
}
|
||||
// 查询车辆模式
|
||||
vehicle.setVehicleMode(settingAPI.querySettingParamByCode("mode").getJSONObject("data").getString("value"));
|
||||
vehicleCache.put(vehicle.getVehicleNumber(), vehicle);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user