1. fix
This commit is contained in:
2026-05-01 17:20:07 +08:00
parent 477f50c73d
commit 45cbb2f063
11 changed files with 13 additions and 44 deletions

View File

@@ -71,7 +71,7 @@ public class MarketMerchantController {
@ApiOperationSupport(order = 5)
@Operation(summary = "提交商品")
public R addProduct(@RequestBody @Valid SubmitMerchantProductRequest request) {
return R.status(merchantProductService.submitMerchantCatalog(AuthUtil.getUserId(), request.getId(), request.getProductName(), request.getThumbImageUrl(), request.getMainImageUrls(), request.getDetailImageUrls(), request.getSpecs()));
return R.status(merchantProductService.submitMerchantCatalog(AuthUtil.getUserId(), request.getId(), request.getProductName(), request.getThumbImageUrl(), request.getMainImageUrls(), request.getDetailImageUrls()));
}
@GetMapping("/inventory-list")

View File

@@ -25,7 +25,4 @@ public class SubmitMerchantProductRequest implements Serializable {
@NotEmpty(message = "无效参数")
private String thumbImageUrl;
private List<MerchantCatalogEntity.Spec> specs;
}

View File

@@ -24,8 +24,6 @@ public class MerchantProductDetailApiVO implements Serializable {
private List<String> detailImageUrls;
private List<Spec> specs;
private BigDecimal price;
private BigDecimal amount;
@@ -34,12 +32,4 @@ public class MerchantProductDetailApiVO implements Serializable {
private List<Integer> payoutAccountTypes;
@Data
public static class Spec implements Serializable {
private String attr;
private String value;
}
}

View File

@@ -137,7 +137,7 @@ public class MallProductEntity extends BaseEntity {
/**
* 标签列表,JSONB数组格式,如 ["热销","包邮"]
*/
@TableField(typeHandler = PgJsonbTypeHandler.class)
@TableField(typeHandler = PgStringArrayToListTypeHandler.class)
@Schema(description = "标签")
private List<String> tags = new ArrayList<>();

View File

@@ -25,9 +25,5 @@ public interface MarketMerchantConvert {
List<MerchantPayoutAccountApiVO> convertMerchantPayoutAccountEntityToApiVOList(List<MerchantPayoutAccountEntity> merchantPayoutAccountEntityList);
MerchantProductDetailApiVO.Spec convertMerchantCatalogEntitySpecToMerchantProductDetailApiVOSpec(MerchantCatalogEntity.Spec spec);
List<MerchantProductDetailApiVO.Spec> convertMerchantCatalogEntitySpecListToMerchantProductDetailApiVOSpecList(List<MerchantCatalogEntity.Spec> specList);
MerchantOrderDetailApiVO convertMerchantOrderEntityToApiVO(MerchantOrderEntity merchantOrderEntity);
}

View File

@@ -12,7 +12,6 @@
<result column="main_image_urls" property="mainImageUrls" typeHandler="org.springblade.common.handler.PgStringArrayToListTypeHandler"/>
<result column="detail_image_urls" property="detailImageUrls" typeHandler="org.springblade.common.handler.PgStringArrayToListTypeHandler"/>
<result column="thumb_image_url" property="thumbImageUrl"/>
<result column="specs" property="specs" typeHandler="org.springblade.common.handler.PgJsonbTypeHandler"/>
<result column="cost_price" property="costPrice"/>
<result column="remark" property="remark"/>
<result column="create_user" property="createUser"/>

View File

@@ -92,13 +92,6 @@ public class MerchantCatalogEntity extends BaseEntity {
*/
@Schema(description = "商品缩略图")
private String thumbImageUrl;
/**
* 商品型号
*/
@TableField(typeHandler = PgJsonbTypeHandler.class)
@JsonDeserialize(contentAs = Spec.class)
@Schema(description = "商品型号")
private List<Spec> specs;
/**
* 成本价(进货价, 单位为现金券)
*/
@@ -111,12 +104,4 @@ public class MerchantCatalogEntity extends BaseEntity {
private String remark;
@Data
public static class Spec implements Serializable {
private String attr;
private String value;
}
}

View File

@@ -53,6 +53,6 @@ public interface IMerchantCatalogService extends BaseService<MerchantCatalogEnti
List<MarketMerchantCatalogApiVO> catalogListByUserId(Long userId);
boolean submitMerchantCatalog(Long userId, Long productId, String productName, String thumbImageUrl, List<String> mainImageUrls, List<String> detailImageUrls, List<MerchantCatalogEntity.Spec> specs);
boolean submitMerchantCatalog(Long userId, Long productId, String productName, String thumbImageUrl, List<String> mainImageUrls, List<String> detailImageUrls);
}

View File

@@ -104,7 +104,7 @@ public class MerchantCatalogServiceImpl extends BaseServiceImpl<MerchantCatalogM
@Override
@RateLimiter(value = "merchant:product", param = "#userId", max = 1, ttl = 10, timeUnit = TimeUnit.SECONDS)
public boolean submitMerchantCatalog(Long userId, Long productId, String productName, String thumbImageUrl, List<String> mainImageUrls, List<String> detailImageUrls, List<MerchantCatalogEntity.Spec> specs) {
public boolean submitMerchantCatalog(Long userId, Long productId, String productName, String thumbImageUrl, List<String> mainImageUrls, List<String> detailImageUrls) {
if (Objects.isNull(userId)) {
throw new ServiceException("无效用户");
}
@@ -140,7 +140,6 @@ public class MerchantCatalogServiceImpl extends BaseServiceImpl<MerchantCatalogM
entity.setThumbImageUrl(thumbImageUrl);
entity.setMainImageUrls(mainImageUrls);
entity.setDetailImageUrls(detailImageUrls);
entity.setSpecs(specs);
if (productId != null) {
MerchantCatalogEntity p = getById(productId);
if (p != null) {

View File

@@ -53,6 +53,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@@ -354,17 +355,19 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
throw new ServiceException("无效商品");
}
List<MerchantPayoutAccountApiVO> payoutAccountApiVOList = payoutAccountService.accountListByUserId(inventory.getUserId());
if (payoutAccountApiVOList.isEmpty()) {
throw new ServiceException("商家还未提供收款信息,请稍后再试");
}
MerchantProductDetailApiVO vo = new MerchantProductDetailApiVO();
vo.setId(inventory.getId());
vo.setName(inventory.getProductName());
vo.setShop(inventory.getStoreName());
vo.setMainImageUrls(catalog.getMainImageUrls());
vo.setDetailImageUrls(catalog.getDetailImageUrls());
vo.setSpecs(MarketMerchantConvert.INSTANCE.convertMerchantCatalogEntitySpecListToMerchantProductDetailApiVOSpecList(catalog.getSpecs()));
vo.setPrice(inventory.getUnitPrice());
vo.setAmount(inventory.getUnitGiftAmount());
vo.setType(inventory.getGiftType());
vo.setPayoutAccountTypes(payoutAccountApiVOList.stream().map(MerchantPayoutAccountApiVO::getAccountType).filter(Objects::nonNull).toList());
vo.setPayoutAccountTypes(payoutAccountApiVOList.stream().map(MerchantPayoutAccountApiVO::getAccountType).filter(Objects::nonNull).distinct().toList());
return vo;
}