1
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.jarvis.mapper;
|
package com.ruoyi.jarvis.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.ruoyi.jarvis.domain.ErpProduct;
|
import com.ruoyi.jarvis.domain.ErpProduct;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +67,7 @@ public interface ErpProductMapper
|
|||||||
* @param appid ERP应用ID
|
* @param appid ERP应用ID
|
||||||
* @return 闲鱼商品
|
* @return 闲鱼商品
|
||||||
*/
|
*/
|
||||||
public ErpProduct selectErpProductByProductIdAndAppid(Long productId, String appid);
|
public ErpProduct selectErpProductByProductIdAndAppid(@Param("productId") Long productId, @Param("appid") String appid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量插入或更新闲鱼商品
|
* 批量插入或更新闲鱼商品
|
||||||
|
|||||||
@@ -133,7 +133,12 @@ public class ErpProductServiceImpl implements IErpProductService
|
|||||||
request.setPageSize(pageSize);
|
request.setPageSize(pageSize);
|
||||||
}
|
}
|
||||||
if (productStatus != null) {
|
if (productStatus != null) {
|
||||||
request.setProductStatus(productStatus);
|
// API要求的状态值:-1(全部), 10(上架), 21(下架), 22(草稿), 23(审核中), 31(已售), 33(已删除), 36(违规)
|
||||||
|
// 前端传入的简化状态值:1(上架), 2(下架), 3(已售)
|
||||||
|
Integer apiStatus = convertProductStatus(productStatus);
|
||||||
|
if (apiStatus != null) {
|
||||||
|
request.setProductStatus(apiStatus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用接口获取商品列表
|
// 调用接口获取商品列表
|
||||||
@@ -264,6 +269,39 @@ public class ErpProductServiceImpl implements IErpProductService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换商品状态值:将前端的简化状态值转换为API需要的状态值
|
||||||
|
* 前端:1(上架), 2(下架), 3(已售), 22(草稿), 23(审核中)
|
||||||
|
* API:-1(全部), 10(上架), 21(下架), 22(草稿), 23(审核中), 31(已售), 33(已删除), 36(违规)
|
||||||
|
* 如果前端传入的是API已有的状态值(如22、23),直接返回;否则进行映射转换
|
||||||
|
*/
|
||||||
|
private Integer convertProductStatus(Integer frontendStatus) {
|
||||||
|
if (frontendStatus == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 如果是API标准状态值(22、23),直接返回
|
||||||
|
if (frontendStatus == 22 || frontendStatus == 23) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析ERP账号
|
* 解析ERP账号
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user