fix(product-model): 修正运输尺寸正则校验及新增类型字段支持
- 调整运输尺寸正则表达式,支持空字符串格式 - 在ProductModelMainParamsItemChildrenVO中添加type字段以区分配置类型 - AdminShoppingController中优化购物订单调整项查询,过滤有效状态商品模型 - 修复ProductModelController中代码格式及空格异常 - 优化导入逻辑中集合初始化和空列表返回处理
This commit is contained in:
parent
c51f9c3aa8
commit
d6dd295559
|
|
@ -316,6 +316,7 @@ public class ProductModelController extends ControllerBase {
|
|||
items.add(new ProductModelMainParamsItemChildrenVO()
|
||||
.setIndexName(indexName)
|
||||
.setBatchNumber(String.valueOf(parent.getId()))
|
||||
.setType(parent.getType())
|
||||
.setItems(childItems));
|
||||
}
|
||||
vo.setItems(items);
|
||||
|
|
@ -343,7 +344,7 @@ public class ProductModelController extends ControllerBase {
|
|||
public ApiResult<Integer> addParamsIndexName(@Valid @RequestBody ProductModelParamsNameAddRequest request) {
|
||||
if (Objects.isNull(request.getModelParamsId())) {
|
||||
request.setModelParamsId(productModelParamsService.add(request.getModelId(), IdUtil.getSnowflakeNextIdStr()));
|
||||
}else {
|
||||
} else {
|
||||
VUtils.trueThrowBusinessError(
|
||||
productModelParamsDataService.lambdaQuery()
|
||||
.eq(ProductModelParamsData::getParamsId, request.getModelParamsId())
|
||||
|
|
@ -375,7 +376,7 @@ public class ProductModelController extends ControllerBase {
|
|||
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
||||
VUtils.trueThrowBusinessError(
|
||||
StrUtil.equals(request.getLanguageCode(), Constant.DEFAULT_LANGUAGE_CODE)
|
||||
&& productModelParamsDataService.lambdaQuery()
|
||||
&& productModelParamsDataService.lambdaQuery()
|
||||
.eq(ProductModelParamsData::getParamsId, request.getModelParamsId())
|
||||
.eq(ProductModelParamsData::getParentId, 0)
|
||||
.eq(ProductModelParamsData::getName, request.getIndexName())
|
||||
|
|
@ -1145,7 +1146,7 @@ public class ProductModelController extends ControllerBase {
|
|||
, @Valid @RequestParam(value = "file") @NotNull MultipartFile file) {
|
||||
ProductModel model = productModelService.getById(modelId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(model)).throwMessage("无效的" + modelId);
|
||||
List<String> repeats=new ArrayList<>();
|
||||
List<String> repeats = new ArrayList<>();
|
||||
try (InputStream inputStream = file.getInputStream(); org.apache.poi.ss.usermodel.Workbook workbook = new XSSFWorkbook(inputStream)) {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
String no = StrUtil.trim(sheet.getRow(1).getCell(1).getStringCellValue());
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class ProductModelParamsItemAddRequest implements Serializable {
|
|||
/**
|
||||
* 运输尺寸
|
||||
*/
|
||||
@Pattern(regexp = "^.+ \\d+×\\d+×\\d+mm$", message = "运输尺寸格式不正确")
|
||||
@Pattern(regexp = "^$|^.+ \\d+×\\d+×\\d+mm$", message = "运输尺寸格式不正确")
|
||||
private String shippingDimensions;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class ProductModelParamsItemUpdateRequest1 {
|
|||
/**
|
||||
* 运输尺寸
|
||||
*/
|
||||
@Pattern(regexp = "^.+ \\d+×\\d+×\\d+mm$", message = "运输尺寸格式不正确")
|
||||
@Pattern(regexp = "^$|^.+ \\d+×\\d+×\\d+mm$", message = "运输尺寸格式不正确")
|
||||
private String shippingDimensions;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -53,12 +53,11 @@ public class ProductModelParamsNameAddRequest {
|
|||
* 运输尺寸
|
||||
*/
|
||||
@NotBlank(message = "运输尺寸不能为空")
|
||||
@Pattern(regexp = "^.+ \\d+×\\d+×\\d+mm$", message = "运输尺寸格式不正确")
|
||||
@Pattern(regexp = "^$|^.+ \\d+×\\d+×\\d+mm$", message = "运输尺寸格式不正确")
|
||||
private String shippingDimensions;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@NotNull(message = "重量不能为空")
|
||||
private BigDecimal weight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,5 +19,10 @@ public class ProductModelMainParamsItemChildrenVO {
|
|||
*/
|
||||
private String batchNumber;
|
||||
|
||||
/**
|
||||
* 类别,0:可选配置;1:标准配置
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
private List<ProductParamsItemVO> items;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import javax.validation.Valid;
|
|||
import java.awt.*;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
|
@ -91,8 +92,14 @@ public class AdminShoppingController extends ControllerBase {
|
|||
List<QuotationShoppingOrderAdjustItem> adjustItems = shoppingOrderAdjustItemService.lambdaQuery()
|
||||
.eq(QuotationShoppingOrderAdjustItem::getOrderId, orderId)
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(adjustItems)) {
|
||||
return ApiResult.success(Collections.emptyList());
|
||||
}
|
||||
List<QuotationShoppingCart> carts = shoppingCartService.listByIds(adjustItems.stream().map(QuotationShoppingOrderAdjustItem::getCartId).collect(Collectors.toSet()));
|
||||
List<ProductModel> models = productModelService.listByIds(carts.stream().map(QuotationShoppingCart::getModelId).collect(Collectors.toSet()));
|
||||
List<ProductModel> models = productModelService.lambdaQuery()
|
||||
.in(ProductModel::getBatchNumber, carts.stream().map(QuotationShoppingCart::getModelId).collect(Collectors.toSet()))
|
||||
.eq(ProductModel::getState, 1)
|
||||
.list();
|
||||
Map<Long, List<QuotationShoppingOrderAdjustItem>> adjustGroup = adjustItems.stream()
|
||||
.collect(Collectors.groupingBy(QuotationShoppingOrderAdjustItem::getAdjustId));
|
||||
List<QuotationModelConfigItem> items = modelConfigItemService.lambdaQuery()
|
||||
|
|
|
|||
Loading…
Reference in New Issue