opt:1.后端国际化完成。

This commit is contained in:
2026-02-04 10:36:38 +08:00
parent 6c9c1c95e4
commit ab393a8fee
9 changed files with 372 additions and 48 deletions

View File

@@ -8,6 +8,7 @@ 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.util.URLConstant;
import org.springframework.stereotype.Service;
@@ -23,7 +24,7 @@ public class ScheduleSettingAPIProvider implements ScheduleSettingAPI {
@Override
public HttpResponse settingSpeed(ScheduleAPISettingSpeedParam scheduleAPISettingSpeedParam) {
if (ObjectUtil.isEmpty(scheduleAPISettingSpeedParam)){
throw new BadRequestException("调度设置配送速度参数不能为空");
throw new BadRequestException(LangProcess.msg("schedule_speed_param_empty"));
}
log.info("设置调度配送速度参数:{}", scheduleAPISettingSpeedParam);
HttpResponse result = null;
@@ -41,7 +42,7 @@ public class ScheduleSettingAPIProvider implements ScheduleSettingAPI {
@Override
public HttpResponse settingCharge(ScheduleAPISettingChargeParam scheduleAPISettingChargeParam) {
if (ObjectUtil.isEmpty(scheduleAPISettingChargeParam)){
throw new BadRequestException("调度设置充电参数不能为空");
throw new BadRequestException(LangProcess.msg("schedule_charge_param_empty"));
}
log.info("设置调度充电参数:{}", scheduleAPISettingChargeParam);
HttpResponse result = null;

View File

@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.api.schedule.task.api.ScheduleTaskAPI;
import org.nl.api.schedule.task.core.ScheduleAPICreateOneClickTaskParam;
import org.nl.api.schedule.task.core.ScheduleAPICreateTaskParam;
import org.nl.config.language.LangProcess;
import org.nl.exception.BadRequestException;
import org.nl.schedule.core.util.ScheduleUtil;
import org.nl.util.URLConstant;
@@ -28,13 +29,13 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
String destinations = scheduleAPICreateTaskParam.getDestinations();
String type = scheduleAPICreateTaskParam.getType();
if (StrUtil.isBlank(task_code)){
throw new BadRequestException("任务号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_task_code_empty"));
}
if (StrUtil.isBlank(destinations)){
throw new BadRequestException("目标点不能为空");
throw new BadRequestException(LangProcess.msg("schedule_destinations_empty"));
}
if (StrUtil.isBlank(type)){
throw new BadRequestException("任务操作类型不能为空");
throw new BadRequestException(LangProcess.msg("schedule_operation_type_empty"));
}
JSONObject request_body = new JSONObject();
@@ -70,7 +71,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
@Override
public HttpResponse cancelTask(String taskId) {
if (StrUtil.isBlank(taskId)){
throw new BadRequestException("任务号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_task_code_empty"));
}
log.info("取消调度任务参数:{}", taskId);
HttpResponse result = null;
@@ -90,7 +91,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
@Override
public HttpResponse queryTaskStatusByTaskId(String taskId) {
if (StrUtil.isBlank(taskId)){
throw new BadRequestException("任务号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_task_code_empty"));
}
log.info("查询调度任务状态参数:{}", taskId);
HttpResponse result = null;
@@ -109,7 +110,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
@Override
public HttpResponse pauseTask(String taskId) {
if (StrUtil.isBlank(taskId)){
throw new BadRequestException("任务号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_task_code_empty"));
}
log.info("暂停调度任务参数:{}", taskId);
HttpResponse result = null;
@@ -129,7 +130,7 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
@Override
public HttpResponse resumeTask(String taskId) {
if (StrUtil.isBlank(taskId)){
throw new BadRequestException("任务号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_task_code_empty"));
}
log.info("恢复调度任务参数:{}", taskId);
HttpResponse result = null;
@@ -152,13 +153,13 @@ public class ScheduleTaskAPIProvider implements ScheduleTaskAPI {
String type = scheduleAPICreateOneClickTaskParam.getType();
String vehicleNumber = scheduleAPICreateOneClickTaskParam.getVehicle_number();
if (StrUtil.isBlank(task_code)){
throw new BadRequestException("任务号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_task_code_empty"));
}
if (StrUtil.isBlank(type)){
throw new BadRequestException("任务操作类型不能为空");
throw new BadRequestException(LangProcess.msg("schedule_operation_type_empty"));
}
if (StrUtil.isBlank(vehicleNumber)){
throw new BadRequestException("车号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_vehicle_number_empty"));
}
JSONObject request_body = new JSONObject();

View File

@@ -6,6 +6,7 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.nl.api.setting.api.SettingAPI;
import org.nl.api.task.api.TaskAPI;
import org.nl.config.language.LangProcess;
import org.nl.enums.YesOrNoEnum;
import org.nl.exception.BadRequestException;
import org.nl.response.WebResponse;
@@ -35,22 +36,22 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
String vehicle_number = scheduleTaskArrivedReportParam.getVehicle_number();
String task_code = scheduleTaskArrivedReportParam.getTask_code();
if (StrUtil.isBlank(location)) {
throw new BadRequestException("上报点位不能为空");
throw new BadRequestException(LangProcess.msg("schedule_report_location_empty"));
}
if (StrUtil.isBlank(vehicle_number)) {
throw new BadRequestException("上报车号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_report_vehicle_empty"));
}
if (StrUtil.isBlank(task_code)) {
throw new BadRequestException("上报任务号不能为空");
throw new BadRequestException(LangProcess.msg("schedule_report_task_code_empty"));
}
log.info("调度上报到达,参数:{}",scheduleTaskArrivedReportParam);
String status = taskAPI.taskOperationConfirm(task_code,vehicle_number);
if (StrUtil.isBlank(status)){
throw new BadRequestException("未找到该上报阶段");
throw new BadRequestException(LangProcess.msg("schedule_report_stage_not_found"));
}
ScheduleTaskReportStatusEnum scheduleTaskReportStatusEnum = ScheduleTaskReportStatusEnum.getByCode(status);
if (scheduleTaskReportStatusEnum == null) {
throw new BadRequestException("未找到该上报类型");
throw new BadRequestException(LangProcess.msg("schedule_report_type_not_found"));
}
boolean flag = false;
@@ -83,6 +84,6 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
return WebResponse.requestOk();
}
throw new BadRequestException("未确认操作");
throw new BadRequestException(LangProcess.msg("schedule_operation_not_confirmed"));
}
}