Commit c701c5ab by Lizh

对比老接口的返回结果,调整新接口返回结构

parent 05642cf7
......@@ -2,6 +2,7 @@ package com.jomalls.custom.app.aspect;
import com.jomalls.custom.app.annotation.RequiresPermissions;
import com.jomalls.custom.app.annotation.RequiresRoles;
import com.jomalls.custom.app.constant.Constants;
import com.jomalls.custom.enums.CodeEnum;
import com.jomalls.custom.app.exception.ServiceException;
import com.jomalls.custom.app.service.PermissionService;
......@@ -64,7 +65,7 @@ public class PermissionAspect {
boolean hasPermission;
if (mode == RequiresPermissions.RequireMode.ALL) {
String[] permissions = permission.split(",");
String[] permissions = permission.split(Constants.COMMA);
hasPermission = true;
for (String p : permissions) {
if (!permissionService.hasPermi(p.trim())) {
......@@ -103,7 +104,7 @@ public class PermissionAspect {
boolean hasRole;
if (mode == RequiresPermissions.RequireMode.ALL) {
// 必须拥有所有角色
String[] roleArray = roles.split(",");
String[] roleArray = roles.split(Constants.COMMA);
hasRole = true;
for (String r : roleArray) {
if (!permissionService.hasRole(r.trim())) {
......
......@@ -11,4 +11,13 @@ public class Constants {
* map初始化大小
*/
public static final int DEFAULT_INITIAL_CAPACITY = 1 << 4;
/** 并行查询超时时间(秒) */
public static final long QUERY_TIMEOUT_SECONDS = 30;
/** 默认编码 */
public static final String DEFAULT_CHARSET = "UTF-8";
/** 逗号 */
public static final String COMMA = ",";
}
package com.jomalls.custom.app.dto;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.jomalls.custom.app.constant.Constants;
import com.jomalls.custom.page.PageRequest;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
......@@ -147,9 +148,9 @@ public class CustomProductInfoQuerySnakeDTO extends PageRequest {
/** 兼容逗号分隔多值与单值 */
@JsonSetter("status")
public void setStatusValue(Object value) {
if (value instanceof String s && s.contains(",")) {
if (value instanceof String s && s.contains(Constants.COMMA)) {
try {
this.statusList = Arrays.stream(s.split(","))
this.statusList = Arrays.stream(s.split(Constants.COMMA))
.map(String::trim).filter(v -> !v.isEmpty())
.map(Integer::parseInt).collect(Collectors.toList());
} catch (NumberFormatException ignored) {
......
package com.jomalls.custom.app.service;
import com.jomalls.custom.app.vo.CustomProductFactoryPriceRelSnakeVO;
import com.jomalls.custom.app.vo.CustomProductInfoPageSnakeVO;
import com.jomalls.custom.app.vo.CustomProductInfoSnakeVO;
import com.jomalls.custom.app.vo.CustomProductItemSnakeVO;
import com.jomalls.custom.app.vo.*;
import com.jomalls.custom.dal.entity.DbDiyUserEntity;
import java.util.List;
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jomalls.custom.app.constant.Constants;
import com.jomalls.custom.app.dto.*;
import com.jomalls.custom.app.enums.ProcessingStatus;
import com.jomalls.custom.app.enums.SkuGenerateEnums;
......@@ -80,12 +81,8 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
private static final int IMAGE_TYPE_NORMAL = 0;
/** 图片类型:尺码图 */
private static final int IMAGE_TYPE_SIZE = 1;
/** 并行查询超时时间(秒) */
private static final long QUERY_TIMEOUT_SECONDS = 30;
/** 最小列表长度 */
private static final int MIN_LIST_SIZE = 1;
/** 负数 1 */
private static final int NEGATIVE_ONE = -1;
......@@ -99,7 +96,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
return page.convert(e -> {
CustomProductInfoPageSnakeVO snakeVO = BeanMapper.snakeCase().convert(e, CustomProductInfoPageSnakeVO.class);
if (StringUtils.isNotBlank(e.getColorImages())) {
snakeVO.setColorImageList(Arrays.asList(e.getColorImages().split(",")));
snakeVO.setColorImageList(Arrays.asList(e.getColorImages().split(Constants.COMMA)));
}
return snakeVO;
});
......@@ -129,7 +126,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
String pids = String.valueOf(cate.getId());
// 获取该类别的父类
if (StringUtils.isNotBlank(cate.getPids())) {
pids = cate.getPids() + "," + pids;
pids = cate.getPids() + Constants.COMMA + pids;
}
// 父类id,如: 0,19,26,33
String finalPids = pids;
......@@ -137,7 +134,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
List<Integer> cateIds = cateList.stream()
.filter(item -> {
String itemPids = item.getPids();
return finalPids.equals(itemPids) || (StringUtils.isNotEmpty(itemPids) && itemPids.startsWith(finalPids + ","));
return finalPids.equals(itemPids) || (StringUtils.isNotEmpty(itemPids) && itemPids.startsWith(finalPids + Constants.COMMA));
})
.map(CategoryInfoModel::getId).collect(Collectors.toList());
cateIds.add(cate.getId());
......@@ -180,7 +177,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
}
// sku 支持逗号分隔多值 IN 查询, erpPage查询条件
if (StringUtils.isNotBlank(param.getSku())) {
String[] skuArr = param.getSku().split(",");
String[] skuArr = param.getSku().split(Constants.COMMA);
if (skuArr.length > MIN_LIST_SIZE) {
queryWrapper.in(CustomProductInfoEntity::getSku, (Object[]) skuArr);
} else {
......@@ -202,7 +199,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
}
// 货号:逗号分隔多值 IN 查询,单个值模糊 LIKE 查询, erpPage查询条件
if (StringUtils.isNotBlank(param.getProduct_no())) {
String[] productNoArr = param.getProduct_no().split(",");
String[] productNoArr = param.getProduct_no().split(Constants.COMMA);
if (productNoArr.length > MIN_LIST_SIZE) {
queryWrapper.in(CustomProductInfoEntity::getProductNo, (Object[]) productNoArr);
} else {
......@@ -517,7 +514,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
factoryPriceFuture, diyUserIdsFuture, craftIdsFuture,
warehouseIdsFuture, remarkFuture, cnRemarkFuture,
factoryIdsFuture)
.orTimeout(QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.orTimeout(Constants.QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.join();
} catch (CompletionException e) {
cancelAll(itemsFuture, imagesFuture, propertiesFuture,
......@@ -573,7 +570,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
.convert(e, CustomProductInfoPropertySnakeVO.class)).collect(Collectors.toList()));
// 收集所有 property_id
String propIds = properties.stream().map(p -> String.valueOf(p.getPropertyId()))
.distinct().collect(Collectors.joining(","));
.distinct().collect(Collectors.joining(Constants.COMMA));
if (propIds.isEmpty()) {
return;
}
......@@ -620,7 +617,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
if (CollectionUtils.isEmpty(diyUsers) || diyUsers.size() != dto.getDiyUserIds().size()) {
throw new ServiceException("未查询到所选客户");
}
logStr = "绑定客户改:" + diyUsers.stream().map(DbDiyUserEntity::getName).collect(Collectors.joining(","));
logStr = "绑定客户改:" + diyUsers.stream().map(DbDiyUserEntity::getName).collect(Collectors.joining(Constants.COMMA));
} else {
logStr = "绑定客户改为空";
}
......@@ -665,7 +662,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
if (diyUsers == null || diyUsers.size() != dto.getDiyUserIds().size()) {
throw new ServiceException("未查询到所选客户");
}
logStr = "黑名单客户改:" + diyUsers.stream().map(DbDiyUserEntity::getName).collect(Collectors.joining(","));
logStr = "黑名单客户改:" + diyUsers.stream().map(DbDiyUserEntity::getName).collect(Collectors.joining(Constants.COMMA));
} else {
logStr = "黑名单客户改为空";
}
......@@ -865,7 +862,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
if (StringUtils.isNotBlank(param.getSku())) {
List<String> productSkus = new ArrayList<>();
List<String> diySkus = new ArrayList<>();
for (String s : param.getSku().split(",")) {
for (String s : param.getSku().split(Constants.COMMA)) {
String trimmed = s.trim();
if (trimmed.startsWith("JM")) {
productSkus.add(trimmed);
......@@ -873,9 +870,9 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
diySkus.add(trimmed);
}
}
param.setSku(productSkus.isEmpty() ? null : String.join(",", productSkus));
param.setSku(productSkus.isEmpty() ? null : String.join(Constants.COMMA, productSkus));
if (!diySkus.isEmpty() && StringUtils.isBlank(param.getDiySku())) {
param.setDiySku(String.join(",", diySkus));
param.setDiySku(String.join(Constants.COMMA, diySkus));
}
}
......@@ -978,10 +975,10 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
CompletableFuture<Map<Integer, List<FactoryPriceIntervalRelSnakeVO>>> intervalFuture =
CompletableFuture.supplyAsync(() -> batchLoadFactoryPriceIntervalsByProductIds(productIds), threadPoolExecutor);
try {
diyShelfStatusMap = shelfFuture.get(QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
craftMap = craftFuture.get(QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
warehouseMap = warehouseFuture.get(QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
intervalMap = intervalFuture.get(QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
diyShelfStatusMap = shelfFuture.get(Constants.QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
craftMap = craftFuture.get(Constants.QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
warehouseMap = warehouseFuture.get(Constants.QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
intervalMap = intervalFuture.get(Constants.QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
} catch (Exception ex) {
log.error("[ erpPage ] 并行查询关联数据失败", ex);
throw new ServiceException("查询关联数据失败");
......@@ -1004,7 +1001,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
// 应用用户折扣(复用 DiyUserService,统一处理 discount=null/1 的判断+主表+价格区间)
diyUserService.setProductExternalPrice(finalUser, vo);
if (StringUtils.isNotBlank(e.getColorImages())) {
vo.setColorImageList(Arrays.asList(e.getColorImages().split(",")));
vo.setColorImageList(Arrays.asList(e.getColorImages().split(Constants.COMMA)));
}
// 标记绑定的 DIY 模板是否已上架
vo.setDiyShelfStatus(diyShelfStatusMap.getOrDefault(e.getDiyId(), false));
......@@ -1814,7 +1811,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
// 子项(同步主表的 print_type 到每个子项)
fullVO.setProductList(items.stream()
.map(e -> {
CustomProductItemSnakeVO vo = BeanMapper.snakeCase().convert(e, CustomProductItemSnakeVO.class);
BasicCustomProductItemSnakeModel vo = BeanMapper.snakeCase().convert(e, BasicCustomProductItemSnakeModel.class);
// 同步主表 printType 到子项
vo.setPrint_type(entity.getPrintType());
return vo;
......@@ -1823,7 +1820,7 @@ public class CustomProductInfoServiceImpl implements CustomProductInfoService {
// 图片拆分:按类型分为普通图和尺码图
if (entity.getColorImages() != null) {
fullVO.setColorImageList(Arrays.asList(entity.getColorImages().split(",")));
fullVO.setColorImageList(Arrays.asList(entity.getColorImages().split(Constants.COMMA)));
}
fullVO.setImageList(images.stream()
.filter(img -> img.getType() == null || img.getType() == IMAGE_TYPE_NORMAL)
......
package com.jomalls.custom.app.service.impl;
import com.jomalls.custom.app.constant.Constants;
import com.jomalls.custom.app.dto.UpdateSalesPriceSnakeDTO;
import com.jomalls.custom.app.exception.ServiceException;
import com.jomalls.custom.app.service.CustomProductItemService;
import com.jomalls.custom.app.service.DiyUserService;
import com.jomalls.custom.app.utils.BeanMapper;
import com.jomalls.custom.app.vo.CustomProductFactoryPriceRelSnakeVO;
import com.jomalls.custom.app.vo.CustomProductInfoSnakeVO;
import com.jomalls.custom.app.vo.CustomProductItemSnakeVO;
import com.jomalls.custom.app.vo.*;
import com.jomalls.custom.dal.entity.*;
import com.jomalls.custom.domain.service.*;
import com.jomalls.custom.security.SecurityUtils;
......@@ -20,7 +19,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
......@@ -301,7 +299,7 @@ public class CustomProductItemServiceImpl implements CustomProductItemService {
diyUserService.setProductItemExternalPrice(user, vo, factoryPriceVOList, productInfoVO);
}
vo.setCustomProductInfo(productInfoVO);
vo.setCustomProductInfo(BeanMapper.mapper().convert(productInfoVO, BasicCustomProductInfoSnakeModel.class));
vo.setFactoryPriceList(factoryPriceVOList);
return vo;
}).collect(Collectors.toList());
......@@ -350,7 +348,7 @@ public class CustomProductItemServiceImpl implements CustomProductItemService {
private CustomProductInfoSnakeVO buildProductInfoVO(CustomProductInfoEntity entity) {
CustomProductInfoSnakeVO vo = BeanMapper.snakeCase().convert(entity, CustomProductInfoSnakeVO.class);
if (StringUtils.hasText(vo.getColor_images())) {
vo.setColorImageList(Arrays.asList(vo.getColor_images().split(",")));
vo.setColorImageList(Arrays.asList(vo.getColor_images().split(Constants.COMMA)));
}
vo.setProductList(null);
return vo;
......
package com.jomalls.custom.app.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jomalls.custom.app.exception.ServiceException;
import com.jomalls.custom.app.service.DiyUserService;
import com.jomalls.custom.app.utils.BeanMapper;
import com.jomalls.custom.app.vo.*;
import com.jomalls.custom.dal.entity.DbDiyEntity;
import com.jomalls.custom.dal.entity.DbDiyUserEntity;
import com.jomalls.custom.domain.service.DbDiyUserDomainService;
import lombok.RequiredArgsConstructor;
......@@ -17,7 +12,6 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.stream.Collectors;
/**
* DIY 用户服务实现
......@@ -75,7 +69,7 @@ public class DiyUserServiceImpl implements DiyUserService {
// 子项的 sales_price(对齐 TS:328-332)
if (vo.getProductList() != null) {
for (CustomProductItemSnakeVO item : vo.getProductList()) {
for (BasicCustomProductItemSnakeModel item : vo.getProductList()) {
if (item.getSales_price() != null) {
item.setSales_price(item.getSales_price().multiply(discountRate).setScale(2, RoundingMode.HALF_UP));
}
......
package com.jomalls.custom.app.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jomalls.custom.app.constant.Constants;
import com.jomalls.custom.app.exception.ServiceException;
import com.jomalls.custom.app.service.ProductTemplateInfoService;
import com.jomalls.custom.app.utils.BeanMapper;
......@@ -13,6 +14,7 @@ import com.jomalls.custom.integrate.model.PropertyValueModel;
import com.jomalls.custom.integrate.service.SaasAdminService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
......@@ -36,9 +38,6 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoService {
/** 并行查询超时时间(秒) */
private static final long QUERY_TIMEOUT_SECONDS = 30;
private final ProductTemplateInfoDomainService productTemplateInfoDomainService;
private final ProductTemplateItemDomainService productTemplateItemDomainService;
private final ProductTemplateRemarkDomainService productTemplateRemarkDomainService;
......@@ -49,7 +48,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
private final SaasAdminService saasAdminService;
private final ThreadPoolExecutor threadPoolExecutor;
// ==================== getByIdOrSku ====================
private static final String UNDER_LINE = "_";
@Override
public ProductTemplateInfoSnakeVO getByIdOrSku(Integer id, String sku) {
......@@ -76,7 +75,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
// 3. 等待所有并行查询完成
CompletableFuture.allOf(itemsFuture, remarkFuture, propertiesFuture, specsFuture)
.orTimeout(QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.orTimeout(Constants.QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.join();
List<ProductTemplateItemEntity> items = itemsFuture.join();
......@@ -85,7 +84,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
List<ProductTemplateItemSpecEntity> specs = specsFuture.join();
// 4. Items 按 sort 排序
if (items != null) {
if (CollectionUtils.isNotEmpty(items)) {
items.sort(Comparator.comparing(ProductTemplateItemEntity::getSort,
Comparator.nullsLast(Comparator.naturalOrder())));
}
......@@ -96,7 +95,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
// 6. 计算字段
// colorImageList: 由 color_images 逗号分割
if (StringUtils.isNotBlank(entity.getColorImages())) {
vo.setColorImageList(Arrays.asList(entity.getColorImages().split(",")));
vo.setColorImageList(Arrays.asList(entity.getColorImages().split(Constants.COMMA)));
} else {
vo.setColorImageList(Collections.emptyList());
}
......@@ -107,10 +106,10 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
}
// 7. 转换关联数据
if (items != null) {
if (CollectionUtils.isNotEmpty(items)) {
vo.setProductList(BeanMapper.snakeCase().convertList(items, ProductTemplateItemSnakeVO.class));
}
if (properties != null) {
if (CollectionUtils.isNotEmpty(properties)) {
vo.setProperties(BeanMapper.snakeCase().convertList(properties, ProductTemplateInfoPropertySnakeVO.class));
}
......@@ -118,15 +117,13 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
resolveProperties(properties, vo);
// 9. 规格去重(按 face_id + "_" + size)
if (specs != null && !specs.isEmpty()) {
if (CollectionUtils.isNotEmpty(specs)) {
vo.setSpecList(buildSpecList(specs));
}
return vo;
}
// ==================== bindDetail ====================
@Override
public BindDetailVO bindDetail(Integer id, String sku) {
// 1. 校验参数并查询主实体
......@@ -148,7 +145,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
.supplyAsync(() -> customProductItemDomainService.selectByProductId(productId), threadPoolExecutor);
CompletableFuture.allOf(templateItemsFuture, productInfoFuture, productItemsFuture)
.orTimeout(QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.orTimeout(Constants.QUERY_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.join();
List<ProductTemplateItemEntity> templateItems = templateItemsFuture.join();
......@@ -160,7 +157,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
// 5. 构建商品明细 Map(key = id)
Map<Integer, CustomProductItemEntity> productItemMap;
if (productItems != null && !productItems.isEmpty()) {
if (CollectionUtils.isNotEmpty(productItems)) {
productItemMap = productItems.stream()
.collect(Collectors.toMap(CustomProductItemEntity::getId, item -> item, (a, b) -> a));
} else {
......@@ -168,14 +165,14 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
}
// 6. 模板明细按 sort 排序
if (templateItems != null) {
if (CollectionUtils.isNotEmpty(templateItems)) {
templateItems.sort(Comparator.comparing(ProductTemplateItemEntity::getSort,
Comparator.nullsLast(Comparator.naturalOrder())));
}
// 7. 构建关联列表
List<ProductTemplateAssSnakeVO> assList = new ArrayList<>();
if (templateItems != null) {
if (CollectionUtils.isNotEmpty(templateItems)) {
for (ProductTemplateItemEntity templateItem : templateItems) {
ProductTemplateAssSnakeVO assVO = ProductTemplateAssSnakeVO.builder()
.template_item_id(templateItem.getId())
......@@ -206,8 +203,6 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
.build();
}
// ==================== 私有方法 ====================
/**
* 校验 id/sku 参数并查询主实体
*
......@@ -238,7 +233,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
* @param vo 目标 VO(结果写入 skuProperties / normalProperties)
*/
private void resolveProperties(List<ProductTemplateInfoPropertyEntity> properties, ProductTemplateInfoSnakeVO vo) {
if (properties == null || properties.isEmpty()) {
if (CollectionUtils.isNotEmpty(properties)) {
vo.setSkuProperties(Collections.emptyList());
vo.setNormalProperties(Collections.emptyList());
return;
......@@ -250,9 +245,9 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
.filter(Objects::nonNull)
.map(String::valueOf)
.distinct()
.collect(Collectors.joining(","));
.collect(Collectors.joining(Constants.COMMA));
if (propIds.isEmpty()) {
if (StringUtils.isBlank(propIds)) {
vo.setSkuProperties(Collections.emptyList());
vo.setNormalProperties(Collections.emptyList());
return;
......@@ -260,7 +255,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
// 调用 baseProperty API 获取属性详情(复用 SaasAdminService)
List<PropertyModel> allProperties = saasAdminService.getPropertyByIds(propIds);
if (allProperties == null || allProperties.isEmpty()) {
if (CollectionUtils.isNotEmpty(allProperties)) {
vo.setSkuProperties(Collections.emptyList());
vo.setNormalProperties(Collections.emptyList());
return;
......@@ -306,7 +301,7 @@ public class ProductTemplateInfoServiceImpl implements ProductTemplateInfoServic
private List<ProductTemplateItemSpecSnakeVO> buildSpecList(List<ProductTemplateItemSpecEntity> specs) {
Map<String, ProductTemplateItemSpecEntity> uniqueMap = new LinkedHashMap<>();
for (ProductTemplateItemSpecEntity spec : specs) {
String key = spec.getFaceId() + "_" + spec.getSize();
String key = spec.getFaceId() + UNDER_LINE + spec.getSize();
uniqueMap.putIfAbsent(key, spec);
}
return uniqueMap.values().stream()
......
......@@ -127,34 +127,6 @@ public class BasicCustomProductInfoSnakeModel {
@Schema(description = "默认模SKU")
private String diy_sku;
@Schema(description = "普通图片列表(type=0)")
private List<CustomProductImageSnakeVO> imageList;
@Schema(description = "商品描述")
private ProductRemarkSnakeVO productRemark;
@Schema(description = "商品中文描述")
private ProductRemarkSnakeVO productCnRemark;
@Schema(description = "工厂价格关联列表")
private List<CustomProductFactoryPriceRelSnakeVO> factoryPriceList;
@Schema(description = "尺码图片列表(type=1)")
private List<CustomProductImageSnakeVO> sizeList;
@Schema(description = "DIY 用户 ID 列表")
private List<Integer> diyUserIds;
@Schema(description = "工艺 ID 列表")
private List<String> craftIds;
@Schema(description = "工厂 ID 列表")
private List<Integer> factoryIds;
@Schema(description = "仓库 ID 列表")
private List<Integer> warehouseIds;
@Schema(description = "英文备注内容")
private String remark;
......
package com.jomalls.custom.app.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* Model
*
* @author Lizh
* @date 2026-06-03 11:57:04
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "VO")
public class BasicCustomProductItemSnakeModel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@Schema(description = "")
private Integer id;
/**
* 商品ID
*/
@Schema(description = "商品ID")
private Integer product_id;
/**
* sku
*/
@Schema(description = "sku")
private String sku;
/**
* sku商品名称
*/
@Schema(description = "sku商品名称")
private String sku_name;
/**
* 货号
*/
@Schema(description = "货号")
private String product_no;
/**
* 封面图
*/
@Schema(description = "封面图")
private String image;
/**
* 图片集
*/
@Schema(description = "图片集")
private String image_ary;
/**
* 属性分类ID1
*/
@Schema(description = "属性分类ID1")
private Integer property_cate_id1;
/**
* 属性分类ID2
*/
@Schema(description = "属性分类ID2")
private Integer property_cate_id2;
/**
* 属性分类ID3
*/
@Schema(description = "属性分类ID3")
private Integer property_cate_id3;
/**
*
*/
@Schema(description = "")
private Integer property1_id;
/**
*
*/
@Schema(description = "")
private Integer property2_id;
/**
*
*/
@Schema(description = "")
private Integer property3_id;
/**
* 属性编码1
*/
@Schema(description = "属性编码1")
private String property_code1;
/**
* 属性编码2
*/
@Schema(description = "属性编码2")
private String property_code2;
/**
*
*/
@Schema(description = "")
private String property_code3;
/**
* 属性名称1
*/
@Schema(description = "属性名称1")
private String option_enname1;
/**
* 属性名称2
*/
@Schema(description = "属性名称2")
private String option_enname2;
/**
*
*/
@Schema(description = "")
private String option_enname3;
/**
*
*/
@Schema(description = "")
private String custom_value1;
/**
*
*/
@Schema(description = "")
private String custom_value2;
/**
*
*/
@Schema(description = "")
private String custom_value3;
/**
* 工厂价
*/
@Schema(description = "工厂价")
private BigDecimal factory_price;
/**
* 销售价
*/
@Schema(description = "销售价")
private BigDecimal sales_price;
/**
* sku克重
*/
@Schema(description = "sku克重")
private BigDecimal sku_weight;
/**
* 印花类型 0满印 1局部印
*/
@Schema(description = "印花类型 0满印 1局部印")
private Integer print_type;
/**
* 1正常码 2大码
*/
@Schema(description = "1正常码 2大码")
private Integer size_type;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sort;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private Date create_time;
}
......@@ -67,5 +67,5 @@ public class CraftCenterSnakeVO implements Serializable {
private Date update_time;
@Schema(description = "工艺与商品的关联数据(对齐 TS CustomProductCraftRel)")
private CustomProductCraftRelSnakeVO customProductCraftRel;
private CustomProductCraftRelSnakeVO CustomProductCraftRel;
}
......@@ -23,8 +23,35 @@ import java.util.List;
@Schema(description = "商品完整详情")
public class CustomProductInfoSnakeVO extends BasicCustomProductInfoSnakeModel implements Serializable {
@Schema(description = "仓库 ID 列表")
private List<Integer> warehouseIds;
@Schema(description = "工艺 ID 列表")
private List<String> craftIds;
@Schema(description = "尺码图片列表(type=1)")
private List<CustomProductImageSnakeVO> sizeList;
@Schema(description = "商品描述")
private ProductRemarkSnakeVO productRemark;
@Schema(description = "商品中文描述")
private ProductRemarkSnakeVO productCnRemark;
@Schema(description = "普通图片列表(type=0)")
private List<CustomProductImageSnakeVO> imageList;
@Schema(description = "DIY 用户 ID 列表")
private List<Integer> diyUserIds;
@Schema(description = "工厂 ID 列表")
private List<Integer> factoryIds;
@Schema(description = "工厂价格关联列表")
private List<CustomProductFactoryPriceRelSnakeVO> factoryPriceList;
@Schema(description = "SKU 子项列表")
private List<CustomProductItemSnakeVO> productList;
private List<BasicCustomProductItemSnakeModel> productList;
@Schema(description = "普通属性列表")
private List<CustomProductInfoPropertySnakeVO> properties;
......
package com.jomalls.custom.app.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.*;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
......@@ -23,172 +16,8 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "VO")
public class CustomProductItemSnakeVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@Schema(description = "")
private Integer id;
/**
* 商品ID
*/
@Schema(description = "商品ID")
private Integer product_id;
/**
* sku
*/
@Schema(description = "sku")
private String sku;
/**
* sku商品名称
*/
@Schema(description = "sku商品名称")
private String sku_name;
/**
* 货号
*/
@Schema(description = "货号")
private String product_no;
/**
* 封面图
*/
@Schema(description = "封面图")
private String image;
/**
* 图片集
*/
@Schema(description = "图片集")
private String image_ary;
/**
* 属性分类ID1
*/
@Schema(description = "属性分类ID1")
private Integer property_cate_id1;
/**
* 属性分类ID2
*/
@Schema(description = "属性分类ID2")
private Integer property_cate_id2;
/**
* 属性分类ID3
*/
@Schema(description = "属性分类ID3")
private Integer property_cate_id3;
/**
*
*/
@Schema(description = "")
private Integer property1_id;
/**
*
*/
@Schema(description = "")
private Integer property2_id;
/**
*
*/
@Schema(description = "")
private Integer property3_id;
/**
* 属性编码1
*/
@Schema(description = "属性编码1")
private String property_code1;
/**
* 属性编码2
*/
@Schema(description = "属性编码2")
private String property_code2;
/**
*
*/
@Schema(description = "")
private String property_code3;
/**
* 属性名称1
*/
@Schema(description = "属性名称1")
private String option_enname1;
/**
* 属性名称2
*/
@Schema(description = "属性名称2")
private String option_enname2;
/**
*
*/
@Schema(description = "")
private String option_enname3;
/**
*
*/
@Schema(description = "")
private String custom_value1;
/**
*
*/
@Schema(description = "")
private String custom_value2;
/**
*
*/
@Schema(description = "")
private String custom_value3;
/**
* 工厂价
*/
@Schema(description = "工厂价")
private BigDecimal factory_price;
/**
* 销售价
*/
@Schema(description = "销售价")
private BigDecimal sales_price;
/**
* sku克重
*/
@Schema(description = "sku克重")
private BigDecimal sku_weight;
/**
* 印花类型 0满印 1局部印
*/
@Schema(description = "印花类型 0满印 1局部印")
private Integer print_type;
/**
* 1正常码 2大码
*/
@Schema(description = "1正常码 2大码")
private Integer size_type;
@EqualsAndHashCode(callSuper = true)
public class CustomProductItemSnakeVO extends BasicCustomProductItemSnakeModel {
/**
* 关联商品信息的工厂ID(仅 getBySkus 接口填充,非表字段)
*/
......@@ -202,22 +31,10 @@ public class CustomProductItemSnakeVO implements Serializable {
private String factory_code;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sort;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private Date create_time;
/**
* 关联商品信息(仅 getBySkus 接口填充,对齐 TS include CustomProductInfo)
*/
@Schema(description = "关联商品信息")
private CustomProductInfoSnakeVO customProductInfo;
private BasicCustomProductInfoSnakeModel customProductInfo;
/**
* 工厂价格列表(仅 getBySkus 接口填充,对齐 TS include CustomProductFactoryPriceRel)
......
......@@ -233,6 +233,6 @@ public class CustomWarehouseInfoSnakeVO implements Serializable {
private String company_name_cn;
@Schema(description = "仓库与商品的关联数据(对齐 TS CustomProductWarehouseRel)")
private CustomProductWarehouseRelSnakeVO customProductWarehouseRel;
private CustomProductWarehouseRelSnakeVO CustomProductWarehouseRel;
}
package com.jomalls.custom.webapp.controller;
import com.jomalls.custom.app.constant.Constants;
import com.jomalls.custom.app.dto.UpdateSalesPriceSnakeDTO;
import com.jomalls.custom.app.service.CustomProductItemService;
import com.jomalls.custom.app.vo.CustomProductItemSnakeVO;
......@@ -74,7 +75,7 @@ public class CustomProductItemController {
public List<CustomProductItemSnakeVO> getBySkus(
@Parameter(description = "SKU列表(逗号分隔)", required = true) @RequestParam("skus") String skus,
@Parameter(description = "用户namespace(可选)") @RequestParam(value = "namespace", required = false) String namespace) {
List<String> skuList = Arrays.asList(skus.split(","));
List<String> skuList = Arrays.asList(skus.split(Constants.COMMA));
return customProductItemService.getBySkus(skuList, namespace);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment