opt:1.Param中@NotBlank和@NotNull国际化。2.音量设置接口。
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package org.nl.schedule.modular.setting.controller;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.nl.logging.annotation.Log;
|
||||
import org.nl.schedule.modular.setting.param.NetworkParam;
|
||||
import org.nl.schedule.modular.setting.param.VolumeParam;
|
||||
import org.nl.schedule.modular.setting.service.ScheduleSettingService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -15,14 +17,21 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* 2026/3/2
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/schedule/setting")
|
||||
@RequestMapping("/schedule/setting/")
|
||||
public class ScheduleSettingController {
|
||||
|
||||
@Resource
|
||||
private ScheduleSettingService scheduleSettingService;
|
||||
|
||||
@Log("调度网络操作")
|
||||
@PostMapping("/networkOperation")
|
||||
public ResponseEntity<Object> networkOperation(@RequestBody NetworkParam param){
|
||||
return new ResponseEntity<>(scheduleSettingService.networkOperation(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("设置车辆音量")
|
||||
@PostMapping("/settingVolume")
|
||||
public ResponseEntity<Object> settingVolume(@RequestBody VolumeParam param){
|
||||
return new ResponseEntity<>(scheduleSettingService.settingVolume(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.nl.schedule.modular.setting.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2026/3/4
|
||||
*/
|
||||
@Data
|
||||
public class VolumeParam {
|
||||
|
||||
/**
|
||||
* 音量
|
||||
*/
|
||||
private Integer volume;
|
||||
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String agvId;
|
||||
|
||||
}
|
||||
@@ -4,12 +4,16 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.api.schedule.setting.api.ScheduleSettingAPI;
|
||||
import org.nl.api.schedule.setting.core.ScheduleAPISettingChargeParam;
|
||||
import org.nl.api.schedule.setting.core.ScheduleAPISettingSpeedParam;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.response.WebResponse;
|
||||
import org.nl.schedule.modular.setting.param.VolumeParam;
|
||||
import org.nl.schedule.modular.setting.service.ScheduleSettingService;
|
||||
import org.nl.util.URLConstant;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -21,6 +25,9 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class ScheduleSettingAPIProvider implements ScheduleSettingAPI {
|
||||
|
||||
@Resource
|
||||
private ScheduleSettingService scheduleSettingService;
|
||||
|
||||
@Override
|
||||
public HttpResponse settingSpeed(ScheduleAPISettingSpeedParam scheduleAPISettingSpeedParam) {
|
||||
if (ObjectUtil.isEmpty(scheduleAPISettingSpeedParam)){
|
||||
@@ -56,4 +63,12 @@ public class ScheduleSettingAPIProvider implements ScheduleSettingAPI {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebResponse settingVolume(Integer volume, String agvId) {
|
||||
VolumeParam param = new VolumeParam();
|
||||
param.setAgvId(agvId);
|
||||
param.setVolume(volume);
|
||||
return scheduleSettingService.settingVolume(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.schedule.modular.setting.service;
|
||||
|
||||
import org.nl.response.WebResponse;
|
||||
import org.nl.schedule.modular.setting.param.NetworkParam;
|
||||
import org.nl.schedule.modular.setting.param.VolumeParam;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
@@ -10,9 +11,17 @@ import org.nl.schedule.modular.setting.param.NetworkParam;
|
||||
public interface ScheduleSettingService {
|
||||
|
||||
/**
|
||||
*
|
||||
* 网络操作
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
WebResponse networkOperation(NetworkParam param);
|
||||
|
||||
/**
|
||||
* 音量设置
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
WebResponse settingVolume(VolumeParam param);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.schedule.modular.setting.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -10,6 +11,7 @@ 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.param.VolumeParam;
|
||||
import org.nl.schedule.modular.setting.service.ScheduleSettingService;
|
||||
import org.nl.util.URLConstant;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -42,4 +44,28 @@ public class ScheduleSettingServiceImpl implements ScheduleSettingService {
|
||||
}
|
||||
throw new BadRequestException(LangProcess.msg("schedule_wifi_param_error"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebResponse settingVolume(VolumeParam param) {
|
||||
if (ObjectUtil.isEmpty(param.getVolume())){
|
||||
throw new BadRequestException(LangProcess.msg("schedule_volume_empty"));
|
||||
}
|
||||
if (StrUtil.isBlank(param.getAgvId())){
|
||||
throw new BadRequestException(LangProcess.msg("schedule_vehicle_number_empty"));
|
||||
}
|
||||
log.info("调度设置音量参数:{}", param);
|
||||
HttpResponse result = null;
|
||||
try {
|
||||
result = HttpRequest.put(URLConstant.SCHEDULE_IP_PORT+"/system/audio/volume")
|
||||
.body(String.valueOf(JSONObject.toJSON(param)))
|
||||
.execute();
|
||||
if (result !=null && result.isOk()){
|
||||
log.info("调度设置音量响应结果:{}",result.body());
|
||||
return WebResponse.requestOk();
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.info("调度设置音量失败");
|
||||
}
|
||||
throw new BadRequestException(LangProcess.msg("setting_volume_failed"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,18 +13,18 @@ public class ScheduleTaskArrivedReportParam {
|
||||
/**
|
||||
* 点位
|
||||
*/
|
||||
@NotBlank(message = "点位不能为空")
|
||||
@NotBlank(message = "{validation_location_empty}")
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
@NotBlank(message = "车号不能为空")
|
||||
@NotBlank(message = "{validation_vehicle_number_empty}")
|
||||
private String vehicle_number;
|
||||
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
@NotBlank(message = "任务号不能为空")
|
||||
@NotBlank(message = "{task_code_empty}")
|
||||
private String task_code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user