mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
数值长度限制提示
This commit is contained in:
+5
-4
@@ -11,7 +11,7 @@ import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||
import com.cf.imes.module.infra.api.logger.ApiErrorLogApi;
|
||||
import com.cf.imes.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
@@ -220,11 +220,12 @@ public class GlobalExceptionHandler {
|
||||
|
||||
Throwable rootCause = ex.getRootCause();
|
||||
// 无效格式异常处理。
|
||||
if (rootCause instanceof MismatchedInputException) {
|
||||
return CommonResult.error(BAD_REQUEST.getCode(), "参数格式异常无法解读,请按照对应格式上传");
|
||||
if (rootCause instanceof InvalidFormatException) { // MismatchedInputException
|
||||
InvalidFormatException e = (InvalidFormatException) rootCause;
|
||||
return CommonResult.error(BAD_REQUEST.getCode(), String.format("参数校验失败:'%s' 格式出错", e.getValue()));
|
||||
}
|
||||
// 文件格式错误处理
|
||||
if (rootCause instanceof IOException ) {
|
||||
if (rootCause instanceof IOException) {
|
||||
// 使用正则提取数值
|
||||
Pattern pattern = Pattern.compile("Numeric value \\((\\d+)\\) out of range");
|
||||
Matcher matcher = pattern.matcher(rootCause.getMessage());
|
||||
|
||||
+9
-31
@@ -808,43 +808,21 @@ public class OrderServiceImpl implements OrderService {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
for (GoodsDO goodsDO : goodsLists) {
|
||||
PlateGoodDO plateGoodDO = null; // plate
|
||||
List<PlateGoodDO> plateGoodDOS = null; // plate list
|
||||
if (goodsDO.getGoodsId() != null && !goodsDO.getGoodsId().isEmpty()) { // 有goodsId
|
||||
PlateGoodDO plateGoodDO = null;
|
||||
if (goodsDO.getGoodsId() != null && !goodsDO.getGoodsId().isEmpty()) { // 有goodsId,匹配goodsId
|
||||
plateGoodDO = getPlateGood(goodsDO.getGoodsId(), OrganContextHolder.getOrganId());
|
||||
} else { // 没有goodsId 其他信息匹配
|
||||
// plateGoodDOS = plateGoodMapper.selectGood(goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(),
|
||||
// goodsDO.getTexture(), goodsDO.getWidth(), goodsDO.getThickness(), goodsDO.getHeight(), goodsDO.getBrand(),
|
||||
// goodsDO.getSpec(), OrganContextHolder.getOrganId());
|
||||
|
||||
plateGoodDOS = plateGoodMapper.selectGood(goodsDO.getMaterial(), goodsDO.getColor(), goodsDO.getThickness(),
|
||||
goodsDO.getBrand(),goodsDO.getGoodsName(), OrganContextHolder.getOrganId());
|
||||
|
||||
}
|
||||
|
||||
if (plateGoodDOS != null && !plateGoodDOS.isEmpty()) {//存在板材
|
||||
goodsDO.setGoodsId(plateGoodDOS.get(0).getGoodsId());
|
||||
} else if (plateGoodDO != null) { // 存在板材
|
||||
// 直接匹配字段
|
||||
List<PlateGoodDO> plateGoodDOS = plateGoodMapper.selectGood(goodsDO.getMaterial(), goodsDO.getColor(), goodsDO.getThickness(),
|
||||
goodsDO.getBrand(),goodsDO.getGoodsName(), OrganContextHolder.getOrganId());
|
||||
|
||||
if (plateGoodDO != null) {//存在板材
|
||||
goodsDO.setGoodsId(plateGoodDO.getGoodsId());
|
||||
} else if (plateGoodDOS != null && !plateGoodDOS.isEmpty()) { // 存在板材
|
||||
goodsDO.setGoodsId(plateGoodDOS.get(0).getGoodsId());
|
||||
} else { // 不存在板材
|
||||
|
||||
throw exception(ORDER_MATCH_NOT);
|
||||
|
||||
// 添加板材库数据
|
||||
// long plateNo = idWorker.nextId();
|
||||
// long obtainingTime = idWorker.obtainingTime();
|
||||
//
|
||||
// String goodsId = goodsDO.getGoodsId() == null ? (obtainingTime) + Long.toString(plateNo).substring(2) : goodsDO.getGoodsId();
|
||||
// goodsDO.setGoodsId(goodsId);
|
||||
//
|
||||
//
|
||||
// Long plateGoods = (Long) identifierGenerator.nextId(null);
|
||||
//
|
||||
// plateGoodDO = BeanUtils.toBean(goodsDO, PlateGoodDO.class)
|
||||
// .setId(plateGoods)
|
||||
// .setGoodsId(goodsId);
|
||||
//
|
||||
// plateGoodLists.add(plateGoodDO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-4
@@ -6,10 +6,7 @@ import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 组织创建/修改 Request VO")
|
||||
@@ -56,6 +53,7 @@ public class OrganSaveReqVO {
|
||||
@NotNull(message = "账号数量不能为空")
|
||||
@NumberValid(name = "账号数量")
|
||||
@Min(value = 1 , message = "组织账号数量必须大于0")
|
||||
@Max(value = 1000 , message = "组织账号数量不能超过1000")
|
||||
private Integer accountCount;
|
||||
|
||||
// ========== 仅【创建】时,需要传递的字段 ==========
|
||||
|
||||
Reference in New Issue
Block a user