1
This commit is contained in:
@@ -158,16 +158,20 @@ public class ErpProductController extends BaseController
|
|||||||
return "全部";
|
return "全部";
|
||||||
}
|
}
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 1:
|
case -1:
|
||||||
return "上架";
|
return "删除";
|
||||||
case 2:
|
case 21:
|
||||||
return "下架";
|
return "待发布";
|
||||||
case 3:
|
|
||||||
return "已售";
|
|
||||||
case 22:
|
case 22:
|
||||||
return "草稿";
|
return "销售中";
|
||||||
case 23:
|
case 23:
|
||||||
return "审核中";
|
return "已售罄";
|
||||||
|
case 31:
|
||||||
|
return "手动下架";
|
||||||
|
case 33:
|
||||||
|
return "售出下架";
|
||||||
|
case 36:
|
||||||
|
return "自动下架";
|
||||||
default:
|
default:
|
||||||
return String.valueOf(status);
|
return String.valueOf(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ public class ErpProduct extends BaseEntity
|
|||||||
@Excel(name = "商品库存")
|
@Excel(name = "商品库存")
|
||||||
private Integer stock;
|
private Integer stock;
|
||||||
|
|
||||||
/** 商品状态 1:上架 2:下架 3:已售 */
|
/** 商品状态 -1:删除 21:待发布 22:销售中 23:已售罄 31:手动下架 33:售出下架 36:自动下架 */
|
||||||
@Excel(name = "商品状态", readConverterExp = "1=上架,2=下架,3=已售")
|
@Excel(name = "商品状态", readConverterExp = "-1=删除,21=待发布,22=销售中,23=已售罄,31=手动下架,33=售出下架,36=自动下架")
|
||||||
private Integer productStatus;
|
private Integer productStatus;
|
||||||
|
|
||||||
/** 销售状态 */
|
/** 销售状态 */
|
||||||
|
|||||||
@@ -285,37 +285,25 @@ public class ErpProductServiceImpl implements IErpProductService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换商品状态值:将前端的简化状态值转换为API需要的状态值
|
* 转换商品状态值:将前端状态值转换为API需要的状态值
|
||||||
* 前端:1(上架), 2(下架), 3(已售), 22(草稿), 23(审核中)
|
* 实际状态值:-1(删除), 21(待发布), 22(销售中), 23(已售罄), 31(手动下架), 33(售出下架), 36(自动下架)
|
||||||
* API:-1(全部), 10(上架), 21(下架), 22(草稿), 23(审核中), 31(已售), 33(已删除), 36(违规)
|
* API支持的状态值:-1, 10, 21, 22, 23, 31, 33, 36
|
||||||
* 如果前端传入的是API已有的状态值(如22、23),直接返回;否则进行映射转换
|
* 前端传入的状态值直接使用,不做转换
|
||||||
*/
|
*/
|
||||||
private Integer convertProductStatus(Integer frontendStatus) {
|
private Integer convertProductStatus(Integer frontendStatus) {
|
||||||
if (frontendStatus == null) {
|
if (frontendStatus == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 如果是API标准状态值(22、23),直接返回
|
// 直接使用前端传入的状态值(-1, 21, 22, 23, 31, 33, 36)
|
||||||
if (frontendStatus == 22 || frontendStatus == 23) {
|
// API支持的状态值列表
|
||||||
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 ||
|
if (frontendStatus == -1 || frontendStatus == 10 || frontendStatus == 21 ||
|
||||||
frontendStatus == 31 || frontendStatus == 33 || frontendStatus == 36) {
|
frontendStatus == 22 || frontendStatus == 23 || frontendStatus == 31 ||
|
||||||
|
frontendStatus == 33 || frontendStatus == 36) {
|
||||||
return frontendStatus;
|
return frontendStatus;
|
||||||
}
|
}
|
||||||
log.warn("未知的商品状态值: {}, 将不设置状态筛选", frontendStatus);
|
log.warn("未知的商品状态值: {}, 将不设置状态筛选", frontendStatus);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全量同步商品列表(自动遍历所有页码,同步更新和删除)
|
* 全量同步商品列表(自动遍历所有页码,同步更新和删除)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ CREATE TABLE `erp_product` (
|
|||||||
`main_image` varchar(1000) DEFAULT NULL COMMENT '商品图片(主图)',
|
`main_image` varchar(1000) DEFAULT NULL COMMENT '商品图片(主图)',
|
||||||
`price` bigint(20) DEFAULT NULL COMMENT '商品价格(分)',
|
`price` bigint(20) DEFAULT NULL COMMENT '商品价格(分)',
|
||||||
`stock` int(11) DEFAULT NULL COMMENT '商品库存',
|
`stock` int(11) DEFAULT NULL COMMENT '商品库存',
|
||||||
`product_status` int(11) DEFAULT NULL COMMENT '商品状态 1:上架 2:下架 3:已售',
|
`product_status` int(11) DEFAULT NULL COMMENT '商品状态 -1:删除 21:待发布 22:销售中 23:已售罄 31:手动下架 33:售出下架 36:自动下架',
|
||||||
`sale_status` int(11) DEFAULT NULL COMMENT '销售状态',
|
`sale_status` int(11) DEFAULT NULL COMMENT '销售状态',
|
||||||
`user_name` varchar(100) DEFAULT NULL COMMENT '闲鱼会员名',
|
`user_name` varchar(100) DEFAULT NULL COMMENT '闲鱼会员名',
|
||||||
`online_time` bigint(20) DEFAULT NULL COMMENT '上架时间(时间戳)',
|
`online_time` bigint(20) DEFAULT NULL COMMENT '上架时间(时间戳)',
|
||||||
|
|||||||
Reference in New Issue
Block a user