Commit 05193f0c LN

国际化修改

1 个父辈 333058fb
正在显示 37 个修改的文件 包含 336 行增加273 行删除
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.neotel.smfcore.common.exception;
import lombok.Getter;
import org.springframework.http.HttpStatus;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
/**
* @author Zheng Jie
* @date 2018-11-23
* 统一异常处理
*/
@Getter
public class BadRequestException extends RuntimeException{
private Integer status = BAD_REQUEST.value();
private String msgKey="";
private String[] msgParam;
private String defaultMsg="";
// public BadRequestException( String defMsg){
// super(defMsg);
// this.msgKey=defMsg;
// this.msgParam=null;
// this.defaultMsg=defMsg;
// }
public BadRequestException(String msgKey, String defMsg){
super(defMsg);
this.msgKey=msgKey;
this.msgParam=null;
this.defaultMsg=defMsg;
}
public BadRequestException(String msgKey, String defMsg,String[] msgParam){
super(defMsg);
this.msgKey=msgKey;
this.msgParam=msgParam;
this.defaultMsg=defMsg;
}
public BadRequestException(HttpStatus status, String msg){
super(msg);
this.status = status.value();
}
}
package com.neotel.smfcore.common.exception; package com.neotel.smfcore.common.exception;
import lombok.Data; import lombok.Data;
import org.springframework.http.HttpStatus;
import static org.springframework.http.HttpStatus.BAD_REQUEST; import static org.springframework.http.HttpStatus.BAD_REQUEST;
...@@ -9,30 +10,30 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST; ...@@ -9,30 +10,30 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
*/ */
@Data @Data
public class ValidateException extends RuntimeException{ public class ValidateException extends RuntimeException{
private Integer status = BAD_REQUEST.value();
private String[] params;
private String defaultMsg; private Integer status = BAD_REQUEST.value();
public ValidateException(String message){ private String msgKey="";
super(message); private String[] msgParam;
} private String defaultMsg="";
public ValidateException(String message, String defaultMsg) { public ValidateException(String msgKey, String defMsg){
super(message); super(defMsg);
this.defaultMsg = defaultMsg; this.msgKey=msgKey;
this.msgParam=null;
this.defaultMsg=defMsg;
} }
public ValidateException(String msgKey, String defMsg,String[] msgParam){
public ValidateException(String message, String[] params) { super(defMsg);
super(message); this.msgKey=msgKey;
this.params = params; this.msgParam=msgParam;
this.defaultMsg=defMsg;
} }
public ValidateException(String message, String[] params, String defaultMsg) { public ValidateException(HttpStatus status, String msg){
super(message); super(msg);
this.params = params; this.status = status.value();
this.defaultMsg = defaultMsg;
} }
} }
package com.neotel.smfcore.common.exception.handler; package com.neotel.smfcore.common.exception.handler;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.EntityExistException; import com.neotel.smfcore.common.exception.EntityExistException;
import com.neotel.smfcore.common.exception.EntityNotFoundException; import com.neotel.smfcore.common.exception.EntityNotFoundException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
...@@ -50,17 +49,17 @@ public class GlobalExceptionHandler { ...@@ -50,17 +49,17 @@ public class GlobalExceptionHandler {
return buildResponseEntity(ApiError.error(message)); return buildResponseEntity(ApiError.error(message));
} }
/** // /**
* 处理自定义异常 // * 处理自定义异常
*/ // */
@ExceptionHandler(value = BadRequestException.class) // @ExceptionHandler(value = BadRequestException.class)
public ResponseEntity<ApiError> badRequestException(HttpServletRequest servlet, BadRequestException e) { // public ResponseEntity<ApiError> badRequestException(HttpServletRequest servlet, BadRequestException e) {
String language= servlet.getLocale().getLanguage(); // String language= servlet.getLocale().getLanguage();
// 打印堆栈信息 // // 打印堆栈信息
log.error(ThrowableUtil.getStackTrace(e)); // log.error(ThrowableUtil.getStackTrace(e));
String targetMsg=messageUtils.getText(e.getMsgKey(),e.getMsgParam(),new Locale(language) ,e.getDefaultMsg()); // String targetMsg=messageUtils.getText(e.getMsgKey(),e.getMsgParam(),new Locale(language) ,e.getDefaultMsg());
return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg)); // return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg));
} // }
/** /**
* 处理 EntityExist * 处理 EntityExist
...@@ -82,9 +81,13 @@ public class GlobalExceptionHandler { ...@@ -82,9 +81,13 @@ public class GlobalExceptionHandler {
return buildResponseEntity(ApiError.error(NOT_FOUND.value(),e.getMessage())); return buildResponseEntity(ApiError.error(NOT_FOUND.value(),e.getMessage()));
} }
public ResponseEntity<ApiError> validateException(ValidateException e){ @ExceptionHandler(value = ValidateException.class)
public ResponseEntity<ApiError> validateException(HttpServletRequest servlet,ValidateException e){
String language= servlet.getLocale().getLanguage();
// 打印堆栈信息
log.error(ThrowableUtil.getStackTrace(e)); log.error(ThrowableUtil.getStackTrace(e));
return buildResponseEntity(ApiError.error(e.getStatus(),e.getMessage())); String targetMsg=messageUtils.getText(e.getMsgKey(),e.getMsgParam(),new Locale(language) ,e.getDefaultMsg());
return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg));
} }
/** /**
......
...@@ -19,7 +19,7 @@ import cn.hutool.core.io.IoUtil; ...@@ -19,7 +19,7 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.poi.excel.BigExcelWriter; import cn.hutool.poi.excel.BigExcelWriter;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import com.neotel.smfcore.common.exception.BadRequestException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.language.util.MessageUtils; import com.neotel.smfcore.core.language.util.MessageUtils;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFSheet;
...@@ -255,7 +255,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { ...@@ -255,7 +255,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
// 1M // 1M
int len = 1024 * 1024; int len = 1024 * 1024;
if (size > (maxSize * len)) { if (size > (maxSize * len)) {
throw new BadRequestException("smfcode.fileToLong", "文件超出规定大小"); throw new ValidateException("smfcode.fileToLong", "文件超出规定大小");
} }
} }
......
...@@ -18,7 +18,7 @@ package com.neotel.smfcore.common.utils; ...@@ -18,7 +18,7 @@ package com.neotel.smfcore.common.utils;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.neotel.smfcore.common.exception.BadRequestException; import com.neotel.smfcore.common.exception.ValidateException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -48,13 +48,13 @@ public class SecurityUtils { ...@@ -48,13 +48,13 @@ public class SecurityUtils {
public static String getCurrentUsername() { public static String getCurrentUsername() {
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null) { if (authentication == null) {
throw new BadRequestException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); throw new ValidateException(HttpStatus.UNAUTHORIZED, "当前登录状态过期");
} }
if (authentication.getPrincipal() instanceof UserDetails) { if (authentication.getPrincipal() instanceof UserDetails) {
UserDetails userDetails = (UserDetails) authentication.getPrincipal(); UserDetails userDetails = (UserDetails) authentication.getPrincipal();
return userDetails.getUsername(); return userDetails.getUsername();
} }
throw new BadRequestException(HttpStatus.UNAUTHORIZED, "找不到当前登录的信息"); throw new ValidateException(HttpStatus.UNAUTHORIZED, "找不到当前登录的信息");
} }
/** /**
......
...@@ -55,7 +55,8 @@ public class UserCodeUtil { ...@@ -55,7 +55,8 @@ public class UserCodeUtil {
int index = csvReader.getIndex(titleName,titleNameEn); int index = csvReader.getIndex(titleName,titleNameEn);
if(index == -1){ if(index == -1){
log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列"); log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列");
throw new ValidateException("必须包含["+titleNameEn+"]列"); // throw new ValidateException("必须包含["+titleNameEn+"]列");
throw new ValidateException("smfcode.columnNotExist","必须包含[{0}列",new String[]{titleNameEn});
} }
return index; return index;
} }
......
...@@ -4,7 +4,7 @@ import com.google.common.collect.Lists; ...@@ -4,7 +4,7 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader; import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.exception.BadRequestException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto; import com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto;
...@@ -89,7 +89,7 @@ public class BarcodeController { ...@@ -89,7 +89,7 @@ public class BarcodeController {
public ResponseEntity<Object> update(@Validated @RequestBody BarcodeDto resources) { public ResponseEntity<Object> update(@Validated @RequestBody BarcodeDto resources) {
Barcode barcode=barcodeMapper.toEntity(resources); Barcode barcode=barcodeMapper.toEntity(resources);
if (barcode.getId() == null) { if (barcode.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"}); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"});
} }
barcodeManager.saveBarcode(barcode); barcodeManager.saveBarcode(barcode);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -102,7 +102,7 @@ public class BarcodeController { ...@@ -102,7 +102,7 @@ public class BarcodeController {
List<Barcode> barcodes = new ArrayList<Barcode>(); List<Barcode> barcodes = new ArrayList<Barcode>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
} }
barcodeManager.deleteBarcodes(ids); barcodeManager.deleteBarcodes(ids);
...@@ -123,13 +123,13 @@ public class BarcodeController { ...@@ -123,13 +123,13 @@ public class BarcodeController {
@PreAuthorize("@el.check('barcode:setting')") @PreAuthorize("@el.check('barcode:setting')")
public ResponseEntity<Object> updateSetting(@Validated @RequestBody BarcodeSettingDto settingDto) { public ResponseEntity<Object> updateSetting(@Validated @RequestBody BarcodeSettingDto settingDto) {
if(settingDto.getCodeRuleList().isEmpty()){ if(settingDto.getCodeRuleList().isEmpty()){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"codeRuleList"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"codeRuleList"} );
} }
if(settingDto.getPageHeight()==null){ if(settingDto.getPageHeight()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"pageHeight"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"pageHeight"} );
} }
if(settingDto.getPageWidth()==null){ if(settingDto.getPageWidth()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"pageWidth"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"pageWidth"} );
} }
Settings settings=dataCache.getSettings(); Settings settings=dataCache.getSettings();
settings.setCodeRuleList(settingDto.getCodeRuleList()); settings.setCodeRuleList(settingDto.getCodeRuleList());
...@@ -146,7 +146,7 @@ public class BarcodeController { ...@@ -146,7 +146,7 @@ public class BarcodeController {
String image = "csv"; String image = "csv";
String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename());
if(fileType != null && !image.contains(fileType)){ if(fileType != null && !image.contains(fileType)){
throw new BadRequestException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image}); throw new ValidateException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image});
} }
File folder = new File(properties.getPath(),"pos"); File folder = new File(properties.getPath(),"pos");
File file = FileUtil.upload(uploadFile, folder.getAbsolutePath()); File file = FileUtil.upload(uploadFile, folder.getAbsolutePath());
......
package com.neotel.smfcore.core.barcode.rest; package com.neotel.smfcore.core.barcode.rest;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.barcode.rest.bean.dto.ComponentDto; import com.neotel.smfcore.core.barcode.rest.bean.dto.ComponentDto;
import com.neotel.smfcore.core.barcode.rest.bean.mapstruct.ComponentMapper; import com.neotel.smfcore.core.barcode.rest.bean.mapstruct.ComponentMapper;
...@@ -70,7 +70,7 @@ public class ComponentController { ...@@ -70,7 +70,7 @@ public class ComponentController {
public ResponseEntity<Object> update(@Validated @RequestBody ComponentDto resources) { public ResponseEntity<Object> update(@Validated @RequestBody ComponentDto resources) {
Component component=componentMapper.toEntity(resources); Component component=componentMapper.toEntity(resources);
if (component.getId() == null) { if (component.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
componentManager.saveComponent(component); componentManager.saveComponent(component);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -83,7 +83,7 @@ public class ComponentController { ...@@ -83,7 +83,7 @@ public class ComponentController {
List<Component> Components = new ArrayList<Component>(); List<Component> Components = new ArrayList<Component>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
} }
componentManager.deleteComponents(ids); componentManager.deleteComponents(ids);
......
...@@ -2,7 +2,6 @@ package com.neotel.smfcore.core.barcode.service.manager.impl; ...@@ -2,7 +2,6 @@ package com.neotel.smfcore.core.barcode.service.manager.impl;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
...@@ -109,7 +108,7 @@ public class BarcodeManagerImpl implements IBarcodeManager { ...@@ -109,7 +108,7 @@ public class BarcodeManagerImpl implements IBarcodeManager {
//readID不能重复 //readID不能重复
Barcode data= barcodeDao.findOne(query); Barcode data= barcodeDao.findOne(query);
if(data!=null){ if(data!=null){
throw new BadRequestException("smfcode.codeExist", "条码["+resources.getBarcode()+"]已存在"); throw new ValidateException("smfcode.codeExist", "条码["+resources.getBarcode()+"]已存在");
} }
if(resources.getProvider()==null){ if(resources.getProvider()==null){
...@@ -174,29 +173,29 @@ public class BarcodeManagerImpl implements IBarcodeManager { ...@@ -174,29 +173,29 @@ public class BarcodeManagerImpl implements IBarcodeManager {
return componentManager.findOneByPN(barcode.getPartNumber()) != null; return componentManager.findOneByPN(barcode.getPartNumber()) != null;
} }
protected void validateSave(Barcode barcode) throws BadRequestException { protected void validateSave(Barcode barcode) throws ValidateException {
if (barcode.getBarcode()==null) { if (barcode.getBarcode()==null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"barcode"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"barcode"} );
// throw new ValidateException("barcode.error.empty"); // throw new ValidateException("barcode.error.empty");
} }
if (barcode.getPartNumber()==null) { if (barcode.getPartNumber()==null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"partNumber"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"partNumber"} );
// throw new BadRequestException("["+barcode.getBarcode()+"]barcode.error.partNumber.empty"); // throw new ValidateException("["+barcode.getBarcode()+"]barcode.error.partNumber.empty");
} }
if (barcode.getBatch() == null) { if (barcode.getBatch() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"batch"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"batch"} );
// throw new BadRequestException("批次不能为空"); // throw new ValidateException("批次不能为空");
} }
if (barcode.getAmount() < 0) { if (barcode.getAmount() < 0) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"batch"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"batch"} );
// throw new BadRequestException("["+barcode.getBarcode()+"]barcode.error.amount.negative" ); // throw new ValidateException("["+barcode.getBarcode()+"]barcode.error.amount.negative" );
} }
if (!validateUnique(barcode)) { if (!validateUnique(barcode)) {
// throw new BadRequestException("["+barcode.getBarcode()+"]barcode.error.unique" ); // throw new ValidateException("["+barcode.getBarcode()+"]barcode.error.unique" );
} }
if (!validateComponent(barcode)) { if (!validateComponent(barcode)) {
// throw new BadRequestException("["+barcode.getBarcode()+"]barcode.error.component.notExist" ); // throw new ValidateException("["+barcode.getBarcode()+"]barcode.error.component.notExist" );
} }
} }
protected boolean validateUnique(Barcode barcode) { protected boolean validateUnique(Barcode barcode) {
......
package com.neotel.smfcore.core.barcode.service.manager.impl; package com.neotel.smfcore.core.barcode.service.manager.impl;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
...@@ -124,7 +123,7 @@ public class ComponentManagerImpl implements IComponentManager { ...@@ -124,7 +123,7 @@ public class ComponentManagerImpl implements IComponentManager {
public Component saveComponent(Component resources) { public Component saveComponent(Component resources) {
if(resources.getPartNumber()==null){ if(resources.getPartNumber()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"partNumber"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"partNumber"} );
// throw new BadRequestException("料号不能为空"); // throw new BadRequestException("料号不能为空");
} }
if(resources.getProvider()==null){ if(resources.getProvider()==null){
...@@ -151,7 +150,7 @@ public class ComponentManagerImpl implements IComponentManager { ...@@ -151,7 +150,7 @@ public class ComponentManagerImpl implements IComponentManager {
} }
Component com = componentDao.findOne(new Query(c)); Component com = componentDao.findOne(new Query(c));
if (com != null) { if (com != null) {
throw new BadRequestException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"partNumber",resources.getPartNumber()}); throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"partNumber",resources.getPartNumber()});
// throw new BadRequestException("料号["+resources.getPartNumber()+"]已存在"); // throw new BadRequestException("料号["+resources.getPartNumber()+"]已存在");
} }
......
...@@ -176,7 +176,8 @@ public class CodeResolve { ...@@ -176,7 +176,8 @@ public class CodeResolve {
Component component = componentManager.findByPartNumberAndProvider(barcodeFromRule.getPartNumber(),barcodeFromRule.getProvider()); Component component = componentManager.findByPartNumberAndProvider(barcodeFromRule.getPartNumber(),barcodeFromRule.getProvider());
if(component == null){ if(component == null){
log.info("档案["+barcodeFromRule.getPartNumber()+"]不存在"); log.info("档案["+barcodeFromRule.getPartNumber()+"]不存在");
throw new ValidateException("component.error.notExist",new String[]{barcodeFromRule.getPartNumber()}); // throw new ValidateException("component.error.notExist",new String[]{barcodeFromRule.getPartNumber()});
throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"component",barcodeFromRule.getPartNumber()});
} }
codeBeanFromRule.setShowImg(component.getShowImg()); codeBeanFromRule.setShowImg(component.getShowImg());
...@@ -282,7 +283,7 @@ public class CodeResolve { ...@@ -282,7 +283,7 @@ public class CodeResolve {
*/ */
public Barcode resolveOneValideBarcode(String codeStr) throws ValidateException{ public Barcode resolveOneValideBarcode(String codeStr) throws ValidateException{
if(org.apache.logging.log4j.util.Strings.isBlank(codeStr)){ if(org.apache.logging.log4j.util.Strings.isBlank(codeStr)){
throw new ValidateException("error.barcode.empty","未扫到条码"); throw new ValidateException("smfcore.error.barcode.empty","未扫到条码");
} }
Collection<CodeBean> codeBeans = resolveCodeStr(codeStr); Collection<CodeBean> codeBeans = resolveCodeStr(codeStr);
Barcode barcode = null; Barcode barcode = null;
...@@ -293,7 +294,7 @@ public class CodeResolve { ...@@ -293,7 +294,7 @@ public class CodeResolve {
if(barcode == null){ if(barcode == null){
barcode = barcodeFromRule; barcode = barcodeFromRule;
}else{ }else{
throw new ValidateException("error.barcode.many",new String[]{codeStr},"找到多个有效的条码"); throw new ValidateException("smfcode.error.barcode.many","找到多个有效的条码",new String[]{codeStr});
} }
}else{ }else{
errorMsg = codeBean.getError(); errorMsg = codeBean.getError();
...@@ -301,7 +302,7 @@ public class CodeResolve { ...@@ -301,7 +302,7 @@ public class CodeResolve {
} }
if(barcode == null){ if(barcode == null){
throw new ValidateException("error.barcode.noValidCode",new String[]{codeBeans.size()+":",codeStr}, "无效的条码"); throw new ValidateException("smfcode.error.barcode.noValidCode", "无效的条码",new String[]{codeBeans.size()+":",codeStr});
} }
return barcode; return barcode;
} }
......
...@@ -148,7 +148,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -148,7 +148,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
if (codeBeans.isEmpty()) { if (codeBeans.isEmpty()) {
log.info("未扫描到条码"); log.info("未扫描到条码");
throw new ValidateException("error.barcode.empty", "未扫描到条码"); throw new ValidateException("smfcore.error.barcode.empty", "未扫描到条码");
} }
List<Barcode> allBarcode = Lists.newArrayList(); List<Barcode> allBarcode = Lists.newArrayList();
...@@ -166,9 +166,9 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -166,9 +166,9 @@ public class BaseDeviceHandler implements IDeviceHandler {
int codeSize = allBarcode.size(); int codeSize = allBarcode.size();
if (codeSize == 0) { if (codeSize == 0) {
throw new ValidateException("error.barcode.noValidCode", new String[]{codeBeans.size() + "", barcodeStr}, barcodeStr + "不是有效的条码"); throw new ValidateException("smfcore.error.barcode.noValidCode", "{0}不是有效的条码", new String[]{ barcodeStr});
} else if (codeSize > 1) { } else if (codeSize > 1) {
throw new ValidateException("error.barcode.many", "找到多个有效条码,无法入库"); throw new ValidateException("smfcore.error.barcode.many", "找到多个有效条码,无法入库");
} }
return allBarcode.get(0); return allBarcode.get(0);
} }
...@@ -186,7 +186,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -186,7 +186,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
//同条码,但不是同料仓 //同条码,但不是同料仓
log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId()); log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId());
//throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行"); //throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行");
throw new ValidateException("error.barcode.executing", new String[]{barcodeSave.getBarcode()}); throw new ValidateException("smfcode.error.barcode.executing","条码[{0}}]任务正在执行", new String[]{barcodeSave.getBarcode()});
} }
} }
...@@ -202,19 +202,19 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -202,19 +202,19 @@ public class BaseDeviceHandler implements IDeviceHandler {
storagePos = storagePosManager.getByPosName(posName); storagePos = storagePosManager.getByPosName(posName);
if (storagePos == null) { if (storagePos == null) {
throw new ValidateException("error.pos.notExist", new String[]{posName}, "库位【" + posName + "】不存在,无法入库"); throw new ValidateException("smfcode.error.pos.notExist", "库位[{0}]不存在,无法入库", new String[]{posName});
} }
if (!storage.getId().equals(storagePos.getStorageId())) { if (!storage.getId().equals(storagePos.getStorageId())) {
throw new ValidateException("error.pos.wrong", new String[]{posName, storage.getCid()}, "库位【" + posName + "】与料仓[" + storage.getCid() + "]不匹配,无法入库"); throw new ValidateException("smfcode.error.pos.wrong", "库位[{0}]与料仓[{1}}]不匹配,无法入库", new String[]{posName, storage.getCid()});
} }
if (storagePos.getBarcode() != null) { if (storagePos.getBarcode() != null) {
throw new ValidateException("error.pos.hasReel", new String[]{posName}, "库位【" + posName + "】中已有物料,无法入库"); throw new ValidateException("smfcode.error.pos.hasReel", "库位[{0}]中已有物料,无法入库", new String[]{posName});
} }
if (!storage.canPutInPos(barcodeSave.getPlateSize(), barcodeSave.getHeight(), storagePos.getW(), storagePos.getH())) { if (!storage.canPutInPos(barcodeSave.getPlateSize(), barcodeSave.getHeight(), storagePos.getW(), storagePos.getH())) {
String reelSize = barcodeSave.getPlateSize() + "x" + barcodeSave.getHeight(); String reelSize = barcodeSave.getPlateSize() + "x" + barcodeSave.getHeight();
String posSize = storagePos.getW() + "x" + storagePos.getH(); String posSize = storagePos.getW() + "x" + storagePos.getH();
throw new ValidateException("error.pos.sizeNotMatch", new String[]{}, "料盘尺寸[" + reelSize + "]与库位" + posName + "尺寸[" + posSize + "]不符,无法入库"); throw new ValidateException("smfcode.error.pos.sizeNotMatch", "料盘尺寸[{0}}]与库位{1}尺寸[{2}]不符,无法入库", new String[]{reelSize,posName,posSize});
} }
} else { } else {
...@@ -284,7 +284,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -284,7 +284,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
//先查找空闲 BOX同尺寸的,如果找不到,再查找可入库 BOX 同尺寸或比盘尺寸大的仓位 //先查找空闲 BOX同尺寸的,如果找不到,再查找可入库 BOX 同尺寸或比盘尺寸大的仓位
StatusBean statusBean = DevicesStatusUtil.getStatusBean(storageCid); StatusBean statusBean = DevicesStatusUtil.getStatusBean(storageCid);
if (statusBean == null) {//当前料仓不可用 if (statusBean == null) {//当前料仓不可用
throw new ValidateException("error.storage.offline", new String[]{storageCid}, "料仓[ " + storageCid + "]离线"); throw new ValidateException("smfcode.error.storage.offline", "料仓[{0}]离线", new String[]{storageCid});
} }
//还需要排除掉正在队列里的仓位 //还需要排除掉正在队列里的仓位
StoragePos storagePos = null; StoragePos storagePos = null;
...@@ -384,7 +384,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -384,7 +384,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
// if(Strings.isNullOrEmpty(codeBoxId)){ // if(Strings.isNullOrEmpty(codeBoxId)){
// boxIdStr = "BOX-"+codeBoxId; // boxIdStr = "BOX-"+codeBoxId;
// } // }
throw new ValidateException("error.storage.noPos", new String[]{barcode.getPlateSize() + "x" + barcode.getHeight()}, storage.getName() + "的料格[" + barcode.getPlateSize() + "x" + barcode.getHeight() + "]已满,无法继续放入"); throw new ValidateException("error.storage.noPos", storage.getName() + "的料格[" + barcode.getPlateSize() + "x" + barcode.getHeight() + "]已满,无法继续放入", new String[]{barcode.getPlateSize() + "x" + barcode.getHeight()});
} }
log.info("[" + barcode.getBarcode() + "]寻找到" + storage.getName() + "的空仓位[" + storagePos.getPosName() + "]"); log.info("[" + barcode.getBarcode() + "]寻找到" + storage.getName() + "的空仓位[" + storagePos.getPosName() + "]");
return storagePos; return storagePos;
...@@ -409,13 +409,13 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -409,13 +409,13 @@ public class BaseDeviceHandler implements IDeviceHandler {
public Barcode verifyBarcodePutIn(List<Storage> storageList, Barcode barcodeSave) throws ValidateException { public Barcode verifyBarcodePutIn(List<Storage> storageList, Barcode barcodeSave) throws ValidateException {
if (barcodeSave == null) { if (barcodeSave == null) {
throw new ValidateException("error.barcode.invalid", new String[]{""}, "条码无效"); throw new ValidateException("smfcode.error.barcode.invalid", "条码无效", new String[]{""});
} }
Date expireDate = barcodeSave.getExpireDate(); Date expireDate = barcodeSave.getExpireDate();
if (expireDate != null) { if (expireDate != null) {
if (System.currentTimeMillis() > expireDate.getTime()) { if (System.currentTimeMillis() > expireDate.getTime()) {
throw new ValidateException("error.barcode.expired", "物料已过期,无法入库."); throw new ValidateException("smfcore.error.barcode.expired", "物料已过期,无法入库.");
} }
} }
...@@ -429,11 +429,11 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -429,11 +429,11 @@ public class BaseDeviceHandler implements IDeviceHandler {
} }
if(!canPutIn){ if(!canPutIn){
throw new ValidateException("error.barcode.wrongSize", new String[]{w + "x" + h},"尺寸["+w+"x"+h+"]不符"); throw new ValidateException("smfcode.error.barcode.wrongSize","尺寸[{0}]不符", new String[]{w + "x" + h});
} }
if (barcodeSave.getAmount() <= 0) { if (barcodeSave.getAmount() <= 0) {
throw new ValidateException("error.barcode.wrongQty", new String[]{barcodeSave.getBarcode(), barcodeSave.getAmount() + ""}, "条码[" + barcodeSave.getBarcode() + "]对应的数量<=0为: " + barcodeSave.getAmount()); throw new ValidateException("smfcode.error.barcode.wrongQty", "条码[{0}]对应的数量<=0为: {1}" , new String[]{barcodeSave.getBarcode(), barcodeSave.getAmount() + ""});
} }
// if(barcodeSave.getPlateSize() <=0 || barcodeSave.getHeight() <= 0){ // if(barcodeSave.getPlateSize() <=0 || barcodeSave.getHeight() <= 0){
...@@ -444,7 +444,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -444,7 +444,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
if (pos != null) { if (pos != null) {
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
throw new ValidateException("error.barcode.inStorage", new String[]{barcodeSave.getBarcode(), storage.getName(), pos.getPosName()}, "[ " + barcodeSave.getBarcode() + "]已在" + storage.getName() + "[" + pos.getPosName() + "]中"); throw new ValidateException("error.barcode.inStorage", "[ " + barcodeSave.getBarcode() + "]已在" + storage.getName() + "[" + pos.getPosName() + "]中", new String[]{barcodeSave.getBarcode(), storage.getName(), pos.getPosName()});
} }
for (DataLog task : taskService.getQueueTasks()) { for (DataLog task : taskService.getQueueTasks()) {
...@@ -456,7 +456,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -456,7 +456,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
return barcodeSave; return barcodeSave;
} }
} }
throw new ValidateException("error.barcode.taskNotEnd", new String[]{barcodeSave.getBarcode()}, "料盘[ " + barcodeSave.getBarcode() + "]的操作未完成,无法执行入库操作"); throw new ValidateException("smfcode.error.barcode.taskNotEnd", "料盘[{0}]的操作未完成,无法执行入库操作", new String[]{barcodeSave.getBarcode()});
} }
} }
} }
......
...@@ -129,7 +129,7 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -129,7 +129,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
//同条码,但不是同料仓 //同条码,但不是同料仓
log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId()); log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId());
//throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行"); //throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行");
throw new ValidateException("error.barcode.executing", new String[]{barcodeSave.getBarcode()}); throw new ValidateException("smfcode.error.barcode.executing","条码[{0}}]任务正在执行" ,new String[]{barcodeSave.getBarcode()});
} }
} }
...@@ -146,19 +146,19 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -146,19 +146,19 @@ public class SpBoxHandler extends BaseDeviceHandler {
storagePos = storagePosManager.getByPosName(posName); storagePos = storagePosManager.getByPosName(posName);
if (storagePos == null) { if (storagePos == null) {
throw new ValidateException("error.pos.notExist", new String[]{posName}, "库位【" + posName + "】不存在,无法入库"); throw new ValidateException("smfcode.error.pos.notExist", "库位【{0}】不存在,无法入库", new String[]{posName});
} }
if (!storage.getId().equals(storagePos.getStorageId())) { if (!storage.getId().equals(storagePos.getStorageId())) {
throw new ValidateException("error.pos.wrong", new String[]{posName, storage.getCid()}, "库位【" + posName + "】与料仓[" + storage.getCid() + "]不匹配,无法入库"); throw new ValidateException("smfcode.error.pos.wrong", "库位【{0}】与料仓[{1}]不匹配,无法入库", new String[]{posName, storage.getCid()});
} }
if (storagePos.getBarcode() != null) { if (storagePos.getBarcode() != null) {
throw new ValidateException("error.pos.hasReel", new String[]{posName}, "库位【" + posName + "】中已有物料,无法入库"); throw new ValidateException("smfcode.error.pos.hasReel", "库位【{0}】中已有物料,无法入库", new String[]{posName});
} }
if (!storage.canPutInPos(barcodeSave.getPlateSize(), barcodeSave.getHeight(), storagePos.getW(), storagePos.getH())) { if (!storage.canPutInPos(barcodeSave.getPlateSize(), barcodeSave.getHeight(), storagePos.getW(), storagePos.getH())) {
String reelSize = barcodeSave.getPlateSize() + "x" + barcodeSave.getHeight(); String reelSize = barcodeSave.getPlateSize() + "x" + barcodeSave.getHeight();
String posSize = storagePos.getW() + "x" + storagePos.getH(); String posSize = storagePos.getW() + "x" + storagePos.getH();
throw new ValidateException("error.pos.sizeNotMatch", new String[]{}, "料盘尺寸[" + reelSize + "]与库位" + posName + "尺寸[" + posSize + "]不符,无法入库"); throw new ValidateException("smfcode.error.pos.sizeNotMatch", "料盘尺寸[{0}]与库位{1}尺寸[{2}]不符,无法入库", new String[]{reelSize,posName,posSize});
} }
} else { } else {
......
...@@ -47,7 +47,7 @@ public class BoxTaskDto { ...@@ -47,7 +47,7 @@ public class BoxTaskDto {
/** /**
* 状态:OP_STATUS * 状态:OP_STATUS
*/ */
private String status; private String taskStatus;
/** /**
* 指定批次Id * 指定批次Id
......
...@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.language.util; ...@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.language.util;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Locale; import java.util.Locale;
...@@ -27,11 +28,9 @@ public class MessageUtils { ...@@ -27,11 +28,9 @@ public class MessageUtils {
public String getText(String msgKey, String[] params, Locale locale, String defaultMsg) { public String getText(String msgKey, String[] params, Locale locale, String defaultMsg) {
try{ try{
if (params == null) { if (params == null) {
return defaultMsg; return messageSource.getMessage(msgKey, new String[]{}, locale);
// return messageSource.getMessage(msgKey, params, locale);
} else { } else {
return MessageFormat.format(defaultMsg,params); return messageSource.getMessage(msgKey,params, locale);
// return messageSource.getMessage(msgKey, new String[]{}, locale);
} }
}catch (Exception ex){ }catch (Exception ex){
if(defaultMsg != null){ if(defaultMsg != null){
......
...@@ -76,7 +76,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -76,7 +76,7 @@ public class LiteOrderCache implements ITaskListener {
//其他出库模式一次性全部生成任务 //其他出库模式一次性全部生成任务
List<StoragePos> lockPosList = storagePosManager.findLockPos(liteOrder.getOrderNo()); List<StoragePos> lockPosList = storagePosManager.findLockPos(liteOrder.getOrderNo());
if(lockPosList==null){ if(lockPosList==null){
throw new ValidateException("未找到锁定库位"); throw new ValidateException("smfcore.notFindPos","未找到锁定库位");
} }
int taskReelCount = 0; int taskReelCount = 0;
for (StoragePos lockPos : lockPosList) { for (StoragePos lockPos : lockPosList) {
......
...@@ -7,7 +7,6 @@ import com.neotel.smfcore.common.annotation.QueryCondition; ...@@ -7,7 +7,6 @@ import com.neotel.smfcore.common.annotation.QueryCondition;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader; import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
...@@ -104,14 +103,14 @@ public class OrderController { ...@@ -104,14 +103,14 @@ public class OrderController {
String image = "csv"; String image = "csv";
String fileType = FileUtil.getExtensionName(orderFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(orderFile.getOriginalFilename());
if (fileType != null && !image.contains(fileType)) { if (fileType != null && !image.contains(fileType)) {
throw new BadRequestException("smfcode.feleFormatError", "文件格式错误!, 仅支持{0}格式", new String[]{image}); throw new ValidateException("smfcode.feleFormatError", "文件格式错误!, 仅支持{0}格式", new String[]{image});
} }
File folder = new File(properties.getPath(), "pos"); File folder = new File(properties.getPath(), "pos");
File localFile = FileUtil.upload(orderFile, folder.getAbsolutePath()); File localFile = FileUtil.upload(orderFile, folder.getAbsolutePath());
List<LiteOrderItem> liteOrderItems = handleOrderCsv(localFile.getAbsolutePath()); List<LiteOrderItem> liteOrderItems = handleOrderCsv(localFile.getAbsolutePath());
if (liteOrderItems == null || liteOrderItems.size() <= 0) { if (liteOrderItems == null || liteOrderItems.size() <= 0) {
throw new BadRequestException("smfcode.fileError", "文件解析失败"); throw new ValidateException("smfcode.fileError", "文件解析失败");
} }
...@@ -127,8 +126,8 @@ public class OrderController { ...@@ -127,8 +126,8 @@ public class OrderController {
} else { } else {
log.info("数据库中已存在工单号为[" + liteOrder.getOrderNo() + "],忽略文件:" + localFile.getAbsolutePath()); log.info("数据库中已存在工单号为[" + liteOrder.getOrderNo() + "],忽略文件:" + localFile.getAbsolutePath());
throw new BadRequestException("smfcode.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"orderNo", liteOrder.getOrderNo()}); throw new ValidateException("smfcode.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"orderNo", liteOrder.getOrderNo()});
// throw new BadRequestException("工单号[" + liteOrder.getOrderNo() + "]已存在"); // throw new ValidateException("工单号[" + liteOrder.getOrderNo() + "]已存在");
} }
return ResultBean.newOkResult("工单上传成功"); return ResultBean.newOkResult("工单上传成功");
...@@ -140,12 +139,12 @@ public class OrderController { ...@@ -140,12 +139,12 @@ public class OrderController {
public ResultBean delete(@RequestBody Map<String, String> mapValues) { public ResultBean delete(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo"); String orderNo = mapValues.get("orderNo");
if (orderNo == null) { if (orderNo == null) {
// throw new BadRequestException("工单号不能为空"); // throw new ValidateException("工单号不能为空");
throw new BadRequestException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo); LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo);
if (liteOrder == null) { if (liteOrder == null) {
throw new BadRequestException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"orderNo", orderNo}); throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"orderNo", orderNo});
} }
// ResultBean resultBean = liteOrderCache.checkOutOrder(liteOrder); // ResultBean resultBean = liteOrderCache.checkOutOrder(liteOrder);
String result = liteOrderCache.checkOutLiteOrder(orderNo, false); String result = liteOrderCache.checkOutLiteOrder(orderNo, false);
...@@ -183,7 +182,8 @@ public class OrderController { ...@@ -183,7 +182,8 @@ public class OrderController {
int index = csvReader.getIndex(titleName, titleNameEn); int index = csvReader.getIndex(titleName, titleNameEn);
if (index == -1) { if (index == -1) {
log.info("未包含【" + titleName + "】或【" + titleNameEn + "】列"); log.info("未包含【" + titleName + "】或【" + titleNameEn + "】列");
throw new ValidateException("必须包含[" + titleNameEn + "]列"); // throw new ValidateException("必须包含[" + titleNameEn + "]列");
throw new ValidateException("smfcode.error.columnNotExist","必须包含[{0}列",new String[]{titleNameEn});
} }
return index; return index;
} }
...@@ -263,6 +263,6 @@ public class OrderController { ...@@ -263,6 +263,6 @@ public class OrderController {
} }
} }
throw new BadRequestException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
} }
...@@ -4,7 +4,6 @@ import com.google.common.base.Strings; ...@@ -4,7 +4,6 @@ import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader; import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
...@@ -101,7 +100,7 @@ public class StorageController { ...@@ -101,7 +100,7 @@ public class StorageController {
public ResponseEntity<Object> update(@Validated @RequestBody StorageDto resources) { public ResponseEntity<Object> update(@Validated @RequestBody StorageDto resources) {
Storage Storage=storageMapper.toEntity(resources); Storage Storage=storageMapper.toEntity(resources);
if (Storage.getId() == null) { if (Storage.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
saveStorage(Storage); saveStorage(Storage);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -116,7 +115,7 @@ public class StorageController { ...@@ -116,7 +115,7 @@ public class StorageController {
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
} }
deleteStorages(ids); deleteStorages(ids);
...@@ -138,7 +137,7 @@ public class StorageController { ...@@ -138,7 +137,7 @@ public class StorageController {
if (pos.getBarcode() == null || pos.getBarcode().equals("")) { if (pos.getBarcode() == null || pos.getBarcode().equals("")) {
} else { } else {
throw new BadRequestException("smfcode.posIsused","料仓[{0}]的库位[{1}}]有料[{2}],删除失败",new String[]{ storage.getName() ,pos.getPosName(),pos.getBarcode().getBarcode()}); throw new ValidateException("smfcode.posIsused","料仓[{0}]的库位[{1}}]有料[{2}],删除失败",new String[]{ storage.getName() ,pos.getPosName(),pos.getBarcode().getBarcode()});
// throw new BadRequestException("料仓[" + storage.getName() + "]的库位[" + pos.getPosName() + "]有料[" + pos.getBarcode() + "],删除失败"); // throw new BadRequestException("料仓[" + storage.getName() + "]的库位[" + pos.getPosName() + "]有料[" + pos.getBarcode() + "],删除失败");
} }
} }
...@@ -153,16 +152,16 @@ public class StorageController { ...@@ -153,16 +152,16 @@ public class StorageController {
} }
private Storage saveStorage(Storage storage) { private Storage saveStorage(Storage storage) {
if(storage.getName()==null){ if(storage.getName()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"name"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"name"} );
// throw new BadRequestException("料仓名称不能为空"); // throw new BadRequestException("料仓名称不能为空");
} if(storage.getCid()==null){ } if(storage.getCid()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"cid"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"cid"} );
// throw new BadRequestException("料仓编号不能为空"); // throw new BadRequestException("料仓编号不能为空");
} if(storage.getType()==null){ } if(storage.getType()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"type"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"type"} );
// throw new BadRequestException("料仓类型不能为空"); // throw new BadRequestException("料仓类型不能为空");
} if(storage.getCompatibleType()==null){ } if(storage.getCompatibleType()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"compatibleType"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"compatibleType"} );
// throw new BadRequestException("料仓兼容性不能为空"); // throw new BadRequestException("料仓兼容性不能为空");
} }
...@@ -172,15 +171,14 @@ public class StorageController { ...@@ -172,15 +171,14 @@ public class StorageController {
for (Storage s:storageMap.values() for (Storage s:storageMap.values()
) { ) {
if(isNew || (!storage.getId().equals(s.getId()))) { if(isNew || (!storage.getId().equals(s.getId()))) {
if(s.getName().equals(storage.getName())){
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"name",storage.getName()});
// throw new BadRequestException("料仓名称["+storage.getCid()+"]已存在");
}
if(s.getCid().equals(storage.getCid())){ if(s.getCid().equals(storage.getCid())){
throw new BadRequestException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"cid",storage.getCid()}); throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"cid",storage.getCid()});
// throw new BadRequestException("料仓cid["+storage.getCid()+"]已存在"); // throw new BadRequestException("料仓cid["+storage.getCid()+"]已存在");
} }
else if(s.getName().equals(storage.getName())){
throw new BadRequestException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"name",storage.getName()});
// throw new BadRequestException("料仓名称["+storage.getCid()+"]已存在");
}
} }
} }
...@@ -204,7 +202,7 @@ public class StorageController { ...@@ -204,7 +202,7 @@ public class StorageController {
String image = "csv"; String image = "csv";
String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename());
if(fileType != null && !image.contains(fileType)){ if(fileType != null && !image.contains(fileType)){
throw new BadRequestException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image}); throw new ValidateException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image});
} }
File folder = new File(properties.getPath(),"pos"); File folder = new File(properties.getPath(),"pos");
File file = FileUtil.upload(uploadFile, folder.getAbsolutePath()); File file = FileUtil.upload(uploadFile, folder.getAbsolutePath());
...@@ -217,7 +215,8 @@ public class StorageController { ...@@ -217,7 +215,8 @@ public class StorageController {
int index = csvReader.getIndex(titleName, titleNameEn); int index = csvReader.getIndex(titleName, titleNameEn);
if (index == -1) { if (index == -1) {
log.info("未包含【" + titleName + "】或【" + titleNameEn + "】列"); log.info("未包含【" + titleName + "】或【" + titleNameEn + "】列");
throw new ValidateException("必须包含[" + titleNameEn + "]列"); // throw new ValidateException("必须包含[" + titleNameEn + "]列");
throw new ValidateException("smfcode.columnNotExist","必须包含[{0}列",new String[]{titleNameEn});
} }
return index; return index;
} }
...@@ -227,12 +226,13 @@ public class StorageController { ...@@ -227,12 +226,13 @@ public class StorageController {
log.info("开始更新料仓【"+storageId+"】的位置信息"); log.info("开始更新料仓【"+storageId+"】的位置信息");
if (Strings.isNullOrEmpty(storageId)) { if (Strings.isNullOrEmpty(storageId)) {
log.error("Storage id is null"); log.error("Storage id is null");
throw new ValidateException("storage.error.notExist"); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"storageId"} );
} }
Storage storage = storageManager.get(storageId); Storage storage = storageManager.get(storageId);
if (storage == null) { if (storage == null) {
log.error("Storage id is not exist"); log.error("Storage id is not exist");
throw new ValidateException("storage.error.notExist"); throw new ValidateException("smfcore.storage.error.notExist","未找到料仓{0}",new String[]{storageId});
} }
CsvReader csvRead = new CsvReader(fileURL); CsvReader csvRead = new CsvReader(fileURL);
......
...@@ -2,7 +2,7 @@ package com.neotel.smfcore.core.storage.rest; ...@@ -2,7 +2,7 @@ package com.neotel.smfcore.core.storage.rest;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.StorageConstants; import com.neotel.smfcore.common.utils.StorageConstants;
...@@ -78,8 +78,8 @@ public class StoragePosController { ...@@ -78,8 +78,8 @@ public class StoragePosController {
log.info("开始清理料仓["+cid+"] 所有位置"); log.info("开始清理料仓["+cid+"] 所有位置");
Storage storage=dataCache.getStorage(cid); Storage storage=dataCache.getStorage(cid);
if(storage==null){ if(storage==null){
throw new BadRequestException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"cid", cid}); throw new ValidateException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"cid", cid});
// throw new BadRequestException("未找到料仓:"+cid); // throw new ValidateException("未找到料仓:"+cid);
} }
storagePosManager.removePosByStorageId(storage.getId()); storagePosManager.removePosByStorageId(storage.getId());
log.info("清理料仓["+cid+"] 所有位置完成"); log.info("清理料仓["+cid+"] 所有位置完成");
...@@ -99,12 +99,12 @@ public class StoragePosController { ...@@ -99,12 +99,12 @@ public class StoragePosController {
@PreAuthorize("@el.check('storage:edit')") @PreAuthorize("@el.check('storage:edit')")
public ResponseEntity<Object> enabledPos(@RequestBody StoragePosEnabledDto enabledDto) { public ResponseEntity<Object> enabledPos(@RequestBody StoragePosEnabledDto enabledDto) {
if(enabledDto.getId()==null){ if(enabledDto.getId()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
StoragePos pos=storagePosDao.findOneById(enabledDto.getId()); StoragePos pos=storagePosDao.findOneById(enabledDto.getId());
if(pos==null){ if(pos==null){
throw new BadRequestException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"PosId", enabledDto.getId()}); throw new ValidateException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"PosId", enabledDto.getId()});
// throw new BadRequestException("未找到库位 "); // throw new ValidateException("未找到库位 ");
} }
pos.setEnabled(enabledDto.isEnabled()); pos.setEnabled(enabledDto.isEnabled());
storagePosDao.save(pos); storagePosDao.save(pos);
...@@ -119,15 +119,15 @@ public class StoragePosController { ...@@ -119,15 +119,15 @@ public class StoragePosController {
@PreAuthorize("@el.check('storage:edit')") @PreAuthorize("@el.check('storage:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody StoragePosSaveDto saveDto) { public ResponseEntity<Object> update(@Validated @RequestBody StoragePosSaveDto saveDto) {
if(saveDto.getId()==null){ if(saveDto.getId()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
if(saveDto.getPosName()==null){ if(saveDto.getPosName()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
StoragePos pos=storagePosDao.findOneById(saveDto.getId()); StoragePos pos=storagePosDao.findOneById(saveDto.getId());
if(pos==null){ if(pos==null){
throw new BadRequestException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"PosId", saveDto.getId()}); throw new ValidateException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"PosId", saveDto.getId()});
// throw new BadRequestException("未找到库位 "); // throw new ValidateException("未找到库位 ");
} }
pos.setPosName(saveDto.getPosName()); pos.setPosName(saveDto.getPosName());
pos.setPriority(saveDto.getPriority()); pos.setPriority(saveDto.getPriority());
...@@ -153,7 +153,7 @@ public class StoragePosController { ...@@ -153,7 +153,7 @@ public class StoragePosController {
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
} }
storagePosManager.deletePoss(ids); storagePosManager.deletePoss(ids);
...@@ -205,7 +205,7 @@ public class StoragePosController { ...@@ -205,7 +205,7 @@ public class StoragePosController {
public ResponseEntity<Object> checkout(@Validated @RequestBody CheckOutDto checkOutDto) { public ResponseEntity<Object> checkout(@Validated @RequestBody CheckOutDto checkOutDto) {
if (checkOutDto.getPids() == null) { if (checkOutDto.getPids() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
if(checkOutDto.getSingleOut()==null){ if(checkOutDto.getSingleOut()==null){
checkOutDto.setSingleOut(true+""); checkOutDto.setSingleOut(true+"");
...@@ -217,19 +217,19 @@ public class StoragePosController { ...@@ -217,19 +217,19 @@ public class StoragePosController {
for (String pid : checkOutDto.getPids()) { for (String pid : checkOutDto.getPids()) {
StoragePos pos = storagePosManager.get(pid); StoragePos pos = storagePosManager.get(pid);
if (pos == null) { if (pos == null) {
throw new BadRequestException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"pid",pid}); throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"pid",pid});
// throw new BadRequestException("位置[" + pid + "]不存在"); // throw new ValidateException("位置[" + pid + "]不存在");
} }
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) { if (storage == null) {
throw new BadRequestException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"storageId",pos.getStorageId()}); throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"storageId",pos.getStorageId()});
// throw new BadRequestException("料仓[" + pos.getStorageId() + "]不存在"); // throw new ValidateException("料仓[" + pos.getStorageId() + "]不存在");
} }
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】"); log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
String outResult = taskService.checkout(storage, pos, isSingleOut); String outResult = taskService.checkout(storage, pos, isSingleOut);
if (!Strings.isNullOrEmpty(outResult)) { if (!Strings.isNullOrEmpty(outResult)) {
throw new BadRequestException("smfcode.error", outResult); throw new ValidateException("smfcode.error", outResult);
} }
} }
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
......
package com.neotel.smfcore.core.storage.service.manager.impl; package com.neotel.smfcore.core.storage.service.manager.impl;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.storage.service.dao.IStorageDao; import com.neotel.smfcore.core.storage.service.dao.IStorageDao;
......
...@@ -3,7 +3,6 @@ package com.neotel.smfcore.core.storage.service.manager.impl; ...@@ -3,7 +3,6 @@ package com.neotel.smfcore.core.storage.service.manager.impl;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.bean.PlateSizeBean; import com.neotel.smfcore.core.barcode.bean.PlateSizeBean;
...@@ -266,7 +265,7 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -266,7 +265,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
if(pos.getBarcode()==null||pos.getBarcode().equals("")) { if(pos.getBarcode()==null||pos.getBarcode().equals("")) {
}else{ }else{
throw new BadRequestException("smfcode.thePosIsused"," 库位[{0}]有料[{1}],不能删除",new String[]{ pos.getPosName(),pos.getBarcode().getBarcode()}); throw new ValidateException("smfcode.thePosIsused"," 库位[{0}]有料[{1}],不能删除",new String[]{ pos.getPosName(),pos.getBarcode().getBarcode()});
// throw new BadRequestException("库位[" + pos.getPosName() + "]中有料[" + pos.getBarcode() + "],不能删除"); // throw new BadRequestException("库位[" + pos.getPosName() + "]中有料[" + pos.getBarcode() + "],不能删除");
} }
delPosName+="["+pos.getId()+"_"+pos.getPosName()+"]"; delPosName+="["+pos.getId()+"_"+pos.getPosName()+"]";
......
package com.neotel.smfcore.core.system.rest; package com.neotel.smfcore.core.system.rest;
import com.neotel.smfcore.common.exception.BadRequestException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.system.rest.bean.dto.SettingsDto; import com.neotel.smfcore.core.system.rest.bean.dto.SettingsDto;
import com.neotel.smfcore.core.system.rest.bean.mapstruct.SettingsMapper; import com.neotel.smfcore.core.system.rest.bean.mapstruct.SettingsMapper;
...@@ -49,19 +49,19 @@ public class SettingsController { ...@@ -49,19 +49,19 @@ public class SettingsController {
if(settingsDto.getMaxHumidity()<=settingsDto.getMinHumidity()){ if(settingsDto.getMaxHumidity()<=settingsDto.getMinHumidity()){
throw new BadRequestException("smfcode.humidityValueError","温度范围数据错误" ); throw new ValidateException("smfcode.humidityValueError","温度范围数据错误" );
// throw new BadRequestException("温度范围数据错误"); // throw new BadRequestException("温度范围数据错误");
} }
if(settingsDto.getMaxHumidityShow()<=settingsDto.getMinHumidityShow()){ if(settingsDto.getMaxHumidityShow()<=settingsDto.getMinHumidityShow()){
throw new BadRequestException("smfcode.humidityShowValueError","温度显示范围数据错误" ); throw new ValidateException("smfcode.humidityShowValueError","温度显示范围数据错误" );
// throw new BadRequestException("温度显示范围数据错误"); // throw new BadRequestException("温度显示范围数据错误");
} }
if(settingsDto.getMaxTemperature()<=settingsDto.getMinTemperature()){ if(settingsDto.getMaxTemperature()<=settingsDto.getMinTemperature()){
throw new BadRequestException("smfcode.temperatureValueError","湿度范围数据错误" ); throw new ValidateException("smfcode.temperatureValueError","湿度范围数据错误" );
// throw new BadRequestException("湿度范围数据错误"); // throw new BadRequestException("湿度范围数据错误");
} }
if(settingsDto.getMaxTemperatureShow()<=settingsDto.getMinTemperatureShow()){ if(settingsDto.getMaxTemperatureShow()<=settingsDto.getMinTemperatureShow()){
throw new BadRequestException("smfcode.temperatureShowValueError","湿度显示范围数据错误" ); throw new ValidateException("smfcode.temperatureShowValueError","湿度显示范围数据错误" );
// throw new BadRequestException("湿度显示范围数据错误"); // throw new BadRequestException("湿度显示范围数据错误");
} }
......
...@@ -82,7 +82,7 @@ public class TaskService { ...@@ -82,7 +82,7 @@ public class TaskService {
if (pos.getBarcode() == null) { if (pos.getBarcode() == null) {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略"; String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg); log.info(msg);
throw new ValidateException("allBoxView.noReel","库位中无物料"); throw new ValidateException("smfcore.allBoxView.noReel","库位中无物料");
} }
DataLog task = new DataLog(storage, pos.getBarcode(), pos); DataLog task = new DataLog(storage, pos.getBarcode(), pos);
...@@ -132,10 +132,10 @@ public class TaskService { ...@@ -132,10 +132,10 @@ public class TaskService {
String posName = taskToExecute.getPosName(); String posName = taskToExecute.getPosName();
if (!Strings.isNullOrEmpty(barcode) && task.getBarcode().equals(barcode)) { if (!Strings.isNullOrEmpty(barcode) && task.getBarcode().equals(barcode)) {
log.info("二维码:[" + barcode + "]已在操作队列中,操作失败"); log.info("二维码:[" + barcode + "]已在操作队列中,操作失败");
throw new ValidateException("error.barcode.inQueue", new String[]{barcode}); throw new ValidateException("smfcode.error.barcode.inQueue","二维码[{0}]已在操作队列中,操作失败", new String[]{barcode});
} else if (task.getPosName().equals(posName)) { } else if (task.getPosName().equals(posName)) {
log.info("位置:[" + posName + "]已在操作队列中,操作失败"); log.info("位置:[" + posName + "]已在操作队列中,操作失败");
throw new ValidateException("error.pos.inQueue", new String[]{posName}); throw new ValidateException("smfcode.error.pos.inQueue","位置:[{0}}]已在操作队列中,操作失败", new String[]{posName});
} }
} }
updateQueueTask(taskToExecute); updateQueueTask(taskToExecute);
......
package com.neotel.smfcore.security.rest; package com.neotel.smfcore.security.rest;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.storage.service.manager.IStorageManager; import com.neotel.smfcore.core.storage.service.manager.IStorageManager;
...@@ -96,7 +95,7 @@ public class GroupController { ...@@ -96,7 +95,7 @@ public class GroupController {
public ResponseEntity<Object> update(@RequestBody GroupDto groupDto) { public ResponseEntity<Object> update(@RequestBody GroupDto groupDto) {
Group resources=groupMapper.toEntity(groupDto); Group resources=groupMapper.toEntity(groupDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
groupManager.saveGroup(resources); groupManager.saveGroup(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
...@@ -109,21 +108,21 @@ public class GroupController { ...@@ -109,21 +108,21 @@ public class GroupController {
Set<Group> menuSet = new HashSet<>(); Set<Group> menuSet = new HashSet<>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
Group group = groupManager.get(id); Group group = groupManager.get(id);
//查找组下是否有设备 //查找组下是否有设备
Query query = new Query(Criteria.where("groupId").is(id)); Query query = new Query(Criteria.where("groupId").is(id));
List<Storage> storages = storageManager.findByQuery(query); List<Storage> storages = storageManager.findByQuery(query);
if (storages != null && storages.size() >= 1) { if (storages != null && storages.size() >= 1) {
throw new BadRequestException("smfcode.groupWithStorage","组[{0}]已和设备关联",new String[]{group.getGroupName()}); throw new ValidateException("smfcode.groupWithStorage","组[{0}]已和设备关联",new String[]{group.getGroupName()});
} }
Query userQuery = new Query(Criteria.where("groups").all(id)); Query userQuery = new Query(Criteria.where("groups").all(id));
List<User> users = userManager.findByQuery(userQuery); List<User> users = userManager.findByQuery(userQuery);
if (users != null && users.size() >= 1) { if (users != null && users.size() >= 1) {
throw new BadRequestException("smfcode.groupWithUser","组[{0}]已和用户关联",new String[]{group.getGroupName()}); throw new ValidateException("smfcode.groupWithUser","组[{0}]已和用户关联",new String[]{group.getGroupName()});
// throw new BadRequestException("删除失败,组[" + group.getGroupName() + "]已和用户关联"); // throw new ValidateException("删除失败,组[" + group.getGroupName() + "]已和用户关联");
} }
groupManager.delete(group); groupManager.delete(group);
} }
......
...@@ -18,7 +18,6 @@ package com.neotel.smfcore.security.rest; ...@@ -18,7 +18,6 @@ package com.neotel.smfcore.security.rest;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.neotel.smfcore.common.annotation.QueryCondition; import com.neotel.smfcore.common.annotation.QueryCondition;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
...@@ -156,7 +155,7 @@ public class MenuController { ...@@ -156,7 +155,7 @@ public class MenuController {
public ResponseEntity<Object> update(@Validated @RequestBody MenuDto menuDto) { public ResponseEntity<Object> update(@Validated @RequestBody MenuDto menuDto) {
Menu resources=menuMapper.toEntity(menuDto); Menu resources=menuMapper.toEntity(menuDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
menuManager.saveMenu(resources); menuManager.saveMenu(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
...@@ -168,7 +167,7 @@ public class MenuController { ...@@ -168,7 +167,7 @@ public class MenuController {
@PreAuthorize("@el.check('menu:del')") @PreAuthorize("@el.check('menu:del')")
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){ if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){
throw new BadRequestException("smfcode.noAccessUpdate","没有删除菜单的权限"); throw new ValidateException("smfcode.noAccessUpdate","没有删除菜单的权限");
} }
Set<Menu> menuSet = new HashSet<>(); Set<Menu> menuSet = new HashSet<>();
for (String id : ids) { for (String id : ids) {
......
...@@ -2,7 +2,6 @@ package com.neotel.smfcore.security.rest; ...@@ -2,7 +2,6 @@ package com.neotel.smfcore.security.rest;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils; import com.neotel.smfcore.common.utils.SecurityUtils;
...@@ -104,7 +103,7 @@ public class RoleController { ...@@ -104,7 +103,7 @@ public class RoleController {
Role resources=roleMapper.toEntity(roleDto); Role resources=roleMapper.toEntity(roleDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
roleManager.saveRole(resources); roleManager.saveRole(resources);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -116,7 +115,7 @@ public class RoleController { ...@@ -116,7 +115,7 @@ public class RoleController {
public ResponseEntity<Object> updateMenu(@RequestBody RoleDto roleDto) { public ResponseEntity<Object> updateMenu(@RequestBody RoleDto roleDto) {
Role resources=roleMapper.toEntity(roleDto); Role resources=roleMapper.toEntity(roleDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
Role role = roleManager.get(resources.getId()); Role role = roleManager.get(resources.getId());
roleManager.updateMenu(resources); roleManager.updateMenu(resources);
...@@ -131,13 +130,13 @@ public class RoleController { ...@@ -131,13 +130,13 @@ public class RoleController {
List<Role> roles = new ArrayList<Role>(); List<Role> roles = new ArrayList<Role>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
Role role = roleManager.get(id); Role role = roleManager.get(id);
// 验证是否被用户关联 // 验证是否被用户关联
List<User> users = userManager.findByRoleId(role.getId()); List<User> users = userManager.findByRoleId(role.getId());
if (users != null && users.size() > 0) { if (users != null && users.size() > 0) {
throw new BadRequestException("smfcode.roleCannotDel","角色[{0}]有[{1}]个用户关联改角色,不能删除",new String[]{role.getName(),users.size()+"" }); throw new ValidateException("smfcode.roleCannotDel","角色[{0}]有[{1}]个用户关联改角色,不能删除",new String[]{role.getName(),users.size()+"" });
} }
roles.add(role); roles.add(role);
} }
......
...@@ -20,7 +20,6 @@ import com.neotel.smfcore.common.annotation.QueryCondition; ...@@ -20,7 +20,6 @@ import com.neotel.smfcore.common.annotation.QueryCondition;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.csv.CsvReader; import com.neotel.smfcore.common.csv.CsvReader;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.*; import com.neotel.smfcore.common.utils.*;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
...@@ -105,17 +104,19 @@ public class UserController { ...@@ -105,17 +104,19 @@ public class UserController {
public ResponseEntity<Object> create(@Validated @RequestBody UserDto userDto) { public ResponseEntity<Object> create(@Validated @RequestBody UserDto userDto) {
User resources=userMapper.toEntity(userDto); User resources=userMapper.toEntity(userDto);
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"ID",resources.getId()}); throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"ID",resources.getId()});
// throw new BadRequestException("新增用户:ID已存在"); // throw new ValidateException("新增用户:ID已存在");
} }
if(resources.getUsername()==null){ if(resources.getUsername()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"username"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"username"} );
// throw new BadRequestException("新增用户:用户名不能为空"); // throw new ValidateException("新增用户:用户名不能为空");
} }
if(resources.getRoleId()==null){ if(resources.getRoleId()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"roleId"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"roleId"} );
// throw new BadRequestException("新增用户:角色ID不能为空"); // throw new ValidateException("新增用户:角色ID不能为空");
} }
//判断用户名是否存在
userManager.userNameIsExist(resources.getUsername(),null);
if(resources.getEnabled()==null){ if(resources.getEnabled()==null){
resources.setEnabled(false); resources.setEnabled(false);
} }
...@@ -140,21 +141,21 @@ public class UserController { ...@@ -140,21 +141,21 @@ public class UserController {
public ResponseEntity<Object> update(@Validated @RequestBody UserDto userDto) { public ResponseEntity<Object> update(@Validated @RequestBody UserDto userDto) {
User resources=userMapper.toEntity(userDto); User resources=userMapper.toEntity(userDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
// throw new BadRequestException("修改用户:ID不能为空"); // throw new ValidateException("修改用户:ID不能为空");
} }
if(resources.getUsername()==null){ if(resources.getUsername()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"username"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"username"} );
// throw new BadRequestException("修改用户:用户名不能为空"); // throw new ValidateException("修改用户:用户名不能为空");
} }
if(resources.getRoleId()==null){ if(resources.getRoleId()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"roleId"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"roleId"} );
// throw new BadRequestException("修改用户:角色ID不能为空"); // throw new ValidateException("修改用户:角色ID不能为空");
} }
if (resources.getUsername().equals(Constants.SUPER_USERNAME)) { if (resources.getUsername().equals(Constants.SUPER_USERNAME)) {
if (!resources.getId().equals(SecurityUtils.getCurrentUserId())) { if (!resources.getId().equals(SecurityUtils.getCurrentUserId())) {
throw new BadRequestException("smfcode.hasNoAccess","无权限修改此用户信息" ); throw new ValidateException("smfcode.hasNoAccess","无权限修改此用户信息" );
// throw new BadRequestException("无权限修改此用户信息"); // throw new ValidateException("无权限修改此用户信息");
} }
} }
userManager.update(resources); userManager.update(resources);
...@@ -168,8 +169,8 @@ public class UserController { ...@@ -168,8 +169,8 @@ public class UserController {
public ResponseEntity<Object> center(@Validated @RequestBody UserDto userDto) { public ResponseEntity<Object> center(@Validated @RequestBody UserDto userDto) {
User resources=userMapper.toEntity(userDto); User resources=userMapper.toEntity(userDto);
if (!resources.getId().equals(SecurityUtils.getCurrentUserId())) { if (!resources.getId().equals(SecurityUtils.getCurrentUserId())) {
throw new BadRequestException("smfcode.hasNoAccess","无权限修改此用户信息" ); throw new ValidateException("smfcode.hasNoAccess","无权限修改此用户信息" );
// throw new BadRequestException("不能修改他人资料"); // throw new ValidateException("不能修改他人资料");
} }
userManager.updateCenter(resources); userManager.updateCenter(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
...@@ -184,14 +185,14 @@ public class UserController { ...@@ -184,14 +185,14 @@ public class UserController {
//不能删除自己 //不能删除自己
String currId = SecurityUtils.getCurrentUserId(); String currId = SecurityUtils.getCurrentUserId();
if (currId == id) { if (currId == id) {
throw new BadRequestException("smfcode.canotDelSelf","删除用户:不能删除自己"); throw new ValidateException("smfcode.canotDelSelf","删除用户:不能删除自己");
} }
User user = userManager.get(id); User user = userManager.get(id);
//admin的用户不让删除 //admin的用户不让删除
if ( user.getUsername().equals(Constants.SUPER_USERNAME)) { if ( user.getUsername().equals(Constants.SUPER_USERNAME)) {
throw new BadRequestException("smfcode.canotDelUser","删除用户:此用户不能删除"); throw new ValidateException("smfcode.canotDelUser","删除用户:此用户不能删除");
// throw new BadRequestException("删除用户:此用户不能删除"); // throw new ValidateException("删除用户:此用户不能删除");
} }
} }
userManager.deleteUsers(ids); userManager.deleteUsers(ids);
...@@ -204,10 +205,10 @@ public class UserController { ...@@ -204,10 +205,10 @@ public class UserController {
User user = userManager.get(SecurityUtils.getCurrentUserId()); User user = userManager.get(SecurityUtils.getCurrentUserId());
if (!passwordEncoder.matches(passVo.getOldPass(), user.getPassword())) { if (!passwordEncoder.matches(passVo.getOldPass(), user.getPassword())) {
throw new BadRequestException("smfcode.oldPwdError","修改失败,旧密码错误"); throw new ValidateException("smfcode.oldPwdError","修改失败,旧密码错误");
} }
if (passwordEncoder.matches(passVo.getNewPass(), user.getPassword())) { if (passwordEncoder.matches(passVo.getNewPass(), user.getPassword())) {
throw new BadRequestException("smfcode.newPwdError","新密码不能与旧密码相同"); throw new ValidateException("smfcode.newPwdError","新密码不能与旧密码相同");
} }
userManager.updatePass(user.getUsername(), passwordEncoder.encode(passVo.getNewPass())); userManager.updatePass(user.getUsername(), passwordEncoder.encode(passVo.getNewPass()));
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -221,7 +222,7 @@ public class UserController { ...@@ -221,7 +222,7 @@ public class UserController {
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, user.getPassword()); String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, user.getPassword());
User myUser = userManager.findByUserName(SecurityUtils.getCurrentUsername()); User myUser = userManager.findByUserName(SecurityUtils.getCurrentUsername());
if (!passwordEncoder.matches(password, myUser.getPassword())) { if (!passwordEncoder.matches(password, myUser.getPassword())) {
throw new BadRequestException("smfcode.pwdError","修改邮箱失败,密码错误"); throw new ValidateException("smfcode.pwdError","修改邮箱失败,密码错误");
} }
// verificationCodeService.validated(CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey() + user.getEmail(), code); // verificationCodeService.validated(CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey() + user.getEmail(), code);
userManager.updateEmail(myUser.getUsername(), myUser.getEmail()); userManager.updateEmail(myUser.getUsername(), myUser.getEmail());
...@@ -233,21 +234,21 @@ public class UserController { ...@@ -233,21 +234,21 @@ public class UserController {
public ResponseEntity<Object> updateGroup(@RequestBody UserDto userDto) { public ResponseEntity<Object> updateGroup(@RequestBody UserDto userDto) {
User resources=userMapper.toEntity(userDto); User resources=userMapper.toEntity(userDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
// throw new BadRequestException("修改用户组:ID不能为空"); // throw new ValidateException("修改用户组:ID不能为空");
} }
User user = userManager.get(resources.getId()); User user = userManager.get(resources.getId());
userManager.updateGroups(resources); userManager.updateGroups(resources);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@ApiOperation("上传用户列表") @ApiOperation("上传用户列表:激活用户")
@PostMapping(value = "/upload") @PostMapping(value = "/upload")
public ResultBean upload( @RequestParam MultipartFile uploadFile) throws Exception { public ResultBean upload( @RequestParam MultipartFile uploadFile) throws Exception {
// 验证文件上传的格式 // 验证文件上传的格式
String image = "csv"; String image = "csv";
String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename());
if(fileType != null && !image.contains(fileType)){ if(fileType != null && !image.contains(fileType)){
throw new BadRequestException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image}); throw new ValidateException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image});
} }
File folder = new File(properties.getPath(),"user"); File folder = new File(properties.getPath(),"user");
File file = FileUtil.upload(uploadFile, folder.getAbsolutePath()); File file = FileUtil.upload(uploadFile, folder.getAbsolutePath());
...@@ -258,7 +259,8 @@ public class UserController { ...@@ -258,7 +259,8 @@ public class UserController {
int index = csvReader.getIndex(titleName,titleNameEn); int index = csvReader.getIndex(titleName,titleNameEn);
if(index == -1){ if(index == -1){
log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列"); log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列");
throw new ValidateException("必须包含["+titleNameEn+"]列"); // throw new ValidateException("必须包含["+titleNameEn+"]列");
throw new ValidateException("smfcode.columnNotExist","必须包含[{0}列",new String[]{titleNameEn});
} }
return index; return index;
} }
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
*/ */
package com.neotel.smfcore.security.service; package com.neotel.smfcore.security.service;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.EntityNotFoundException; import com.neotel.smfcore.common.exception.EntityNotFoundException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.Md5Utls; import com.neotel.smfcore.common.utils.Md5Utls;
import com.neotel.smfcore.security.bean.LoginProperties; import com.neotel.smfcore.security.bean.LoginProperties;
...@@ -76,16 +76,16 @@ public class UserDetailsServiceImpl implements UserDetailsService { ...@@ -76,16 +76,16 @@ public class UserDetailsServiceImpl implements UserDetailsService {
user = userManager.findByUserName(username); user = userManager.findByUserName(username);
} catch (EntityNotFoundException e) { } catch (EntityNotFoundException e) {
// SpringSecurity会自动转换UsernameNotFoundException为BadCredentialsException // SpringSecurity会自动转换UsernameNotFoundException为BadCredentialsException
throw new UsernameNotFoundException("", e); throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"username",username});
} }
if (user == null) { if (user == null) {
throw new UsernameNotFoundException(""); throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"username",username});
} else { } else {
if(user.getEnabled()==null){ if(user.getEnabled()==null){
throw new BadRequestException("smfcode.notActivated","账号未激活"); throw new ValidateException("smfcode.notActivated","账号未激活");
} }
if (!user.getEnabled()) { if (!user.getEnabled()) {
throw new BadRequestException("smfcode.notActivated","账号未激活"); throw new ValidateException("smfcode.notActivated","账号未激活");
} }
if(user.getUsername().equals(Constants.SUPER_USERNAME)){ if(user.getUsername().equals(Constants.SUPER_USERNAME)){
...@@ -93,7 +93,7 @@ public class UserDetailsServiceImpl implements UserDetailsService { ...@@ -93,7 +93,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
//判断激活码是否正确 //判断激活码是否正确
String code = Md5Utls.getMd5(user.getId(), user.getCreateDate()); String code = Md5Utls.getMd5(user.getId(), user.getCreateDate());
if (!code.equals(user.getCheckCode())) { if (!code.equals(user.getCheckCode())) {
throw new BadRequestException("smfcode.notActivated","账号未激活"); throw new ValidateException("smfcode.notActivated","账号未激活");
} }
} }
List<Long> dataScopes = new ArrayList<>(); List<Long> dataScopes = new ArrayList<>();
......
...@@ -31,6 +31,8 @@ import java.util.Set; ...@@ -31,6 +31,8 @@ import java.util.Set;
*/ */
public interface IUserManager extends IBaseManager<User> { public interface IUserManager extends IBaseManager<User> {
void userNameIsExist(String username, String id);
/** /**
* 其他人编辑用户信息 * 其他人编辑用户信息
* @param user * @param user
......
package com.neotel.smfcore.security.service.manager.impl; package com.neotel.smfcore.security.service.manager.impl;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
...@@ -43,13 +42,14 @@ public class GroupManagerImpl implements IGroupManager { ...@@ -43,13 +42,14 @@ public class GroupManagerImpl implements IGroupManager {
logName="修改分组:"; logName="修改分组:";
} }
if (resources.getGroupName() == null) { if (resources.getGroupName() == null) {
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"groupName"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"groupName"} );
// throw new BadRequestException(logName+"组名称不能为空"); // throw new BadRequestException(logName+"组名称不能为空");
} }
Query que = new Query(c); Query que = new Query(c);
List<Group> groups = findByQuery(que); List<Group> groups = findByQuery(que);
if (groups != null && groups.size() > 0) { if (groups != null && groups.size() > 0) {
throw new ValidateException(logName+"组名称[" + resources.getGroupName() + "]已存在"); // throw new ValidateException(logName+"组名称[" + resources.getGroupName() + "]已存在");
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"groupname",resources.getGroupName()});
} }
return groupDao.save(resources); return groupDao.save(resources);
} }
......
...@@ -3,7 +3,6 @@ package com.neotel.smfcore.security.service.manager.impl; ...@@ -3,7 +3,6 @@ package com.neotel.smfcore.security.service.manager.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
...@@ -229,11 +228,11 @@ public class MenuManagerImpl implements IMenuManager { ...@@ -229,11 +228,11 @@ public class MenuManagerImpl implements IMenuManager {
if(menu.getType()==null){ if(menu.getType()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"Type"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"Type"} );
// throw new BadRequestException("菜单类型不能为空"); // throw new BadRequestException("菜单类型不能为空");
} }
if(menu.getTitle()==null){ if(menu.getTitle()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"Title"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"Title"} );
// throw new BadRequestException( "菜单标题不能为空"); // throw new BadRequestException( "菜单标题不能为空");
} }
if(menu.getChildren()==null){ if(menu.getChildren()==null){
...@@ -267,7 +266,7 @@ public class MenuManagerImpl implements IMenuManager { ...@@ -267,7 +266,7 @@ public class MenuManagerImpl implements IMenuManager {
//菜单path不能重复 //菜单path不能重复
Menu pathMenu=menuDao.findOne(quer); Menu pathMenu=menuDao.findOne(quer);
if(pathMenu!=null){ if(pathMenu!=null){
throw new BadRequestException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"path",pathMenu.getPath()}); throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"path",pathMenu.getPath()});
// throw new BadRequestException("路径["+pathMenu+"]已存在"); // throw new BadRequestException("路径["+pathMenu+"]已存在");
} }
......
package com.neotel.smfcore.security.service.manager.impl; package com.neotel.smfcore.security.service.manager.impl;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
...@@ -81,7 +80,7 @@ public class RoleManagerImpl implements IRoleManager { ...@@ -81,7 +80,7 @@ public class RoleManagerImpl implements IRoleManager {
@Override @Override
public Role saveRole(Role role) throws ValidateException { public Role saveRole(Role role) throws ValidateException {
if(role.getName()==null){ if(role.getName()==null){
throw new BadRequestException("smfcode.valueCanotNull","{0}不能为空",new String[]{"name"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"name"} );
// throw new BadRequestException("角色名称不能为空"); // throw new BadRequestException("角色名称不能为空");
} }
if (role.getMenus() == null) { if (role.getMenus() == null) {
...@@ -101,7 +100,9 @@ public class RoleManagerImpl implements IRoleManager { ...@@ -101,7 +100,9 @@ public class RoleManagerImpl implements IRoleManager {
List<Role> roles = findByQuery(query); List<Role> roles = findByQuery(query);
if (roles != null && roles.size() > 0) { if (roles != null && roles.size() > 0) {
log.error(logName+"[" + role.toString() + "]出错:角色名[" + role.getName() + "]已存在"); log.error(logName+"[" + role.toString() + "]出错:角色名[" + role.getName() + "]已存在");
throw new ValidateException(logName+"角色名[" + role.getName() + "]已存在"); // throw new ValidateException(logName+"角色名[" + role.getName() + "]已存在");
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"name",role.getName()});
} }
return roleDao.save(role); return roleDao.save(role);
} }
...@@ -110,12 +111,12 @@ public class RoleManagerImpl implements IRoleManager { ...@@ -110,12 +111,12 @@ public class RoleManagerImpl implements IRoleManager {
Role role=this.get(resources.getId()); Role role=this.get(resources.getId());
if(role==null){ if(role==null){
throw new BadRequestException("smfcode.notSelRole","请要修改的选择角色"); throw new ValidateException("smfcode.notSelRole","请要修改的选择角色");
// throw new BadRequestException("请要修改的选择角色"); // throw new BadRequestException("请要修改的选择角色");
} }
if(role.getName().equals("admin")){ if(role.getName().equals("admin")){
if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){ if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){
throw new BadRequestException("smfcode.noaccess","无权限修改此角色的菜单"); throw new ValidateException("smfcode.noaccess","无权限修改此角色的菜单");
// throw new BadRequestException("只有超级管理员才能修改此角色的菜单"); // throw new BadRequestException("只有超级管理员才能修改此角色的菜单");
} }
} }
......
...@@ -2,7 +2,6 @@ package com.neotel.smfcore.security.service.manager.impl; ...@@ -2,7 +2,6 @@ package com.neotel.smfcore.security.service.manager.impl;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.BadRequestException;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
...@@ -25,6 +24,7 @@ import org.springframework.data.mongodb.core.query.Criteria; ...@@ -25,6 +24,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update; import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
...@@ -57,8 +57,20 @@ public class UserManagerImpl implements IUserManager { ...@@ -57,8 +57,20 @@ public class UserManagerImpl implements IUserManager {
userDao.updateFirst(query,update); userDao.updateFirst(query,update);
} }
@Override @Override
public void userNameIsExist(String username, String id){
Query query=new Query(Criteria.where("username").is(username));
if(!ObjectUtils.isEmpty(id)){
query.addCriteria(Criteria.where("id").ne(id));
}
List<User> users=userDao.findByQuery(query);
if(users!=null&&users.size()>0){
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"userName",username});
}
}
@Override
public void update(User user) { public void update(User user) {
User dataUser=this.get(user.getId()); User dataUser=this.get(user.getId());
userNameIsExist(user.getUsername(),user.getId());
if(dataUser!=null){ if(dataUser!=null){
// 如果用户被禁用,则清除用户登录信息 // 如果用户被禁用,则清除用户登录信息
if(user.getEnabled()==null){ if(user.getEnabled()==null){
...@@ -74,7 +86,11 @@ public class UserManagerImpl implements IUserManager { ...@@ -74,7 +86,11 @@ public class UserManagerImpl implements IUserManager {
user.setCheckCode(""); user.setCheckCode("");
} }
//用户名admin不能修改 //用户名admin不能修改
if(!dataUser.equals(Constants.SUPER_USERNAME)){ if(dataUser.getUsername().equals(Constants.SUPER_USERNAME)) {
if(!user.getUsername().equals(dataUser.getUsername())){
throw new ValidateException("smfcore.conotUpdate","用户名admin不能修改");
}
}else{
dataUser.setUsername(user.getUsername()); dataUser.setUsername(user.getUsername());
} }
dataUser.setEmail(user.getEmail()); dataUser.setEmail(user.getEmail());
...@@ -202,7 +218,7 @@ public class UserManagerImpl implements IUserManager { ...@@ -202,7 +218,7 @@ public class UserManagerImpl implements IUserManager {
public String GetUserCheckCode(User user){ public String GetUserCheckCode(User user){
if(user.getId()==null||user.getCreateDate()==null){ if(user.getId()==null||user.getCreateDate()==null){
throw new BadRequestException("smfcode.userInfoError","用户信息不完整"); throw new ValidateException("smfcode.userInfoError","用户信息不完整");
// throw new BadRequestException("用户信息不完整"); // throw new BadRequestException("用户信息不完整");
} }
......
...@@ -23,6 +23,8 @@ spring: ...@@ -23,6 +23,8 @@ spring:
host: localhost # 主机地址 host: localhost # 主机地址
port: 27017 # 端口 port: 27017 # 端口
database: smf # 数据库 database: smf # 数据库
messages:
encoding: utf-8
task: task:
...@@ -48,3 +50,4 @@ code: ...@@ -48,3 +50,4 @@ code:
#密码加密传输,前端公钥加密,后端私钥解密 #密码加密传输,前端公钥加密,后端私钥解密
rsa: rsa:
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
smfcode.valueCanotNull={0}\u4E0D\u80FD\u4E3A\u7A7A
smfcode.feleFormatError=\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF\uFF01, \u4EC5\u652F\u6301{0}\u683C\u5F0F
smfcode.valueAlreadyExist={0}[{1}]\u5DF2\u5B58\u5728
smfcode.valueNotExist={0}[{1}]\u4E0D\u5B58\u5728
smfcode.fileToLong=\u6587\u4EF6\u8D85\u51FA\u89C4\u5B9A\u5927\u5C0F
smfcode.fileError=\u6587\u4EF6\u89E3\u6790\u5931\u8D25
smfcode.valueNotFind=\u672A\u627E\u5230{0}[{1}]
smfcode.humidityValueError=\u6E29\u5EA6\u8303\u56F4\u6570\u636E\u9519\u8BEF
smfcode.humidityShowValueError=\u6E29\u5EA6\u663E\u793A\u8303\u56F4\u6570\u636E\u9519\u8BEF
smfcode.temperatureValueError=\u6E7F\u5EA6\u8303\u56F4\u6570\u636E\u9519\u8BEF
smfcode.temperatureShowValueError=\u6E7F\u5EA6\u663E\u793A\u8303\u56F4\u6570\u636E\u9519\u8BEF
smfcode.notActivated=\u8D26\u53F7\u672A\u6FC0\u6D3B
smfcode.userInfoError=\u7528\u6237\u4FE1\u606F\u4E0D\u5B8C\u6574
smfcode.noaccess=\u65E0\u6743\u9650\u4FEE\u6539\u6B64\u89D2\u8272\u7684\u83DC\u5355
smfcode.notSelRole=\u8BF7\u8981\u4FEE\u6539\u7684\u9009\u62E9\u89D2\u8272
smfcode.posIsused=\u6599\u4ED3[{0}]\u7684\u5E93\u4F4D[{1}}]\u6709\u6599[{2}],\u5220\u9664\u5931\u8D25
smfcode.thePosIsused= \u5E93\u4F4D[{0}]\u6709\u6599[{1}],\u4E0D\u80FD\u5220\u9664
smfcode.groupWithStorage=\u7EC4[{0}]\u5DF2\u548C\u8BBE\u5907\u5173\u8054
smfcode.groupWithUser=\u7EC4[{0}]\u5DF2\u548C\u7528\u6237\u5173\u8054
smfcode.canotDelSelf=\u5220\u9664\u7528\u6237\uFF1A\u4E0D\u80FD\u5220\u9664\u81EA\u5DF1
smfcode.canotDelUser=\u5220\u9664\u7528\u6237\uFF1A\u6B64\u7528\u6237\u4E0D\u80FD\u5220\u9664
smfcode.oldPwdError=\u4FEE\u6539\u5931\u8D25\uFF0C\u65E7\u5BC6\u7801\u9519\u8BEF
smfcode.newPwdError=\u65B0\u5BC6\u7801\u4E0D\u80FD\u4E0E\u65E7\u5BC6\u7801\u76F8\u540C
smfcode.pwdError=\u4FEE\u6539\u90AE\u7BB1\u5931\u8D25\uFF0C\u5BC6\u7801\u9519\u8BEF
smfcode.hasNoAccess=\u65E0\u6743\u9650\u4FEE\u6539\u6B64\u7528\u6237\u4FE1\u606F
smfcode.noAccessUpdate=\u6CA1\u6709\u5220\u9664\u83DC\u5355\u7684\u6743\u9650
smfcode.roleCannotDel=\u89D2\u8272[{0}]\u6709[{1}]\u4E2A\u7528\u6237\u5173\u8054\u6539\u89D2\u8272,\u4E0D\u80FD\u5220\u9664
smfcore.notFindPos=\u672A\u627E\u5230\u9501\u5B9A\u5E93\u4F4D
smfcore.error.barcode.empty=\u672A\u626B\u5230\u6761\u7801
smfcore.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u6761\u7801,\u65E0\u6CD5\u5165\u5E93
smfcore.error.barcode.expired=\u7269\u6599\u5DF2\u8FC7\u671F,\u65E0\u6CD5\u5165\u5E93.
smfcore.allBoxView.noReel=\u5E93\u4F4D\u4E2D\u65E0\u7269\u6599
smfcode.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u7684\u6761\u7801
smfcode.error.barcode.noValidCode=\u65E0\u6548\u7684\u6761\u7801
smfcore.error.barcode.noValidCode={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801
smfcode.error.barcode.executing=\u6761\u7801[{0}}]\u4EFB\u52A1\u6B63\u5728\u6267\u884C
smfcode.error.pos.notExist=\u5E93\u4F4D[{0}]\u4E0D\u5B58\u5728,\u65E0\u6CD5\u5165\u5E93
smfcode.error.pos.wrong=\u5E93\u4F4D[{0}]\u4E0E\u6599\u4ED3[{1}}]\u4E0D\u5339\u914D,\u65E0\u6CD5\u5165\u5E93
smfcode.error.pos.hasReel=\u5E93\u4F4D[{0}]\u4E2D\u5DF2\u6709\u7269\u6599,\u65E0\u6CD5\u5165\u5E93
smfcode.error.pos.sizeNotMatch=\u6599\u76D8\u5C3A\u5BF8[{0}}]\u4E0E\u5E93\u4F4D{1}\u5C3A\u5BF8[{2}]\u4E0D\u7B26,\u65E0\u6CD5\u5165\u5E93
smfcode.error.storage.offline=\u6599\u4ED3[{0}]\u79BB\u7EBF
smfcode.error.barcode.invalid=\u6761\u7801\u65E0\u6548
smfcode.error.barcode.wrongSize=\u5C3A\u5BF8[{0}]\u4E0D\u7B26
smfcode.error.barcode.wrongQty=\u6761\u7801[{0}]\u5BF9\u5E94\u7684\u6570\u91CF<=0\u4E3A: {1}
smfcode.error.barcode.taskNotEnd=\u6599\u76D8[{0}]\u7684\u64CD\u4F5C\u672A\u5B8C\u6210,\u65E0\u6CD5\u6267\u884C\u5165\u5E93\u64CD\u4F5C
smfcode.error.columnNotExist=\u5FC5\u987B\u5305\u542B[{0}\u5217
smfcore.storage.error.notExist=\u672A\u627E\u5230\u6599\u4ED3{0}
smfcode.error.barcode.inQueue=\u4E8C\u7EF4\u7801[{0}]\u5DF2\u5728\u64CD\u4F5C\u961F\u5217\u4E2D\uFF0C\u64CD\u4F5C\u5931\u8D25
smfcode.error.pos.inQueue=\u4F4D\u7F6E:[{0}}]\u5DF2\u5728\u64CD\u4F5C\u961F\u5217\u4E2D,\u64CD\u4F5C\u5931\u8D25
smfcode.columnNotExist=\u5FC5\u987B\u5305\u542B[{0}\u5217
smfcore.conotUpdate=\u7528\u6237\u540Dadmin\u4E0D\u80FD\u4FEE\u6539
smfcode.valueCanotNull={0}\u4E0D\u80FD\u4E3A\u7A7A
smfcode.feleFormatError=\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF\uFF01, \u4EC5\u652F\u6301{0}\u683C\u5F0F
smfcode.valueAlreadyExist={0}[{1}]\u5DF2\u5B58\u5728
smfcode.valueNotExist={0}[{1}]\u4E0D\u5B58\u5728
smfcode.fileToLong=\u6587\u4EF6\u8D85\u51FA\u89C4\u5B9A\u5927\u5C0F
smfcode.fileError=\u6587\u4EF6\u89E3\u6790\u5931\u8D25
smfcode.valueNotFind=\u672A\u627E\u5230{0}[{1}]
smfcode.humidityValueError=\u6E29\u5EA6\u8303\u56F4\u6570\u636E\u9519\u8BEF
smfcode.humidityShowValueError=\u6E29\u5EA6\u663E\u793A\u8303\u56F4\u6570\u636E\u9519\u8BEF
smfcode.temperatureValueError=\u6E7F\u5EA6\u8303\u56F4\u6570\u636E\u9519\u8BEF
smfcode.temperatureShowValueError=\u6E7F\u5EA6\u663E\u793A\u8303\u56F4\u6570\u636E\u9519\u8BEF
smfcode.notActivated=\u8D26\u53F7\u672A\u6FC0\u6D3B
smfcode.userInfoError=\u7528\u6237\u4FE1\u606F\u4E0D\u5B8C\u6574
smfcode.noaccess=\u65E0\u6743\u9650\u4FEE\u6539\u6B64\u89D2\u8272\u7684\u83DC\u5355
smfcode.notSelRole=\u8BF7\u8981\u4FEE\u6539\u7684\u9009\u62E9\u89D2\u8272
smfcode.posIsused=\u6599\u4ED3[{0}]\u7684\u5E93\u4F4D[{1}}]\u6709\u6599[{2}],\u5220\u9664\u5931\u8D25
smfcode.thePosIsused= \u5E93\u4F4D[{0}]\u6709\u6599[{1}],\u4E0D\u80FD\u5220\u9664
smfcode.groupWithStorage=\u7EC4[{0}]\u5DF2\u548C\u8BBE\u5907\u5173\u8054
smfcode.groupWithUser=\u7EC4[{0}]\u5DF2\u548C\u7528\u6237\u5173\u8054
smfcode.canotDelSelf=\u5220\u9664\u7528\u6237\uFF1A\u4E0D\u80FD\u5220\u9664\u81EA\u5DF1
smfcode.canotDelUser=\u5220\u9664\u7528\u6237\uFF1A\u6B64\u7528\u6237\u4E0D\u80FD\u5220\u9664
smfcode.oldPwdError=\u4FEE\u6539\u5931\u8D25\uFF0C\u65E7\u5BC6\u7801\u9519\u8BEF
smfcode.newPwdError=\u65B0\u5BC6\u7801\u4E0D\u80FD\u4E0E\u65E7\u5BC6\u7801\u76F8\u540C
smfcode.pwdError=\u4FEE\u6539\u90AE\u7BB1\u5931\u8D25\uFF0C\u5BC6\u7801\u9519\u8BEF
smfcode.hasNoAccess=\u65E0\u6743\u9650\u4FEE\u6539\u6B64\u7528\u6237\u4FE1\u606F
smfcode.noAccessUpdate=\u6CA1\u6709\u5220\u9664\u83DC\u5355\u7684\u6743\u9650
smfcode.roleCannotDel=\u89D2\u8272[{0}]\u6709[{1}]\u4E2A\u7528\u6237\u5173\u8054\u6539\u89D2\u8272,\u4E0D\u80FD\u5220\u9664
smfcore.notFindPos=\u672A\u627E\u5230\u9501\u5B9A\u5E93\u4F4D
smfcore.error.barcode.empty=\u672A\u626B\u5230\u6761\u7801
smfcore.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u6761\u7801,\u65E0\u6CD5\u5165\u5E93
smfcore.error.barcode.expired=\u7269\u6599\u5DF2\u8FC7\u671F,\u65E0\u6CD5\u5165\u5E93.
smfcore.allBoxView.noReel=\u5E93\u4F4D\u4E2D\u65E0\u7269\u6599
smfcode.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u7684\u6761\u7801
smfcode.error.barcode.noValidCode=\u65E0\u6548\u7684\u6761\u7801
smfcore.error.barcode.noValidCode={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801
smfcode.error.barcode.executing=\u6761\u7801[{0}}]\u4EFB\u52A1\u6B63\u5728\u6267\u884C
smfcode.error.pos.notExist=\u5E93\u4F4D[{0}]\u4E0D\u5B58\u5728,\u65E0\u6CD5\u5165\u5E93
smfcode.error.pos.wrong=\u5E93\u4F4D[{0}]\u4E0E\u6599\u4ED3[{1}}]\u4E0D\u5339\u914D,\u65E0\u6CD5\u5165\u5E93
smfcode.error.pos.hasReel=\u5E93\u4F4D[{0}]\u4E2D\u5DF2\u6709\u7269\u6599,\u65E0\u6CD5\u5165\u5E93
smfcode.error.pos.sizeNotMatch=\u6599\u76D8\u5C3A\u5BF8[{0}}]\u4E0E\u5E93\u4F4D{1}\u5C3A\u5BF8[{2}]\u4E0D\u7B26,\u65E0\u6CD5\u5165\u5E93
smfcode.error.storage.offline=\u6599\u4ED3[{0}]\u79BB\u7EBF
smfcode.error.barcode.invalid=\u6761\u7801\u65E0\u6548
smfcode.error.barcode.wrongSize=\u5C3A\u5BF8[{0}]\u4E0D\u7B26
smfcode.error.barcode.wrongQty=\u6761\u7801[{0}]\u5BF9\u5E94\u7684\u6570\u91CF<=0\u4E3A: {1}
smfcode.error.barcode.taskNotEnd=\u6599\u76D8[{0}]\u7684\u64CD\u4F5C\u672A\u5B8C\u6210,\u65E0\u6CD5\u6267\u884C\u5165\u5E93\u64CD\u4F5C
smfcode.error.columnNotExist=\u5FC5\u987B\u5305\u542B[{0}\u5217
smfcore.storage.error.notExist=\u672A\u627E\u5230\u6599\u4ED3{0}
smfcode.error.barcode.inQueue=\u4E8C\u7EF4\u7801[{0}]\u5DF2\u5728\u64CD\u4F5C\u961F\u5217\u4E2D\uFF0C\u64CD\u4F5C\u5931\u8D25
smfcode.error.pos.inQueue=\u4F4D\u7F6E:[{0}}]\u5DF2\u5728\u64CD\u4F5C\u961F\u5217\u4E2D,\u64CD\u4F5C\u5931\u8D25
smfcode.columnNotExist=\u5FC5\u987B\u5305\u542B[{0}\u5217
smfcore.conotUpdate=\u7528\u6237\u540Dadmin\u4E0D\u80FD\u4FEE\u6539
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!