opt:1.后端国际化完成。
This commit is contained in:
@@ -13,6 +13,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.enums.YesOrNoEnum;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.response.WebResponse;
|
||||
@@ -57,11 +58,11 @@ public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> impl
|
||||
String setting_value = updateSettingParam.getValue();
|
||||
|
||||
if (StrUtil.isBlank(setting_code)){
|
||||
throw new BadRequestException("设置编号不能为空");
|
||||
throw new BadRequestException(LangProcess.msg("setting_code_empty"));
|
||||
}
|
||||
SettingCodeEnum settingCodeEnum = SettingCodeEnum.getByCode(setting_code);
|
||||
if (settingCodeEnum == null){
|
||||
throw new BadRequestException("未找到该设置编码");
|
||||
throw new BadRequestException(LangProcess.msg("setting_code_not_found"));
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -74,7 +75,7 @@ public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> impl
|
||||
case DELIVERY_SPEED:
|
||||
log.info("修改配送速度");
|
||||
if (StrUtil.isBlank(setting_value)){
|
||||
throw new BadRequestException("修改配送速度,设置值不能为空");
|
||||
throw new BadRequestException(LangProcess.msg("setting_speed_value_empty"));
|
||||
}
|
||||
ScheduleAPISettingSpeedParam scheduleAPISettingSpeedParam = new ScheduleAPISettingSpeedParam();
|
||||
// 前端值是0.1-1.0
|
||||
@@ -82,7 +83,7 @@ public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> impl
|
||||
scheduleAPISettingSpeedParam.setCustomSpeed(customSpeed);
|
||||
HttpResponse speedResult = scheduleSettingAPI.settingSpeed(scheduleAPISettingSpeedParam);
|
||||
if (speedResult == null || !speedResult.isOk()){
|
||||
throw new BadRequestException("设置调度配送速度失败");
|
||||
throw new BadRequestException(LangProcess.msg("setting_speed_failed"));
|
||||
}
|
||||
break;
|
||||
case FAR_CALL:
|
||||
@@ -97,7 +98,7 @@ public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> impl
|
||||
case AUTOMATIC_RECHARGE:
|
||||
log.info("修改自动回充");
|
||||
if (StrUtil.isBlank(setting_value) || StrUtil.isBlank(is_active) ){
|
||||
throw new BadRequestException("修改自动回充,设置值和是否启用值不能为空");
|
||||
throw new BadRequestException(LangProcess.msg("setting_auto_charge_value_empty"));
|
||||
}
|
||||
ScheduleAPISettingChargeParam scheduleAPISettingFreeChargeThreshold = new ScheduleAPISettingChargeParam();
|
||||
// 调度有默认强制充电阈值(不接任务),目前我们设置的是空闲无任务时车辆自动去充电的阈值。如果没启用将阈值设置成0。
|
||||
@@ -106,13 +107,13 @@ public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> impl
|
||||
);
|
||||
HttpResponse freeChargeResult = scheduleSettingAPI.settingCharge(scheduleAPISettingFreeChargeThreshold);
|
||||
if (freeChargeResult == null || !freeChargeResult.isOk()){
|
||||
throw new BadRequestException("设置调度自由充电阈值失败");
|
||||
throw new BadRequestException(LangProcess.msg("setting_free_charge_failed"));
|
||||
}
|
||||
break;
|
||||
case CAN_IT_BE_CALLED_WHILE_CHARGING:
|
||||
log.info("修改充电时是否可呼叫");
|
||||
if (StrUtil.isBlank(setting_value) || StrUtil.isBlank(is_active) ){
|
||||
throw new BadRequestException("修改充电时是否可呼叫,设置值和是否启用值不能为空");
|
||||
throw new BadRequestException(LangProcess.msg("setting_charge_call_value_empty"));
|
||||
}
|
||||
ScheduleAPISettingChargeParam scheduleAPISettingUsableForTaskThreshold = new ScheduleAPISettingChargeParam();
|
||||
// 如果充电时不可呼叫,将阈值改成100。
|
||||
@@ -121,7 +122,7 @@ public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> impl
|
||||
);
|
||||
HttpResponse chargeResult = scheduleSettingAPI.settingCharge(scheduleAPISettingUsableForTaskThreshold);
|
||||
if (chargeResult == null || !chargeResult.isOk()){
|
||||
throw new BadRequestException("设置调度可接任务阈值失败");
|
||||
throw new BadRequestException(LangProcess.msg("setting_usable_task_failed"));
|
||||
}
|
||||
break;
|
||||
case SCREEN_PASSWORD:
|
||||
@@ -140,7 +141,7 @@ public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> impl
|
||||
);
|
||||
}catch (Exception e){
|
||||
log.info("更新设置失败:{}",e.getMessage());
|
||||
throw new BadRequestException("更新设置失败:"+e.getMessage());
|
||||
throw new BadRequestException(LangProcess.msg("setting_update_failed",e.getMessage()));
|
||||
}
|
||||
|
||||
return WebResponse.requestOk();
|
||||
|
||||
Reference in New Issue
Block a user