Commit 746e03c3 LN

增加锡膏管理菜单。

语言设置接口修改。
1 个父辈 75385ef4
......@@ -204,6 +204,14 @@ public class DataInitManager {
Menu msdSetting = new Menu(new ArrayList<Menu>(), 1, "msdSetting", "MSD设置", 1, "msdSetting", "neolight/msdSetting/index", "", 0, "MSDSet");
menus.addAll(createMenus(msd,msdManage,msdData,msdSetting));
Menu solderPaste = Menu.CreatePMenu("锡膏管理", 20, "solderPaste", 2, "MSD");
Menu solderPasteKanban = new Menu(new ArrayList<Menu>(), 1, "solderPasteKanban", "设备概览", 1, "solderPasteKanban", "neolight/solderPasteKanban/index", "", 0, "MSDManager");
Menu solderPasteManage = new Menu(new ArrayList<Menu>(), 1, "solderPasteManage", "库存", 1, "solderPasteManage", "neolight/solderPasteManage/index", "", 0, "MSDManager");
Menu solderPasteData = new Menu(new ArrayList<Menu>(), 1, "solderPasteData", "追溯性", 1, "solderPasteData", "neolight/solderPasteData/index", "", 0, "MSDData");
Menu solderPasteSetting = new Menu(new ArrayList<Menu>(), 1, "solderPasteSetting", "设置", 1, "solderPasteSetting", "neolight/solderPasteSetting/index", "", 0, "MSDSet");
menus.addAll(createMenus(solderPaste,solderPasteKanban,solderPasteManage,solderPasteData,solderPasteSetting));
//物料管理:元器件管理,条形码管理
Menu pMenuWl = Menu.CreatePMenu("档案管理", 30, "materiel ", 2, "BOM");
Menu menucom = new Menu(new ArrayList<Menu>(), 1, "component:list", "元器件", 1, "componentParts", "parts/component/index", "", 0, "server");
......
......@@ -320,6 +320,12 @@ public class LanguageMsgController {
// if (!oldMsg.equals(msgStr)) {
if(ObjectUtil.isEmpty(oldMsg)){
msg.setContent(lanCode, msgStr);
//内容默认更改为中文
if(lanCode.equals(MessageUtils.ZH_CN)){
if(!msg.getMsg().equals(msgStr)){
msg.setMsg(msgStr);
}
}
updateLanguageList.add(msg);
languageMsgManager.save(msg);
MessageUtils.updateMsg(msg);
......@@ -335,7 +341,7 @@ public class LanguageMsgController {
MessageUtils.updateMsg(msg);
}
}
log.info("导入资源[" + orgFileName + "]["+type+"]["+lanCode+"]共更新[" + updateLanguageList.size() + "]条资源,新增[" + newLanguageList.size() + "]条资源");
log.info("导入资源[" + orgFileName + "]["+type+"]["+lanCode+"],共["+proMap.size()+"]条数据,共更新[" + updateLanguageList.size() + "]条资源,新增[" + newLanguageList.size() + "]条资源");
return "ok";
}
......
package com.neotel.smfcore.core.language.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.service.bean.LanguageInfo;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.security.rest.bean.dto.UserDto;
import com.neotel.smfcore.security.service.po.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
......@@ -13,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
......@@ -29,15 +34,26 @@ public class LanguageSetController {
@Autowired
DataCache dataCache;
public List<String> getAllLanList() {
public List<LanguageInfo> getAllLanList() {
List<String> lanList = dataCache.getCache(Constants.CACHE_languageType);
// List<String> lanList = dataCache.getCache(Constants.CACHE_languageType);
// if (lanList == null || lanList.size() <= 0) {
// lanList=new ArrayList<>();
// lanList.add(MessageUtils.ZH_CN);
// lanList.add(MessageUtils.ZH_TW);
// lanList.add(MessageUtils.EN_US);
// lanList.add(MessageUtils.JA_JP);
// dataCache.updateCache(Constants.CACHE_languageType, lanList);
// }
// return lanList;
List<LanguageInfo> lanList = dataCache.getCache(Constants.CACHE_languageType);
if (lanList == null || lanList.size() <= 0) {
lanList=new ArrayList<>();
lanList.add(MessageUtils.ZH_CN);
lanList.add(MessageUtils.ZH_TW);
lanList.add(MessageUtils.EN_US);
lanList.add(MessageUtils.JA_JP);
lanList.add(new LanguageInfo(MessageUtils.ZH_CN,"简体中文",""));
lanList.add(new LanguageInfo(MessageUtils.ZH_TW,"简体中文",""));
lanList.add(new LanguageInfo(MessageUtils.EN_US,"简体中文",""));
lanList.add(new LanguageInfo(MessageUtils.JA_JP,"简体中文",""));
dataCache.updateCache(Constants.CACHE_languageType, lanList);
}
return lanList;
......@@ -46,70 +62,69 @@ public class LanguageSetController {
@ApiOperation("获取语言列表")
@GetMapping
@PreAuthorize("@el.check('translation')")
public List<String> getList(){
public List<LanguageInfo> getList(){
return getAllLanList();
}
@ApiOperation("新增语言")
@PostMapping
@PreAuthorize("@el.check('translation')")
public ResponseEntity<Object> create( @RequestBody String languageType) {
public ResponseEntity<Object> create( @RequestBody LanguageInfo newLan) {
//判断是否是admin
String userName= SecurityUtils.getCurrentUsername();
if(!userName.equals(Constants.SUPER_USERNAME)){
throw new ValidateException("smfcode.noLanguageSetAccess","没有编辑语言的权限");
String userName = SecurityUtils.getCurrentUsername();
if (!userName.equals(Constants.SUPER_USERNAME)) {
throw new ValidateException("smfcode.noLanguageSetAccess", "没有编辑语言的权限");
}
if(languageType==null ){
throw new ValidateException("smfcode.languageCanotNull","语言类型不能为空" );
if (newLan == null || ObjectUtil.isEmpty(newLan.getLanCode()) || ObjectUtil.isEmpty(newLan.getLanName())) {
throw new ValidateException("smfcode.languageCanotNull", "语言类型不能为空");
}
List<String> languageTypeList =getAllLanList();
if(!languageTypeList.contains(languageType)){
log.info("用户["+SecurityUtils.getCurrentUsername()+"] 新增语言:"+languageType);
languageTypeList.add(languageType);
dataCache.updateCache(Constants.CACHE_languageType, languageTypeList);
List<LanguageInfo> languageTypeList = getAllLanList();
for (LanguageInfo lan :
languageTypeList) {
if (lan.getLanCode().equals(newLan.getLanCode())) {
throw new ValidateException("smfcode.languageAlreadyExist ", "语言[{0}]已存在", new String[]{newLan.getLanCode()});
}
}
log.info("用户[" + SecurityUtils.getCurrentUsername() + "] 新增语言:" + newLan.getLanCode() + "," + newLan.getLanName());
languageTypeList.add(newLan);
dataCache.updateCache(Constants.CACHE_languageType, languageTypeList);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@ApiOperation("删除指定语言")
@DeleteMapping
@PreAuthorize("@el.check('translation')")
public ResponseEntity<Object> delete(@RequestBody Set<String> languageTypes) {
public ResponseEntity<Object> delete(@RequestBody Set<String> lanCodes) {
//判断是否是admin
String userName = SecurityUtils.getCurrentUsername();
if (!userName.equals(Constants.SUPER_USERNAME)) {
throw new ValidateException("smfcode.noLanguageSetAccess", "没有编辑语言的权限");
}
List<String> languageTypeList = getAllLanList();
for (String type : languageTypes) {
List<LanguageInfo> languageTypeList = getAllLanList();
for (String type : lanCodes) {
if (type == null) {
throw new ValidateException("smfcode.languageCanotNull", "语言类型不能为空");
}
languageTypeList.remove(type);
log.info("用户["+SecurityUtils.getCurrentUsername()+"] 删除语言:"+type);
}
List<LanguageInfo> newList=new ArrayList<>();
for (LanguageInfo lan :
languageTypeList) {
if(lanCodes.contains(lan.getLanCode())){
log.info("用户["+SecurityUtils.getCurrentUsername()+"] 删除语言:"+lan.getLanCode());
}else{
newList.add(lan);
}
}
if (languageTypeList == null || languageTypeList.size() <= 0) {
if (newList == null || newList.size() <= 0) {
throw new ValidateException("smfcode.languageCanotRemoveAll", "不能删除所有语言");
}
dataCache.updateCache(Constants.CACHE_languageType, languageTypeList);
dataCache.updateCache(Constants.CACHE_languageType, newList);
return new ResponseEntity<>(HttpStatus.OK);
}
// @ApiOperation("修改语言列表")
// @PostMapping
// @PreAuthorize("@el.check('translation')")
// public ResultBean create(@RequestBody List<String> languageTypeList) {
// if(languageTypeList==null||languageTypeList.size()<=0){
// throw new ValidateException("smfcode.languageCanotNull","语言类型不能为空" );
// }
//
// //判断是否是admin
// String userName= SecurityUtils.getCurrentUsername();
// if(!userName.equals(Constants.SUPER_USERNAME)){
// throw new ValidateException("smfcode.noLanguageSetAccess","没有修改语言的权限");
// }
// dataCache.updateCache(Constants.CACHE_languageType, languageTypeList);
//
// return ResultBean.newOkResult("ok");
// }
}
package com.neotel.smfcore.core.language.service.bean;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LanguageInfo implements Serializable {
/**
* 语言简码:zh-CN,zh-TW 等
*/
@ApiModelProperty("语言简码:zh-CN,zh-TW 等")
private String lanCode;
/**
* 语言名称:简体中文,繁体中文 等
*/
@ApiModelProperty("语言名称:简体中文,繁体中文 等")
private String lanName;
/**
* 语言图标
*/
@ApiModelProperty("语言图标")
private String icon;
}
......@@ -142,4 +142,9 @@ smfcore.msdSetting=MSD\u8BBE\u7F6E
smfcore.translation=\u8D44\u6E90\u7FFB\u8BD1
smfcode.languageCanotNull=\u8BED\u8A00\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A
smfcode.noLanguageSetAccess=\u6CA1\u6709\u7F16\u8F91\u8BED\u8A00\u7684\u6743\u9650
smfcode.languageCanotRemoveAll=\u4E0D\u80FD\u5220\u9664\u6240\u6709\u8BED\u8A00
\ No newline at end of file
smfcode.languageCanotRemoveAll=\u4E0D\u80FD\u5220\u9664\u6240\u6709\u8BED\u8A00
smfcore.solderPaste=\u9521\u818F\u7BA1\u7406
smfcore.solderPasteKanban=\u8BBE\u5907\u6982\u89C8
smfcore.solderPasteManage=\u5E93\u5B58
smfcore.solderPasteData=\u8FFD\u6EAF\u6027
smfcore.solderPasteSetting=\u8BBE\u7F6E
\ No newline at end of file
......@@ -11,7 +11,7 @@ smfcode.temperatureValueError=Humidity range error
smfcode.temperatureShowValueError=Humidity display range error
smfcode.notActivated=Account not activated
smfcode.userInfoError=Incomplete user information
Smfcode. Noaccess =No permission to modify
smfcode.noaccess =No permission to modify
smfcode.notSelRole=Please select a role to modify
smfcode.posIsused=SMD BOX [{1}] Position[{0}] has material [{2}], deletion failed
smfcode.thePosIsused=Position [{0}] has material [{1}], deletion failed
......@@ -143,3 +143,8 @@ smfcore.translation=Resource Translation
smfcode.languageCanotNull=Language type cannot be empty
smfcode.noLanguageSetAccess=No permission to edit the language
smfcode.languageCanotRemoveAll=Cannot delete all languages
smfcore.solderPaste=Solder Paste Management
smfcore.solderPasteKanban=Equipment Overview
smfcore.solderPasteManage=Inventory
smfcore.solderPasteData=Traceability
smfcore.solderPasteSetting=Setting
......@@ -5,8 +5,8 @@ smfcode.valueNotExist={0}[{1}]\u304C\u5B58\u5728\u3057\u307E\u305B\u3093
smfcode.fileToLong=\u30D5\u30A1\u30A4\u30EB\u8D85\u904E\u30B5\u30A4\u30BA
smfcode.fileError=\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30FC\u30B7\u30F3\u30B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F
smfcode.valueNotFind=\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F{0}[{1}]
smfcode.hudidityValueError=\u6E29\u5EA6\u7BC4\u56F2\u30C7\u30FC\u30BF\u30A8\u30E9\u30FC
smfcode.hudidityShowValueError=\u6E29\u5EA6\u8868\u793A\u7BC4\u56F2\u30C7\u30FC\u30BF\u30A8\u30E9\u30FC
smfcode.humidityValueError=\u6E29\u5EA6\u7BC4\u56F2\u30C7\u30FC\u30BF\u30A8\u30E9\u30FC
smfcode.humidityShowValueError=\u6E29\u5EA6\u8868\u793A\u7BC4\u56F2\u30C7\u30FC\u30BF\u30A8\u30E9\u30FC
smfcode.temperatureValueError=\u6E7F\u5EA6\u7BC4\u56F2\u30C7\u30FC\u30BF\u30A8\u30E9\u30FC
smfcode.temperatureShowValueError=\u6E7F\u5EA6\u306E\u8868\u793A\u7BC4\u56F2\u30C7\u30FC\u30BF\u30A8\u30E9\u30FC
smfcode.notActivated=\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u6709\u52B9\u306B\u306A\u3063\u3066\u3044\u306A\u3044
......@@ -35,7 +35,7 @@ smfcode.error.barcode.noValidCode=\u7121\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30
smfcore.error.barcode.noValidCode={0}\u306F\u6709\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
smfcode.error.barcode.executing=\u30D0\u30FC\u30B3\u30FC\u30C9 [{0}}] \u30BF\u30B9\u30AF\u304C\u5B9F\u884C\u3055\u308C\u3066\u3044\u307E\u3059
smfcode.error.pos.notExist=[{0}]\u306E\u30DD\u30B8\u30B7\u30E7\u30F3\u304C\u5B58\u5728\u3057\u306A\u3044\u305F\u3081\u3001\u5165\u529B\u3067\u304D\u307E\u305B\u3093
smfcode.error.pos.copse=\u30D9\u30A4[{0}]\u306F\u30D3\u30F3[{1}]\u3068\u4E00\u81F4\u3057\u306A\u3044\u305F\u3081\u3001\u30B9\u30C8\u30C3\u30AF\u3067\u304D\u307E\u305B\u3093
smfcode.error.pos.wrong=\u30D9\u30A4[{0}]\u306F\u30D3\u30F3[{1}]\u3068\u4E00\u81F4\u3057\u306A\u3044\u305F\u3081\u3001\u30B9\u30C8\u30C3\u30AF\u3067\u304D\u307E\u305B\u3093
smfcode.error.pos.hasReel=\u6750\u6599\u306F\u65E2\u306B\u30D3\u30F3[{0}]\u306B\u5165\u3063\u3066\u304A\u308A\u3001\u5165\u529B\u3067\u304D\u307E\u305B\u3093
smfcode.error.pos.sizeNotMatch=\u30D1\u30EC\u30C3\u30C8[{0}]\u306E\u30B5\u30A4\u30BA\u304C\u53CE\u7D0D\u30B9\u30DA\u30FC\u30B9[{1}][{2}]\u306E\u30B5\u30A4\u30BA\u306B\u5BFE\u5FDC\u3057\u3066\u304A\u3089\u305A\u3001\u53CE\u7D0D\u3067\u304D\u307E\u305B\u3093
smfcode.error.storage.offline=\u30D3\u30F3 [{0}] \u30AA\u30D5\u30E9\u30A4\u30F3
......@@ -142,4 +142,9 @@ smfcore.msdSetting=MSD\u8BBE\u7F6E
smfcore.translation=\u30EA\u30BD\u30FC\u30B9\u306E\u7FFB\u8A33
smfcode.languageCanotNull=\u8A00\u8A9E\u30BF\u30A4\u30D7\u306F\u7A7A\u3067\u306F\u3042\u308A\u307E\u305B\u3093
smfcode.noLanguageSetAccess=\u8A00\u8A9E\u3092\u7DE8\u96C6\u3059\u308B\u6A29\u9650\u304C\u306A\u3044
smfcode.languageCanotRemoveAll=\u3059\u3079\u3066\u306E\u8A00\u8A9E\u3092\u524A\u9664\u3067\u304D\u306A\u3044
\ No newline at end of file
smfcode.languageCanotRemoveAll=\u3059\u3079\u3066\u306E\u8A00\u8A9E\u3092\u524A\u9664\u3067\u304D\u306A\u3044
smfcore.solderPaste=\u9521\u818F\u7BA1\u7406
smfcore.solderPasteKanban=\u8BBE\u5907\u6982\u89C8
smfcore.solderPasteManage=\u5E93\u5B58
smfcore.solderPasteData=\u8FFD\u6EAF\u6027
smfcore.solderPasteSetting=\u8BBE\u7F6E
\ No newline at end of file
......@@ -142,4 +142,9 @@ smfcore.msdSetting=MSD\u8BBE\u7F6E
smfcore.translation=\u8D44\u6E90\u7FFB\u8BD1
smfcode.languageCanotNull=\u8BED\u8A00\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A
smfcode.noLanguageSetAccess=\u6CA1\u6709\u7F16\u8F91\u8BED\u8A00\u7684\u6743\u9650
smfcode.languageCanotRemoveAll=\u4E0D\u80FD\u5220\u9664\u6240\u6709\u8BED\u8A00
\ No newline at end of file
smfcode.languageCanotRemoveAll=\u4E0D\u80FD\u5220\u9664\u6240\u6709\u8BED\u8A00
smfcore.solderPaste=\u9521\u818F\u7BA1\u7406
smfcore.solderPasteKanban=\u8BBE\u5907\u6982\u89C8
smfcore.solderPasteManage=\u5E93\u5B58
smfcore.solderPasteData=\u8FFD\u6EAF\u6027
smfcore.solderPasteSetting=\u8BBE\u7F6E
\ No newline at end of file
......@@ -142,4 +142,9 @@ smfcore.msdSetting=MSD\u8A2D\u7F6E
smfcore.translation=\u8CC7\u6E90\u7FFB\u8B6F
smfcode.languageCanotNull=\u8A9E\u8A00\u985E\u578B\u4E0D\u80FD\u70BA\u7A7A
smfcode.noLanguageSetAccess=\u6C92\u6709\u7DE8\u8F2F\u8A9E\u8A00\u7684\u6B0A\u9650
smfcode.languageCanotRemoveAll=\u4E0D\u80FD\u522A\u9664\u6240\u6709\u8A9E\u8A00
\ No newline at end of file
smfcode.languageCanotRemoveAll=\u4E0D\u80FD\u522A\u9664\u6240\u6709\u8A9E\u8A00
smfcore.solderPaste=\u932B\u818F\u7BA1\u7406
smfcore.solderPasteKanban=\u8A2D\u5099\u6982\u89BD
smfcore.solderPasteManage=\u5EAB\u5B58
smfcore.solderPasteData=\u8FFD\u6EAF\u6027
smfcore.solderPasteSetting=\u8A2D\u7F6E
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!