优化店铺商品tao、jd、pdd
This commit is contained in:
parent
6bd8e383ba
commit
417e557388
2816
docs/qihang-oms.sql
2816
docs/qihang-oms.sql
File diff suppressed because one or more lines are too long
|
|
@ -111,9 +111,11 @@ public class PddGoodsApiController {
|
|||
sku.setGoodsId(g.getGoodsId());
|
||||
sku.setGoodsName(g.getGoodsName());
|
||||
sku.setThumbUrl(g.getThumbUrl());
|
||||
|
||||
sku.setCreateTime(new Date());
|
||||
|
||||
skuList.add(sku);
|
||||
|
||||
pddGoods.setOuterGoodsId(sku.getOuterGoodsId());
|
||||
}
|
||||
pddGoods.setSkuList(skuList);
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,15 @@ public class JdGoods implements Serializable {
|
|||
* 商品id(o_goods外键)
|
||||
*/
|
||||
private Long erpGoodsId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<JdGoodsSku> skuList;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,16 @@ public class JdGoodsSku implements Serializable {
|
|||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -71,32 +71,57 @@ public class JdGoodsServiceImpl extends ServiceImpl<JdGoodsMapper, JdGoods>
|
|||
List<JdGoods> jdGoods = mapper.selectList(new LambdaQueryWrapper<JdGoods>().eq(JdGoods::getWareId, goods.getWareId()));
|
||||
if(jdGoods== null || jdGoods.isEmpty()){
|
||||
// 新增
|
||||
goods.setCreateTime(new Date());
|
||||
goods.setShopId(shopId);
|
||||
mapper.insert(goods);
|
||||
}else{
|
||||
// 修改
|
||||
goods.setId(jdGoods.get(0).getId());
|
||||
goods.setShopId(shopId);
|
||||
goods.setUpdateTime(new Date());
|
||||
mapper.updateById(goods);
|
||||
// 删除sku
|
||||
skuMapper.delete(new LambdaQueryWrapper<JdGoodsSku>().eq(JdGoodsSku::getWareId,goods.getWareId()));
|
||||
// skuMapper.delete(new LambdaQueryWrapper<JdGoodsSku>().eq(JdGoodsSku::getWareId,goods.getWareId()));
|
||||
}
|
||||
|
||||
Long erpGoodsId=0L;
|
||||
String erpGoodsNum="";
|
||||
// 添加sku
|
||||
if(goods.getSkuList()!=null && !goods.getSkuList().isEmpty()){
|
||||
for (var item : goods.getSkuList()){
|
||||
|
||||
item.setShopId(shopId);
|
||||
// item.setGoodsId(goods.getId());
|
||||
// 根据OuterId查找ERP系统中的skuid
|
||||
if(StringUtils.isNotEmpty(item.getOuterId())) {
|
||||
List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuCode, item.getOuterId()));
|
||||
if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
erpGoodsId = oGoodsSkus.get(0).getGoodsId();
|
||||
erpGoodsNum = oGoodsSkus.get(0).getGoodsNum();
|
||||
item.setErpGoodsId(oGoodsSkus.get(0).getGoodsId());
|
||||
item.setErpGoodsSkuId(oGoodsSkus.get(0).getId());
|
||||
}
|
||||
}
|
||||
List<JdGoodsSku> jdGoodsSkus = skuMapper.selectList(new LambdaQueryWrapper<JdGoodsSku>().eq(JdGoodsSku::getSkuId, item.getSkuId()));
|
||||
if(jdGoodsSkus!=null && jdGoodsSkus.size()>0){
|
||||
// 存在更新
|
||||
item.setUpdateTime(new Date());
|
||||
skuMapper.updateById(item);
|
||||
}else {
|
||||
// 新增
|
||||
item.setCreateTime(new Date());
|
||||
skuMapper.insert(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(erpGoodsId>0){
|
||||
JdGoods jdGoodsUpdate = new JdGoods();
|
||||
jdGoodsUpdate.setId(goods.getId());
|
||||
jdGoodsUpdate.setItemNum(erpGoodsNum);
|
||||
jdGoodsUpdate.setErpGoodsId(erpGoodsId);
|
||||
mapper.updateById(jdGoodsUpdate);
|
||||
}
|
||||
|
||||
return ResultVo.success();
|
||||
}
|
||||
|
||||
|
|
@ -111,6 +136,8 @@ public class JdGoodsServiceImpl extends ServiceImpl<JdGoodsMapper, JdGoods>
|
|||
if(StringUtils.isNotEmpty(goodsSku.getOuterId())) {
|
||||
List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuCode, goodsSku.getOuterId()));
|
||||
if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
// erpGoodsId = oGoodsSkus.get(0).getGoodsId();
|
||||
// erpGoodsNum = oGoodsSkus.get(0).getGoodsNum();
|
||||
goodsSku.setErpGoodsId(oGoodsSkus.get(0).getGoodsId());
|
||||
goodsSku.setErpGoodsSkuId(oGoodsSkus.get(0).getId());
|
||||
}
|
||||
|
|
@ -123,6 +150,8 @@ public class JdGoodsServiceImpl extends ServiceImpl<JdGoodsMapper, JdGoods>
|
|||
if(StringUtils.isNotEmpty(goodsSku.getOuterId())) {
|
||||
List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuCode, goodsSku.getOuterId()));
|
||||
if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
// erpGoodsId = oGoodsSkus.get(0).getGoodsId();
|
||||
// erpGoodsNum = oGoodsSkus.get(0).getGoodsNum();
|
||||
goodsSku.setErpGoodsId(oGoodsSkus.get(0).getGoodsId());
|
||||
goodsSku.setErpGoodsSkuId(oGoodsSkus.get(0).getId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
<result property="spuId" column="spu_id" jdbcType="VARCHAR"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
|
||||
<result property="erpGoodsId" column="erp_goods_id" jdbcType="BIGINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
|
|
@ -50,6 +52,6 @@
|
|||
logo,market_price,cost_price,
|
||||
jd_price,brand_name,stock_num,
|
||||
sell_point,after_sale_desc,spu_id,
|
||||
shop_id,erp_goods_id
|
||||
shop_id,erp_goods_id,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
<result property="erpGoodsId" column="erp_goods_id" jdbcType="BIGINT"/>
|
||||
<result property="erpGoodsSkuId" column="erp_goods_sku_id" jdbcType="BIGINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
|
|
@ -30,7 +32,7 @@
|
|||
bar_code,logo,sale_attrs,
|
||||
sku_name,stock_num,modified,
|
||||
created,currency_spu_id,erp_goods_id,
|
||||
erp_goods_sku_id,shop_id
|
||||
erp_goods_sku_id,shop_id,create_time,update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectSkuPageList" resultType="cn.qihangerp.module.open.jd.domain.vo.JdGoodsSkuListVo">
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pdd商品表
|
||||
* @TableName pdd_goods
|
||||
* @TableName oms_pdd_goods
|
||||
*/
|
||||
@TableName("oms_pdd_goods")
|
||||
@TableName(value ="oms_pdd_goods")
|
||||
@Data
|
||||
public class PddGoods implements Serializable {
|
||||
/**
|
||||
|
|
@ -38,6 +38,11 @@ public class PddGoods implements Serializable {
|
|||
*/
|
||||
private Long goodsQuantity;
|
||||
|
||||
/**
|
||||
* 商家外部编码(goods)
|
||||
*/
|
||||
private String outerGoodsId;
|
||||
|
||||
/**
|
||||
* 是否多sku,0-单sku,1-多sku
|
||||
*/
|
||||
|
|
@ -53,6 +58,11 @@ public class PddGoods implements Serializable {
|
|||
*/
|
||||
private String thumbUrl;
|
||||
|
||||
/**
|
||||
* 市场价,单位分
|
||||
*/
|
||||
private Long marketPrice;
|
||||
|
||||
/**
|
||||
* 商品创建时间的时间戳
|
||||
*/
|
||||
|
|
@ -66,7 +76,7 @@ public class PddGoods implements Serializable {
|
|||
/**
|
||||
* erp商品id
|
||||
*/
|
||||
private Long oGoodsId;
|
||||
private Long erpGoodsId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
|
@ -77,9 +87,8 @@ public class PddGoods implements Serializable {
|
|||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<PddGoodsSku> skuList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,25 +1,25 @@
|
|||
package cn.qihangerp.module.open.pdd.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pdd商品SKU表
|
||||
* @TableName pdd_goods_sku
|
||||
* @TableName oms_pdd_goods_sku
|
||||
*/
|
||||
@TableName("oms_pdd_goods_sku")
|
||||
@TableName(value ="oms_pdd_goods_sku")
|
||||
@Data
|
||||
public class PddGoodsSku implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* sku编码
|
||||
|
|
@ -41,6 +41,11 @@ public class PddGoodsSku implements Serializable {
|
|||
*/
|
||||
private String thumbUrl;
|
||||
|
||||
/**
|
||||
* 商家外部编码(goods)
|
||||
*/
|
||||
private String outerGoodsId;
|
||||
|
||||
/**
|
||||
* 商家外部编码(sku)
|
||||
*/
|
||||
|
|
@ -56,6 +61,11 @@ public class PddGoodsSku implements Serializable {
|
|||
*/
|
||||
private String spec;
|
||||
|
||||
/**
|
||||
* 价格,单位分
|
||||
*/
|
||||
private Long price;
|
||||
|
||||
/**
|
||||
* sku是否在架上,0-下架中,1-架上
|
||||
*/
|
||||
|
|
@ -64,12 +74,12 @@ public class PddGoodsSku implements Serializable {
|
|||
/**
|
||||
* 商品id(o_goods外键)
|
||||
*/
|
||||
private String oGoodsId;
|
||||
private Long erpGoodsId;
|
||||
|
||||
/**
|
||||
* 商品skuid(o_goods_sku外键)
|
||||
*/
|
||||
private String oGoodsSkuId;
|
||||
private Long erpGoodsSkuId;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
|
|
@ -86,5 +96,6 @@ public class PddGoodsSku implements Serializable {
|
|||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,14 +1,13 @@
|
|||
package cn.qihangerp.module.open.pdd.mapper;
|
||||
|
||||
|
||||
import cn.qihangerp.module.open.pdd.domain.PddGoods;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【pdd_goods(pdd商品表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 17:11:49
|
||||
* @Entity cn.qihangerp.pdd.domain.PddGoods
|
||||
* @author qilip
|
||||
* @description 针对表【oms_pdd_goods(pdd商品表)】的数据库操作Mapper
|
||||
* @createDate 2025-05-20 12:31:44
|
||||
* @Entity cn.qihangerp.module.open.pdd.domain.PddGoods
|
||||
*/
|
||||
public interface PddGoodsMapper extends BaseMapper<PddGoods> {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,16 @@
|
|||
package cn.qihangerp.module.open.pdd.mapper;
|
||||
|
||||
import cn.qihangerp.module.open.pdd.domain.PddGoodsSku;
|
||||
import cn.qihangerp.module.open.pdd.domain.vo.PddGoodsSkuListVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【pdd_goods_sku(pdd商品SKU表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-04 17:11:49
|
||||
* @Entity cn.qihangerp.pdd.domain.PddGoodsSku
|
||||
* @author qilip
|
||||
* @description 针对表【oms_pdd_goods_sku(pdd商品SKU表)】的数据库操作Mapper
|
||||
* @createDate 2025-05-20 12:30:47
|
||||
* @Entity cn.qihangerp.module.open.pdd.domain.PddGoodsSku
|
||||
*/
|
||||
public interface PddGoodsSkuMapper extends BaseMapper<PddGoodsSku> {
|
||||
IPage<PddGoodsSkuListVo> selectSkuPageList(Page<PddGoodsSku> page,
|
||||
@Param("shopId") Integer shopId,
|
||||
@Param("goodsId") Long goodsId,
|
||||
@Param("skuId") Long skuId,
|
||||
@Param("outerId") String outerId,
|
||||
@Param("hasLink") Integer hasLink
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
package cn.qihangerp.module.open.pdd.service;
|
||||
|
||||
import cn.qihangerp.common.PageQuery;
|
||||
import cn.qihangerp.common.PageResult;
|
||||
import cn.qihangerp.module.open.pdd.domain.PddGoodsSku;
|
||||
import cn.qihangerp.module.open.pdd.domain.bo.PddGoodsBo;
|
||||
import cn.qihangerp.module.open.pdd.domain.vo.PddGoodsSkuListVo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【pdd_goods_sku(pdd商品SKU表)】的数据库操作Service
|
||||
* @createDate 2024-06-04 17:11:49
|
||||
* @author qilip
|
||||
* @description 针对表【oms_pdd_goods_sku(pdd商品SKU表)】的数据库操作Service
|
||||
* @createDate 2025-05-20 12:30:47
|
||||
*/
|
||||
public interface PddGoodsSkuService extends IService<PddGoodsSku> {
|
||||
PageResult<PddGoodsSkuListVo> queryPageList(PddGoodsBo bo, PageQuery pageQuery);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,9 +60,10 @@ public class PddGoodsServiceImpl extends ServiceImpl<PddGoodsMapper, PddGoods>
|
|||
goods.setUpdateTime(new Date());
|
||||
mapper.updateById(goods);
|
||||
// 删除sku
|
||||
skuMapper.delete(new LambdaQueryWrapper<PddGoodsSku>().eq(PddGoodsSku::getGoodsId,goods.getGoodsId()));
|
||||
// skuMapper.delete(new LambdaQueryWrapper<PddGoodsSku>().eq(PddGoodsSku::getGoodsId,goods.getGoodsId()));
|
||||
}
|
||||
|
||||
Long erpGoodsId=0L;
|
||||
String erpGoodsNum="";
|
||||
// 添加sku
|
||||
if(goods.getSkuList()!=null && !goods.getSkuList().isEmpty()){
|
||||
for (var item : goods.getSkuList()){
|
||||
|
|
@ -70,18 +71,38 @@ public class PddGoodsServiceImpl extends ServiceImpl<PddGoodsMapper, PddGoods>
|
|||
item.setGoodsName(goods.getGoodsName());
|
||||
item.setThumbUrl(goods.getThumbUrl());
|
||||
item.setShopId(shopId);
|
||||
item.setCreateTime(new Date());
|
||||
|
||||
|
||||
// 根据OuterId查找ERP系统中的skuid
|
||||
if(StringUtils.isNotEmpty(item.getOuterId())) {
|
||||
List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuCode, item.getOuterId()));
|
||||
if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
item.setOGoodsId(oGoodsSkus.get(0).getGoodsId().toString());
|
||||
item.setOGoodsSkuId(oGoodsSkus.get(0).getId().toString());
|
||||
erpGoodsId = oGoodsSkus.get(0).getGoodsId();
|
||||
erpGoodsNum = oGoodsSkus.get(0).getGoodsNum();
|
||||
item.setErpGoodsId(oGoodsSkus.get(0).getGoodsId());
|
||||
item.setErpGoodsSkuId(oGoodsSkus.get(0).getId());
|
||||
}
|
||||
}
|
||||
|
||||
item.setCreateTime(new Date());
|
||||
List<PddGoodsSku> pddGoodsSkus = skuMapper.selectList(new LambdaQueryWrapper<PddGoodsSku>().eq(PddGoodsSku::getGoodsId, goods.getGoodsId()));
|
||||
if(pddGoodsSkus!=null && !pddGoodsSkus.isEmpty()){
|
||||
// 存在更新
|
||||
item.setUpdateTime(new Date());
|
||||
skuMapper.updateById(item);
|
||||
}else {
|
||||
item.setCreateTime(new Date());
|
||||
skuMapper.insert(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(erpGoodsId>0){
|
||||
PddGoods updateGoods = new PddGoods();
|
||||
updateGoods.setId(goods.getId());
|
||||
updateGoods.setErpGoodsId(erpGoodsId);
|
||||
updateGoods.setOuterGoodsId(erpGoodsNum);
|
||||
mapper.updateById(goods);
|
||||
}
|
||||
return ResultVo.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,20 @@
|
|||
package cn.qihangerp.module.open.pdd.service.impl;
|
||||
|
||||
import cn.qihangerp.common.PageQuery;
|
||||
import cn.qihangerp.common.PageResult;
|
||||
import cn.qihangerp.module.open.pdd.domain.PddGoodsSku;
|
||||
import cn.qihangerp.module.open.pdd.domain.bo.PddGoodsBo;
|
||||
import cn.qihangerp.module.open.pdd.domain.vo.PddGoodsSkuListVo;
|
||||
import cn.qihangerp.module.open.pdd.mapper.PddGoodsSkuMapper;
|
||||
import cn.qihangerp.module.open.pdd.service.PddGoodsSkuService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import cn.qihangerp.module.open.pdd.domain.PddGoodsSku;
|
||||
import cn.qihangerp.module.open.pdd.service.PddGoodsSkuService;
|
||||
import cn.qihangerp.module.open.pdd.mapper.PddGoodsSkuMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author TW
|
||||
* @description 针对表【pdd_goods_sku(pdd商品SKU表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-04 17:11:49
|
||||
* @author qilip
|
||||
* @description 针对表【oms_pdd_goods_sku(pdd商品SKU表)】的数据库操作Service实现
|
||||
* @createDate 2025-05-20 12:30:47
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class PddGoodsSkuServiceImpl extends ServiceImpl<PddGoodsSkuMapper, PddGoodsSku>
|
||||
implements PddGoodsSkuService{
|
||||
private final PddGoodsSkuMapper mapper;
|
||||
@Override
|
||||
public PageResult<PddGoodsSkuListVo> queryPageList(PddGoodsBo bo, PageQuery pageQuery) {
|
||||
if(StringUtils.hasText(bo.getOuterId())){
|
||||
bo.setOuterId(bo.getOuterId().trim());
|
||||
}
|
||||
IPage<PddGoodsSkuListVo> result = mapper.selectSkuPageList(pageQuery.build(), bo.getShopId(),bo.getGoodsId(),bo.getSkuId(),bo.getOuterId(),bo.getHasLink());
|
||||
return PageResult.build(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,20 +9,23 @@
|
|||
<result property="goodsId" column="goods_id" jdbcType="BIGINT"/>
|
||||
<result property="goodsName" column="goods_name" jdbcType="VARCHAR"/>
|
||||
<result property="goodsQuantity" column="goods_quantity" jdbcType="BIGINT"/>
|
||||
<result property="outerGoodsId" column="outer_goods_id" jdbcType="VARCHAR"/>
|
||||
<result property="isMoreSku" column="is_more_sku" jdbcType="INTEGER"/>
|
||||
<result property="isOnsale" column="is_onsale" jdbcType="INTEGER"/>
|
||||
<result property="thumbUrl" column="thumb_url" jdbcType="VARCHAR"/>
|
||||
<result property="marketPrice" column="market_price" jdbcType="BIGINT"/>
|
||||
<result property="createdAt" column="created_at" jdbcType="BIGINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="oGoodsId" column="o_goods_id" jdbcType="BIGINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
|
||||
<result property="erpGoodsId" column="erp_goods_id" jdbcType="BIGINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,goods_id,goods_name,
|
||||
goods_quantity,is_more_sku,is_onsale,
|
||||
thumb_url,created_at,shop_id,
|
||||
o_goods_id,create_time,update_time
|
||||
goods_quantity,outer_goods_id,is_more_sku,
|
||||
is_onsale,thumb_url,market_price,
|
||||
created_at,shop_id,erp_goods_id,
|
||||
create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@
|
|||
<result property="goodsId" column="goods_id" jdbcType="BIGINT"/>
|
||||
<result property="goodsName" column="goods_name" jdbcType="VARCHAR"/>
|
||||
<result property="thumbUrl" column="thumb_url" jdbcType="VARCHAR"/>
|
||||
<result property="outerGoodsId" column="outer_goods_id" jdbcType="VARCHAR"/>
|
||||
<result property="outerId" column="outer_id" jdbcType="VARCHAR"/>
|
||||
<result property="skuQuantity" column="sku_quantity" jdbcType="BIGINT"/>
|
||||
<result property="spec" column="spec" jdbcType="VARCHAR"/>
|
||||
<result property="price" column="price" jdbcType="BIGINT"/>
|
||||
<result property="isSkuOnsale" column="is_sku_onsale" jdbcType="INTEGER"/>
|
||||
<result property="oGoodsId" column="o_goods_id" jdbcType="BIGINT"/>
|
||||
<result property="oGoodsSkuId" column="o_goods_sku_id" jdbcType="BIGINT"/>
|
||||
<result property="erpGoodsId" column="erp_goods_id" jdbcType="BIGINT"/>
|
||||
<result property="erpGoodsSkuId" column="erp_goods_sku_id" jdbcType="BIGINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
|
|
@ -23,34 +25,10 @@
|
|||
|
||||
<sql id="Base_Column_List">
|
||||
id,sku_id,goods_id,
|
||||
goods_name,thumb_url,outer_id,
|
||||
sku_quantity,spec,is_sku_onsale,
|
||||
o_goods_id,o_goods_sku_id,shop_id,
|
||||
create_time,update_time
|
||||
goods_name,thumb_url,outer_goods_id,
|
||||
outer_id,sku_quantity,spec,
|
||||
price,is_sku_onsale,erp_goods_id,
|
||||
erp_goods_sku_id,shop_id,create_time,
|
||||
update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectSkuPageList" resultType="cn.qihangerp.module.open.pdd.domain.vo.PddGoodsSkuListVo">
|
||||
SELECT sku.*,ogs.outer_erp_sku_id FROM oms_pdd_goods_sku sku
|
||||
|
||||
LEFT JOIN o_goods_sku ogs on ogs.id = sku.o_goods_sku_id
|
||||
WHERE 1=1
|
||||
<if test="shopId != null and shopId != ''">
|
||||
AND sku.shop_id = #{shopId}
|
||||
</if>
|
||||
<if test="goodsId != null and goodsId != ''">
|
||||
AND sku.goods_id = #{goodsId}
|
||||
</if>
|
||||
<if test="skuId != null and skuId != ''">
|
||||
AND sku.sku_id = #{skuId}
|
||||
</if>
|
||||
<if test="outerId != null and outerId != ''">
|
||||
AND sku.outer_id = #{outerId}
|
||||
</if>
|
||||
<if test="hasLink != null and hasLink == 0">
|
||||
AND (sku.o_goods_sku_id is NULL or sku.o_goods_sku_id = 0)
|
||||
</if>
|
||||
<if test="hasLink != null and hasLink == 1">
|
||||
AND sku.o_goods_sku_id is NOT NULL and sku.o_goods_sku_id != 0
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ public class TaoGoodsSku implements Serializable {
|
|||
* 外键id
|
||||
*/
|
||||
private Long taoGoodsId;
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* sku所属商品数字id
|
||||
|
|
|
|||
|
|
@ -71,11 +71,21 @@ public class TaoGoodsServiceImpl extends ServiceImpl<TaoGoodsMapper, TaoGoods>
|
|||
// 存在,更新
|
||||
goods.setShopId(shopId);
|
||||
goods.setId(goodsList.get(0).getId());
|
||||
goods.setUpdateTime(new Date());
|
||||
// goods.setOuterId(erpGoodsNum);
|
||||
// goods.setErpGoodsId(erpGoodsId);
|
||||
mapper.updateById(goods);
|
||||
|
||||
// 删除sku
|
||||
skuMapper.delete(new LambdaQueryWrapper<TaoGoodsSku>().eq(TaoGoodsSku::getTaoGoodsId,goods.getId()));
|
||||
return ResultVoEnum.DataExist.getIndex();
|
||||
}else {
|
||||
// 不存在,新增
|
||||
goods.setShopId(shopId);
|
||||
goods.setCreateTime(new Date());
|
||||
mapper.insert(goods);
|
||||
}
|
||||
|
||||
Long erpGoodsId=0L;
|
||||
String erpGoodsNum="";
|
||||
// 重新插入sku
|
||||
if(goods.getSkus()!=null) {
|
||||
for (var sku : goods.getSkus()) {
|
||||
|
|
@ -84,38 +94,34 @@ public class TaoGoodsServiceImpl extends ServiceImpl<TaoGoodsMapper, TaoGoods>
|
|||
if(StringUtils.isNotEmpty(sku.getOuterId())) {
|
||||
List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuCode, sku.getOuterId()));
|
||||
if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
erpGoodsId = oGoodsSkus.get(0).getGoodsId();
|
||||
erpGoodsNum = oGoodsSkus.get(0).getGoodsNum();
|
||||
sku.setErpGoodsId(oGoodsSkus.get(0).getGoodsId());
|
||||
sku.setErpGoodsSkuId(oGoodsSkus.get(0).getId());
|
||||
}
|
||||
}
|
||||
skuMapper.insert(sku);
|
||||
}
|
||||
}
|
||||
return ResultVoEnum.DataExist.getIndex();
|
||||
List<TaoGoodsSku> taoGoodsSkus = skuMapper.selectList(new LambdaQueryWrapper<TaoGoodsSku>().eq(TaoGoodsSku::getTaoGoodsId, goods.getId()));
|
||||
if(taoGoodsSkus!=null && !taoGoodsSkus.isEmpty()){
|
||||
// 更新
|
||||
sku.setUpdateTime(new Date());
|
||||
skuMapper.updateById(sku);
|
||||
}else {
|
||||
// 不存在,新增
|
||||
goods.setShopId(shopId);
|
||||
goods.setCreateTime(new Date());
|
||||
mapper.insert(goods);
|
||||
// 插入sku
|
||||
if(goods.getSkus()!=null) {
|
||||
for (var sku : goods.getSkus()) {
|
||||
sku.setTaoGoodsId(goods.getId());
|
||||
// 根据OuterId查找ERP系统中的skuid
|
||||
if(StringUtils.isNotEmpty(sku.getOuterId())) {
|
||||
List<OGoodsSku> oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<OGoodsSku>().eq(OGoodsSku::getSkuCode, sku.getOuterId()));
|
||||
if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){
|
||||
sku.setErpGoodsId(oGoodsSkus.get(0).getGoodsId());
|
||||
sku.setErpGoodsSkuId(oGoodsSkus.get(0).getId());
|
||||
}
|
||||
}
|
||||
|
||||
// 插入
|
||||
sku.setShopId(shopId);
|
||||
sku.setCreateTime(new Date());
|
||||
skuMapper.insert(sku);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(erpGoodsId>0) {
|
||||
TaoGoods taoGoodsUpdate = new TaoGoods();
|
||||
taoGoodsUpdate.setId(goods.getId());
|
||||
taoGoodsUpdate.setOuterId(erpGoodsNum);
|
||||
taoGoodsUpdate.setErpGoodsId(erpGoodsId);
|
||||
mapper.updateById(taoGoodsUpdate);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送商品到商品库
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<resultMap id="BaseResultMap" type="cn.qihangerp.module.open.tao.domain.TaoGoodsSku">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="taoGoodsId" column="tao_goods_id" jdbcType="BIGINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
|
||||
<result property="numIid" column="num_iid" jdbcType="BIGINT"/>
|
||||
<result property="iid" column="iid" jdbcType="VARCHAR"/>
|
||||
<result property="skuId" column="sku_id" jdbcType="BIGINT"/>
|
||||
|
|
@ -28,7 +29,7 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,tao_goods_id,num_iid,
|
||||
id,tao_goods_id,num_iid,shop_id,
|
||||
iid,sku_id,properties,
|
||||
properties_name,quantity,spec,
|
||||
price,outer_id,created,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,69 @@
|
|||
# 更新日志
|
||||
#### 2025-05-19
|
||||
+ 店铺商品-tao:拆分商品和SKU列表;
|
||||
+ 店铺商品-tao修改数据库字段;
|
||||
+ 新增店铺商品-tao推送到商品库功能;
|
||||
+ 新增店铺商品-tao一键关联商品库SKU功能;
|
||||
### v2.5.4
|
||||
**主要更新**
|
||||
+ 优化数据结构:新增部分字段、更新ID主键;
|
||||
+ 新增店铺商品同步到商品库功能;
|
||||
+ 新增店铺商品一键关联商品库商品功能;
|
||||
+ 新增订单同步状态、结果字段;
|
||||
+ 新增订单取消通知;
|
||||
+ 新增分配供应商发货功能;
|
||||
+ 优化备货清单功能(仓库发货备货清单、供应商发货备货清单)
|
||||
|
||||
|
||||
#### v2.5.4.26
|
||||
+ [ ] 备货清单新增出库功能-减少库存;
|
||||
+ [ ] 供应商备货清单新增手动录入发货物流功能;
|
||||
+ [ ] 新增供应商发货物流录入功能;
|
||||
|
||||
|
||||
#### v2.5.4.25
|
||||
+ [ ] 订单取号-加入备货清单;
|
||||
+ [ ] 订单手动发货-加入备货清单;
|
||||
+ [ ] 订单分配供应商-加入供应商备货清单;
|
||||
|
||||
#### v2.5.4.24
|
||||
+[ ] 店铺订单新增同步状态;
|
||||
+[ ] TAO
|
||||
+[ ] JD
|
||||
+[ ] PDD
|
||||
+[ ] DOU
|
||||
+[ ] WEI
|
||||
+[ ] 店铺订单取消通知;
|
||||
+[ ] TAO
|
||||
+[ ] JD
|
||||
+[ ] PDD
|
||||
+[ ] DOU
|
||||
+[ ] WEI
|
||||
|
||||
#### v2.5.4.23
|
||||
+[ ] 店铺商品-wei:拆分商品和SKU列表;
|
||||
+[ ] 店铺商品-wei修改数据库字段;
|
||||
+[ ] 新增店铺商品-wei推送到商品库功能;
|
||||
+[ ] 新增店铺商品-wei一键关联商品库SKU功能;
|
||||
|
||||
#### v2.5.4.22
|
||||
+[ ] 店铺商品-dou:拆分商品和SKU列表;
|
||||
+[ ] 店铺商品-dou修改数据库字段;
|
||||
+[ ] 新增店铺商品-dou推送到商品库功能;
|
||||
+[ ] 新增店铺商品-dou一键关联商品库SKU功能;
|
||||
|
||||
#### v2.5.4.21
|
||||
+[x] 店铺商品-pdd:拆分商品和SKU列表;
|
||||
+[x] 店铺商品-pdd修改数据库字段;
|
||||
+[x] 新增店铺商品-pdd推送到商品库功能;
|
||||
+[x] 新增店铺商品-pdd一键关联商品库SKU功能;
|
||||
|
||||
#### v2.5.4.20
|
||||
+[x] 店铺商品-jd:拆分商品和SKU列表;
|
||||
+[x] 店铺商品-jd修改数据库字段;
|
||||
+[x] 新增店铺商品-jd推送到商品库功能;
|
||||
+[x] 新增店铺商品-jd一键关联商品库SKU功能;
|
||||
|
||||
#### v2.5.4.19
|
||||
+[x] 店铺商品-tao:拆分商品和SKU列表;
|
||||
+[x] 店铺商品-tao修改数据库字段;
|
||||
+[x] 新增店铺商品-tao推送到商品库功能;
|
||||
+[x] 新增店铺商品-tao一键关联商品库SKU功能;
|
||||
|
||||
|
||||
|
||||
#### 2025-05-20
|
||||
+ 店铺商品-jd:拆分商品和SKU列表;
|
||||
+ 店铺商品-jd修改数据库字段;
|
||||
+ 新增店铺商品-jd推送到商品库功能;
|
||||
+ 新增店铺商品-jd一键关联商品库SKU功能;
|
||||
|
|
@ -52,21 +52,40 @@
|
|||
@click="handlePull"
|
||||
>API拉取商品数据</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="el-icon-refresh"
|
||||
size="mini"
|
||||
@click="handlePushOms"
|
||||
>推送到商品库</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="goodsList">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="ID" align="center" prop="id" />-->
|
||||
<el-table-column label="商品ID" align="center" prop="goodsId" />
|
||||
<el-table-column label="Sku Id" align="center" prop="skuId" />
|
||||
<el-table-column label="商品名" align="center" prop="goodsName" />
|
||||
<el-table-column label="规格" align="center" prop="spec" />
|
||||
<el-table-column label="图片" align="center" prop="logo" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.thumbUrl" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名" align="left" prop="goodsName" />
|
||||
<el-table-column label="规格" align="center" prop="spec" />
|
||||
<el-table-column label="SKU" align="center" >
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-info"
|
||||
@click="handleViewSkuList(scope.row)"
|
||||
>{{scope.row.skuList.length +' 个SKU'}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="店铺" align="center" prop="shopId" >
|
||||
<template slot-scope="scope">
|
||||
|
|
@ -103,6 +122,45 @@
|
|||
/>
|
||||
|
||||
|
||||
<el-dialog title="Sku List" :visible.sync="skuOpen" width="1200px" append-to-body>
|
||||
<el-table v-loading="loading" :data="skuList">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
||||
<el-table-column label="SKU编码" align="left" prop="outerId" />
|
||||
<el-table-column label="平台SkuId" align="center" prop="skuId" />
|
||||
<!-- <el-table-column label="图片" align="center" prop="colorImage" width="100">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <image-preview :src="scope.row.colorImage" :width="50" :height="50"/>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column label="商品名称" align="left" prop="goodsName" width="288px"/>-->
|
||||
<el-table-column label="SKU名称" align="left" prop="skuName" width="300">
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{getSkuProper(scope.row.propertiesName)}}-->
|
||||
<!-- </template>-->
|
||||
</el-table-column>
|
||||
<el-table-column label="价格" align="center" prop="jdPrice" :formatter="amountFormatter"/>
|
||||
<el-table-column label="库存" align="center" prop="stockNum" />
|
||||
<el-table-column label="ERP SKU ID" align="center" prop="erpGoodsSkuId" />
|
||||
<el-table-column label="状态" align="center" prop="status" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" v-if="scope.row.status === 1">销售中</el-tag>
|
||||
<el-tag size="small" v-if="scope.row.status === 2">已下架</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-share"
|
||||
@click="handleLink(scope.row)"
|
||||
>关联ERP</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改商品管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
|
|
@ -148,6 +206,8 @@ export default {
|
|||
// 商品管理表格数据
|
||||
goodsList: [],
|
||||
shopList: [],
|
||||
skuList:[],
|
||||
skuOpen:false,
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
|
|
@ -218,6 +278,12 @@ export default {
|
|||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 查看SKU List*/
|
||||
handleViewSkuList(row){
|
||||
this.skuList = row.skuList
|
||||
this.skuOpen = true;
|
||||
|
||||
},
|
||||
handleLink(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
|
|
|
|||
Loading…
Reference in New Issue