1
This commit is contained in:
@@ -38,8 +38,8 @@ public class ErpProduct extends BaseEntity
|
||||
@Excel(name = "商品库存")
|
||||
private Integer stock;
|
||||
|
||||
/** 商品状态 1:上架 2:下架 3:已售 */
|
||||
@Excel(name = "商品状态", readConverterExp = "1=上架,2=下架,3=已售")
|
||||
/** 商品状态 -1:删除 21:待发布 22:销售中 23:已售罄 31:手动下架 33:售出下架 36:自动下架 */
|
||||
@Excel(name = "商品状态", readConverterExp = "-1=删除,21=待发布,22=销售中,23=已售罄,31=手动下架,33=售出下架,36=自动下架")
|
||||
private Integer productStatus;
|
||||
|
||||
/** 销售状态 */
|
||||
|
||||
@@ -285,36 +285,24 @@ public class ErpProductServiceImpl implements IErpProductService
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换商品状态值:将前端的简化状态值转换为API需要的状态值
|
||||
* 前端:1(上架), 2(下架), 3(已售), 22(草稿), 23(审核中)
|
||||
* API:-1(全部), 10(上架), 21(下架), 22(草稿), 23(审核中), 31(已售), 33(已删除), 36(违规)
|
||||
* 如果前端传入的是API已有的状态值(如22、23),直接返回;否则进行映射转换
|
||||
* 转换商品状态值:将前端状态值转换为API需要的状态值
|
||||
* 实际状态值:-1(删除), 21(待发布), 22(销售中), 23(已售罄), 31(手动下架), 33(售出下架), 36(自动下架)
|
||||
* API支持的状态值:-1, 10, 21, 22, 23, 31, 33, 36
|
||||
* 前端传入的状态值直接使用,不做转换
|
||||
*/
|
||||
private Integer convertProductStatus(Integer frontendStatus) {
|
||||
if (frontendStatus == null) {
|
||||
return null;
|
||||
}
|
||||
// 如果是API标准状态值(22、23),直接返回
|
||||
if (frontendStatus == 22 || frontendStatus == 23) {
|
||||
// 直接使用前端传入的状态值(-1, 21, 22, 23, 31, 33, 36)
|
||||
// API支持的状态值列表
|
||||
if (frontendStatus == -1 || frontendStatus == 10 || frontendStatus == 21 ||
|
||||
frontendStatus == 22 || frontendStatus == 23 || frontendStatus == 31 ||
|
||||
frontendStatus == 33 || frontendStatus == 36) {
|
||||
return frontendStatus;
|
||||
}
|
||||
// 前端简化状态值到API状态值的映射
|
||||
switch (frontendStatus) {
|
||||
case 1: // 上架
|
||||
return 10;
|
||||
case 2: // 下架
|
||||
return 21;
|
||||
case 3: // 已售
|
||||
return 31;
|
||||
default:
|
||||
// 如果是其他API标准状态值(-1, 10, 21, 31, 33, 36),直接返回
|
||||
if (frontendStatus == -1 || frontendStatus == 10 || frontendStatus == 21 ||
|
||||
frontendStatus == 31 || frontendStatus == 33 || frontendStatus == 36) {
|
||||
return frontendStatus;
|
||||
}
|
||||
log.warn("未知的商品状态值: {}, 将不设置状态筛选", frontendStatus);
|
||||
return null;
|
||||
}
|
||||
log.warn("未知的商品状态值: {}, 将不设置状态筛选", frontendStatus);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user