opt:1.管理后台系统优化国际化。2.添加巡航模式任务接口。

This commit is contained in:
2026-03-03 19:46:06 +08:00
parent 4247b41831
commit 65c6d41e4b
31 changed files with 545 additions and 17 deletions

View File

@@ -104,4 +104,13 @@ public class Dict implements Serializable {
*/
private String update_time;
/**
* 中文字典标签
*/
private String zh_label;
/**
* 英文字典标签
*/
private String en_label;
}

View File

@@ -60,6 +60,16 @@ public class SysMenu implements Serializable {
*/
private String title;
/**
* 菜单标题
*/
private String zh_title;
/**
* 菜单标题
*/
private String en_title;
/**
* 组件名称
*/

View File

@@ -34,6 +34,8 @@ public class MenuDto extends BaseDTO implements Serializable {
private String permission;
private String title;
private String zh_title;
private String en_title;
private Integer menu_sort;
@@ -90,4 +92,14 @@ public class MenuDto extends BaseDTO implements Serializable {
public int hashCode() {
return Objects.hash(menu_id);
}
public String getLocalTitle(String local){
if ("en".equals(local)){
return en_title;
}
if ("zh".equals(local)){
return zh_title;
}
return title;
}
}

View File

@@ -27,6 +27,7 @@ import org.nl.sys.modular.backgroundmanagement.menu.mapper.SysMenuMapper;
import org.nl.sys.modular.backgroundmanagement.menu.service.ISysMenuService;
import org.nl.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -259,11 +260,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
@Override
public List<MenuVo> buildMenus(List<MenuDto> menuDtos) {
List<MenuVo> list = new LinkedList<>();
String lang = LocaleContextHolder.getLocale().getLanguage();
menuDtos.forEach(menuDTO -> {
if (menuDTO != null) {
List<MenuDto> menuDtoList = menuDTO.getChildren();
MenuVo menuVo = new MenuVo();
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getTitle());
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
// 一级目录需要加斜杠,不然会报警告
menuVo.setPath(ObjectUtil.isEmpty(menuDTO.getPid()) ? "/" + menuDTO.getPath() : menuDTO.getPath());
menuVo.setHidden(menuDTO.getHidden());
@@ -278,7 +280,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
menuVo.setComponent(menuDTO.getComponent());
}
}
menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(), menuDTO.getIcon(), !menuDTO.getCache()));
menuVo.setMeta(new MenuMetaVo(menuDTO.getLocalTitle(lang), menuDTO.getIcon(), !menuDTO.getCache()));
if (menuDtoList != null && menuDtoList.size() != 0) {
menuVo.setAlwaysShow(true);
menuVo.setRedirect("noredirect");
@@ -397,12 +399,13 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
@Override
public List<MenuVo> buildMenus(List<MenuDto> menuDtos, String pid) {
List<MenuVo> list = new LinkedList<>();
String lang = LocaleContextHolder.getLocale().getLanguage();
//剔除系统级菜单
menuDtos.forEach(menuDTO -> {
if (menuDTO != null) {
List<MenuDto> menuDtoList = menuDTO.getChildren();
MenuVo menuVo = new MenuVo();
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getTitle());
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
// 一级目录需要加斜杠,不然会报警告
menuVo.setPath(pid.equals(menuDTO.getPid())? "/" + menuDTO.getPath() : menuDTO.getPath());
menuVo.setHidden(menuDTO.getHidden());
@@ -417,7 +420,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
menuVo.setComponent(menuDTO.getComponent());
}
}
menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(), menuDTO.getIcon(), !menuDTO.getCache()));
menuVo.setMeta(new MenuMetaVo(menuDTO.getLocalTitle(lang), menuDTO.getIcon(), !menuDTO.getCache()));
if (menuDtoList != null && menuDtoList.size() != 0) {
menuVo.setAlwaysShow(true);
menuVo.setRedirect("noredirect");

View File

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.nl.api.setting.api.SettingAPI;
import org.nl.api.task.api.TaskAPI;
import org.nl.api.task.core.TaskRequestParam;
import org.nl.config.language.LangProcess;
@@ -44,6 +45,9 @@ public class QRCodeServiceImpl implements QRCodeService {
@Resource
private QRcodeInfoMapper qrcodeInfoMapper;
@Resource
private SettingAPI settingAPI;
@Resource
private TaskAPI taskAPI;
@@ -150,8 +154,12 @@ public class QRCodeServiceImpl implements QRCodeService {
@Override
public WebResponse createTask(TaskRequestParam qrCodeTaskRequestParam) {
taskAPI.createTask(qrCodeTaskRequestParam, TaskSourceEnum.QRCODE.getName());
return null;
String mode = settingAPI.querySettingParamByCode("mode").getJSONObject("data").getString("value");
// 判断是否在巡航模式 再巡航模式不能下发二维码任务
if ("1".equals(mode)){
throw new BadRequestException(LangProcess.msg("qrcode_create_failed_mode"));
}
return taskAPI.createTask(qrCodeTaskRequestParam, TaskSourceEnum.QRCODE.getName());
}
@Override