diff --git a/microservices/jd-api/src/main/java/cn/qihangerp/api/jd/controller/JdGoodsController.java b/microservices/jd-api/src/main/java/cn/qihangerp/api/jd/controller/JdGoodsController.java index cd006833..facb36ec 100644 --- a/microservices/jd-api/src/main/java/cn/qihangerp/api/jd/controller/JdGoodsController.java +++ b/microservices/jd-api/src/main/java/cn/qihangerp/api/jd/controller/JdGoodsController.java @@ -1,10 +1,7 @@ package cn.qihangerp.api.jd.controller; -import cn.qihangerp.common.AjaxResult; -import cn.qihangerp.common.PageQuery; -import cn.qihangerp.common.PageResult; -import cn.qihangerp.common.TableDataInfo; +import cn.qihangerp.common.*; import cn.qihangerp.domain.bo.LinkErpGoodsSkuBo; import cn.qihangerp.module.goods.domain.OGoodsSku; import cn.qihangerp.module.goods.service.OGoodsSkuService; @@ -57,14 +54,10 @@ public class JdGoodsController extends BaseController { if(StringUtils.isBlank(bo.getErpGoodsSkuId())){ return AjaxResult.error(500,"缺少参数oGoodsSkuId"); } - OGoodsSku oGoodsSku = oGoodsSkuService.getById(bo.getErpGoodsSkuId()); - - if(oGoodsSku == null) return AjaxResult.error(1500,"未找到系统商品sku"); - JdGoodsSku sku = new JdGoodsSku(); - sku.setId(bo.getId().toString()); - sku.setOGoodsSkuId(Long.parseLong(bo.getErpGoodsSkuId())); - skuService.updateById(sku); - return success(); + ResultVo resultVo = skuService.linkErpGoodsSku(bo); + if(resultVo.getCode()==0) + return success(); + else return AjaxResult.error(resultVo.getMsg()); } } diff --git a/module/goods/src/main/java/cn/qihangerp/module/goods/service/OGoodsSkuService.java b/module/goods/src/main/java/cn/qihangerp/module/goods/service/OGoodsSkuService.java index 079a60e9..02f0b290 100644 --- a/module/goods/src/main/java/cn/qihangerp/module/goods/service/OGoodsSkuService.java +++ b/module/goods/src/main/java/cn/qihangerp/module/goods/service/OGoodsSkuService.java @@ -1,6 +1,8 @@ package cn.qihangerp.module.goods.service; +import cn.qihangerp.common.ResultVo; +import cn.qihangerp.domain.bo.LinkErpGoodsSkuBo; import cn.qihangerp.module.goods.domain.OGoodsSku; import com.baomidou.mybatisplus.extension.service.IService; @@ -13,4 +15,5 @@ import java.util.List; */ public interface OGoodsSkuService extends IService { List searchGoodsSpec(String keyword); + } diff --git a/module/goods/src/main/java/cn/qihangerp/module/goods/service/impl/OGoodsSkuServiceImpl.java b/module/goods/src/main/java/cn/qihangerp/module/goods/service/impl/OGoodsSkuServiceImpl.java index 1999241e..a5d875d6 100644 --- a/module/goods/src/main/java/cn/qihangerp/module/goods/service/impl/OGoodsSkuServiceImpl.java +++ b/module/goods/src/main/java/cn/qihangerp/module/goods/service/impl/OGoodsSkuServiceImpl.java @@ -1,6 +1,8 @@ package cn.qihangerp.module.goods.service.impl; +import cn.qihangerp.common.ResultVo; +import cn.qihangerp.domain.bo.LinkErpGoodsSkuBo; import cn.qihangerp.module.goods.domain.OGoodsSku; import cn.qihangerp.module.goods.mapper.OGoodsSkuMapper; import cn.qihangerp.module.goods.service.OGoodsSkuService; @@ -21,6 +23,7 @@ import java.util.List; public class OGoodsSkuServiceImpl extends ServiceImpl implements OGoodsSkuService { private final OGoodsSkuMapper skuMapper; + @Override public List searchGoodsSpec(String keyword) { LambdaQueryWrapper queryWrapper = @@ -34,6 +37,8 @@ public class OGoodsSkuServiceImpl extends ServiceImpl skuList; - public List getSkuList() { - return skuList; - } - - public void setSkuList(List skuList) { - this.skuList = skuList; - } - + @TableField(exist = false) private static final long serialVersionUID = 1L; - /** - * - */ - public Long getId() { - return id; - } - /** - * - */ - public void setId(Long id) { - this.id = id; - } - - /** - * 商品id - */ - public Long getWareId() { - return wareId; - } - - /** - * 商品id - */ - public void setWareId(Long wareId) { - this.wareId = wareId; - } - - /** - * 商品名称 - */ - public String getTitle() { - return title; - } - - /** - * 商品名称 - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * 商品状态 -1:删除 1:从未上架 2:自主下架 4:系统下架 8:上架 513:从未上架待审 514:自主下架待审 516:系统下架待审 520:上架待审核 1028:系统下架审核失败 - */ - public Integer getWareStatus() { - return wareStatus; - } - - /** - * 商品状态 -1:删除 1:从未上架 2:自主下架 4:系统下架 8:上架 513:从未上架待审 514:自主下架待审 516:系统下架待审 520:上架待审核 1028:系统下架审核失败 - */ - public void setWareStatus(Integer wareStatus) { - this.wareStatus = wareStatus; - } - - /** - * 商品外部ID,商家自行设置的ID(便于关联京东商品) - */ - public String getOuterId() { - return outerId; - } - - /** - * 商品外部ID,商家自行设置的ID(便于关联京东商品) - */ - public void setOuterId(String outerId) { - this.outerId = outerId; - } - - /** - * 商品货号 - */ - public String getItemNum() { - return itemNum; - } - - /** - * 商品货号 - */ - public void setItemNum(String itemNum) { - this.itemNum = itemNum; - } - - /** - * 商品的条形码.UPC码,SN码,PLU码统称为条形码 - */ - public String getBarCode() { - return barCode; - } - - /** - * 商品的条形码.UPC码,SN码,PLU码统称为条形码 - */ - public void setBarCode(String barCode) { - this.barCode = barCode; - } - - /** - * 商品最后一次修改时间 - */ - public Date getModified() { - return modified; - } - - /** - * 商品最后一次修改时间 - */ - public void setModified(Date modified) { - this.modified = modified; - } - - /** - * 商品创建时间,只读属性 - */ - public Date getCreated() { - return created; - } - - /** - * 商品创建时间,只读属性 - */ - public void setCreated(Date created) { - this.created = created; - } - - /** - * 最后下架时间 - */ - public Date getOfflineTime() { - return offlineTime; - } - - /** - * 最后下架时间 - */ - public void setOfflineTime(Date offlineTime) { - this.offlineTime = offlineTime; - } - - /** - * 最后上架时间 - */ - public Date getOnlineTime() { - return onlineTime; - } - - /** - * 最后上架时间 - */ - public void setOnlineTime(Date onlineTime) { - this.onlineTime = onlineTime; - } - - /** - * 发货地 - */ - public String getDelivery() { - return delivery; - } - - /** - * 发货地 - */ - public void setDelivery(String delivery) { - this.delivery = delivery; - } - - /** - * 包装清单 - */ - public String getPackListing() { - return packListing; - } - - /** - * 包装清单 - */ - public void setPackListing(String packListing) { - this.packListing = packListing; - } - - /** - * 包装规格 - */ - public String getWrap() { - return wrap; - } - - /** - * 包装规格 - */ - public void setWrap(String wrap) { - this.wrap = wrap; - } - - /** - * - */ - public Float getWeight() { - return weight; - } - - /** - * - */ - public void setWeight(Float weight) { - this.weight = weight; - } - - /** - * - */ - public Integer getWidth() { - return width; - } - - /** - * - */ - public void setWidth(Integer width) { - this.width = width; - } - - /** - * - */ - public Integer getHeight() { - return height; - } - - /** - * - */ - public void setHeight(Integer height) { - this.height = height; - } - - /** - * - */ - public Integer getLength() { - return length; - } - - /** - * - */ - public void setLength(Integer length) { - this.length = length; - } - - /** - * - */ - public String getMobileDesc() { - return mobileDesc; - } - - /** - * - */ - public void setMobileDesc(String mobileDesc) { - this.mobileDesc = mobileDesc; - } - - /** - * - */ - public String getIntroduction() { - return introduction; - } - - /** - * - */ - public void setIntroduction(String introduction) { - this.introduction = introduction; - } - - /** - * - */ - public String getAfterSales() { - return afterSales; - } - - /** - * - */ - public void setAfterSales(String afterSales) { - this.afterSales = afterSales; - } - - /** - * - */ - public String getLogo() { - return logo; - } - - /** - * - */ - public void setLogo(String logo) { - this.logo = logo; - } - - /** - * - */ - public BigDecimal getMarketPrice() { - return marketPrice; - } - - /** - * - */ - public void setMarketPrice(BigDecimal marketPrice) { - this.marketPrice = marketPrice; - } - - /** - * - */ - public BigDecimal getCostPrice() { - return costPrice; - } - - /** - * - */ - public void setCostPrice(BigDecimal costPrice) { - this.costPrice = costPrice; - } - - /** - * - */ - public BigDecimal getJdPrice() { - return jdPrice; - } - - /** - * - */ - public void setJdPrice(BigDecimal jdPrice) { - this.jdPrice = jdPrice; - } - - /** - * - */ - public String getBrandName() { - return brandName; - } - - /** - * - */ - public void setBrandName(String brandName) { - this.brandName = brandName; - } - - /** - * - */ - public Integer getStockNum() { - return stockNum; - } - - /** - * - */ - public void setStockNum(Integer stockNum) { - this.stockNum = stockNum; - } - - /** - * - */ - public Long getShopId() { - return shopId; - } - - public void setShopId(Long shopId) { - this.shopId = shopId; - } - - /** - * - */ - public String getSellPoint() { - return sellPoint; - } - - /** - * - */ - public void setSellPoint(String sellPoint) { - this.sellPoint = sellPoint; - } - - /** - * - */ - public String getAfterSaleDesc() { - return afterSaleDesc; - } - - /** - * - */ - public void setAfterSaleDesc(String afterSaleDesc) { - this.afterSaleDesc = afterSaleDesc; - } - - /** - * - */ - public String getSpuId() { - return spuId; - } - - /** - * - */ - public void setSpuId(String spuId) { - this.spuId = spuId; - } - - @Override - public boolean equals(Object that) { - if (this == that) { - return true; - } - if (that == null) { - return false; - } - if (getClass() != that.getClass()) { - return false; - } - JdGoods other = (JdGoods) that; - return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) - && (this.getWareId() == null ? other.getWareId() == null : this.getWareId().equals(other.getWareId())) - && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle())) - && (this.getWareStatus() == null ? other.getWareStatus() == null : this.getWareStatus().equals(other.getWareStatus())) - && (this.getOuterId() == null ? other.getOuterId() == null : this.getOuterId().equals(other.getOuterId())) - && (this.getItemNum() == null ? other.getItemNum() == null : this.getItemNum().equals(other.getItemNum())) - && (this.getBarCode() == null ? other.getBarCode() == null : this.getBarCode().equals(other.getBarCode())) - && (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified())) - && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(other.getCreated())) - && (this.getOfflineTime() == null ? other.getOfflineTime() == null : this.getOfflineTime().equals(other.getOfflineTime())) - && (this.getOnlineTime() == null ? other.getOnlineTime() == null : this.getOnlineTime().equals(other.getOnlineTime())) - && (this.getDelivery() == null ? other.getDelivery() == null : this.getDelivery().equals(other.getDelivery())) - && (this.getPackListing() == null ? other.getPackListing() == null : this.getPackListing().equals(other.getPackListing())) - && (this.getWrap() == null ? other.getWrap() == null : this.getWrap().equals(other.getWrap())) - && (this.getWeight() == null ? other.getWeight() == null : this.getWeight().equals(other.getWeight())) - && (this.getWidth() == null ? other.getWidth() == null : this.getWidth().equals(other.getWidth())) - && (this.getHeight() == null ? other.getHeight() == null : this.getHeight().equals(other.getHeight())) - && (this.getLength() == null ? other.getLength() == null : this.getLength().equals(other.getLength())) - && (this.getMobileDesc() == null ? other.getMobileDesc() == null : this.getMobileDesc().equals(other.getMobileDesc())) - && (this.getIntroduction() == null ? other.getIntroduction() == null : this.getIntroduction().equals(other.getIntroduction())) - && (this.getAfterSales() == null ? other.getAfterSales() == null : this.getAfterSales().equals(other.getAfterSales())) - && (this.getLogo() == null ? other.getLogo() == null : this.getLogo().equals(other.getLogo())) - && (this.getMarketPrice() == null ? other.getMarketPrice() == null : this.getMarketPrice().equals(other.getMarketPrice())) - && (this.getCostPrice() == null ? other.getCostPrice() == null : this.getCostPrice().equals(other.getCostPrice())) - && (this.getJdPrice() == null ? other.getJdPrice() == null : this.getJdPrice().equals(other.getJdPrice())) - && (this.getBrandName() == null ? other.getBrandName() == null : this.getBrandName().equals(other.getBrandName())) - && (this.getStockNum() == null ? other.getStockNum() == null : this.getStockNum().equals(other.getStockNum())) - && (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId())) - && (this.getSellPoint() == null ? other.getSellPoint() == null : this.getSellPoint().equals(other.getSellPoint())) - && (this.getAfterSaleDesc() == null ? other.getAfterSaleDesc() == null : this.getAfterSaleDesc().equals(other.getAfterSaleDesc())) - && (this.getSpuId() == null ? other.getSpuId() == null : this.getSpuId().equals(other.getSpuId())); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); - result = prime * result + ((getWareId() == null) ? 0 : getWareId().hashCode()); - result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode()); - result = prime * result + ((getWareStatus() == null) ? 0 : getWareStatus().hashCode()); - result = prime * result + ((getOuterId() == null) ? 0 : getOuterId().hashCode()); - result = prime * result + ((getItemNum() == null) ? 0 : getItemNum().hashCode()); - result = prime * result + ((getBarCode() == null) ? 0 : getBarCode().hashCode()); - result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode()); - result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode()); - result = prime * result + ((getOfflineTime() == null) ? 0 : getOfflineTime().hashCode()); - result = prime * result + ((getOnlineTime() == null) ? 0 : getOnlineTime().hashCode()); - result = prime * result + ((getDelivery() == null) ? 0 : getDelivery().hashCode()); - result = prime * result + ((getPackListing() == null) ? 0 : getPackListing().hashCode()); - result = prime * result + ((getWrap() == null) ? 0 : getWrap().hashCode()); - result = prime * result + ((getWeight() == null) ? 0 : getWeight().hashCode()); - result = prime * result + ((getWidth() == null) ? 0 : getWidth().hashCode()); - result = prime * result + ((getHeight() == null) ? 0 : getHeight().hashCode()); - result = prime * result + ((getLength() == null) ? 0 : getLength().hashCode()); - result = prime * result + ((getMobileDesc() == null) ? 0 : getMobileDesc().hashCode()); - result = prime * result + ((getIntroduction() == null) ? 0 : getIntroduction().hashCode()); - result = prime * result + ((getAfterSales() == null) ? 0 : getAfterSales().hashCode()); - result = prime * result + ((getLogo() == null) ? 0 : getLogo().hashCode()); - result = prime * result + ((getMarketPrice() == null) ? 0 : getMarketPrice().hashCode()); - result = prime * result + ((getCostPrice() == null) ? 0 : getCostPrice().hashCode()); - result = prime * result + ((getJdPrice() == null) ? 0 : getJdPrice().hashCode()); - result = prime * result + ((getBrandName() == null) ? 0 : getBrandName().hashCode()); - result = prime * result + ((getStockNum() == null) ? 0 : getStockNum().hashCode()); - result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode()); - result = prime * result + ((getSellPoint() == null) ? 0 : getSellPoint().hashCode()); - result = prime * result + ((getAfterSaleDesc() == null) ? 0 : getAfterSaleDesc().hashCode()); - result = prime * result + ((getSpuId() == null) ? 0 : getSpuId().hashCode()); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(getClass().getSimpleName()); - sb.append(" ["); - sb.append("Hash = ").append(hashCode()); - sb.append(", id=").append(id); - sb.append(", wareId=").append(wareId); - sb.append(", title=").append(title); - sb.append(", wareStatus=").append(wareStatus); - sb.append(", outerId=").append(outerId); - sb.append(", itemNum=").append(itemNum); - sb.append(", barCode=").append(barCode); - sb.append(", modified=").append(modified); - sb.append(", created=").append(created); - sb.append(", offlineTime=").append(offlineTime); - sb.append(", onlineTime=").append(onlineTime); - sb.append(", delivery=").append(delivery); - sb.append(", packListing=").append(packListing); - sb.append(", wrap=").append(wrap); - sb.append(", weight=").append(weight); - sb.append(", width=").append(width); - sb.append(", height=").append(height); - sb.append(", length=").append(length); - sb.append(", mobileDesc=").append(mobileDesc); - sb.append(", introduction=").append(introduction); - sb.append(", afterSales=").append(afterSales); - sb.append(", logo=").append(logo); - sb.append(", marketPrice=").append(marketPrice); - sb.append(", costPrice=").append(costPrice); - sb.append(", jdPrice=").append(jdPrice); - sb.append(", brandName=").append(brandName); - sb.append(", stockNum=").append(stockNum); - sb.append(", shopId=").append(shopId); - sb.append(", sellPoint=").append(sellPoint); - sb.append(", afterSaleDesc=").append(afterSaleDesc); - sb.append(", spuId=").append(spuId); - sb.append(", serialVersionUID=").append(serialVersionUID); - sb.append("]"); - return sb.toString(); - } } \ No newline at end of file diff --git a/module/jd/src/main/java/cn/qihangerp/module/open/jd/domain/JdGoodsSku.java b/module/jd/src/main/java/cn/qihangerp/module/open/jd/domain/JdGoodsSku.java index ede63a05..3e4b9ba7 100644 --- a/module/jd/src/main/java/cn/qihangerp/module/open/jd/domain/JdGoodsSku.java +++ b/module/jd/src/main/java/cn/qihangerp/module/open/jd/domain/JdGoodsSku.java @@ -1,28 +1,29 @@ package cn.qihangerp.module.open.jd.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.math.BigDecimal; import java.util.Date; +import lombok.Data; /** - * - * @TableName jd_goods_sku + * 京东商品SKU表 + * @TableName oms_jd_goods_sku */ -@TableName("oms_jd_goods_sku") +@TableName(value ="oms_jd_goods_sku") @Data public class JdGoodsSku implements Serializable { /** * */ - private String id; - - + @TableId(type = IdType.AUTO) + private Long id; /** - * + * 平台商品id */ private Long wareId; @@ -31,8 +32,6 @@ public class JdGoodsSku implements Serializable { */ private Long skuId; - private Long shopId; - /** * */ @@ -89,15 +88,20 @@ public class JdGoodsSku implements Serializable { private String currencySpuId; /** - * erp商品id + * 商品id(o_goods外键) */ - private String oGoodsId; + private Long erpGoodsId; /** - * erp商品sku id + * 商品skuid(o_goods_sku外键) */ - private Long oGoodsSkuId; + private Long erpGoodsSkuId; + /** + * 店铺id + */ + private Long shopId; + + @TableField(exist = false) private static final long serialVersionUID = 1L; - } \ No newline at end of file diff --git a/module/jd/src/main/java/cn/qihangerp/module/open/jd/mapper/JdGoodsMapper.java b/module/jd/src/main/java/cn/qihangerp/module/open/jd/mapper/JdGoodsMapper.java index 85cf18f5..8f2472c4 100644 --- a/module/jd/src/main/java/cn/qihangerp/module/open/jd/mapper/JdGoodsMapper.java +++ b/module/jd/src/main/java/cn/qihangerp/module/open/jd/mapper/JdGoodsMapper.java @@ -1,14 +1,13 @@ package cn.qihangerp.module.open.jd.mapper; - import cn.qihangerp.module.open.jd.domain.JdGoods; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @author qilip -* @description 针对表【jd_goods】的数据库操作Mapper -* @createDate 2024-03-09 11:29:59 -* @Entity cn.qihangerp.jd.domain.JdGoods +* @description 针对表【oms_jd_goods(京东商品表)】的数据库操作Mapper +* @createDate 2025-05-19 18:49:18 +* @Entity cn.qihangerp.module.open.jd.domain.JdGoods */ public interface JdGoodsMapper extends BaseMapper { diff --git a/module/jd/src/main/java/cn/qihangerp/module/open/jd/mapper/JdGoodsSkuMapper.java b/module/jd/src/main/java/cn/qihangerp/module/open/jd/mapper/JdGoodsSkuMapper.java index 8605d72c..31272885 100644 --- a/module/jd/src/main/java/cn/qihangerp/module/open/jd/mapper/JdGoodsSkuMapper.java +++ b/module/jd/src/main/java/cn/qihangerp/module/open/jd/mapper/JdGoodsSkuMapper.java @@ -2,18 +2,16 @@ package cn.qihangerp.module.open.jd.mapper; import cn.qihangerp.module.open.jd.domain.JdGoodsSku; import cn.qihangerp.module.open.jd.domain.vo.JdGoodsSkuListVo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - import org.apache.ibatis.annotations.Param; /** * @author qilip -* @description 针对表【jd_goods_sku】的数据库操作Mapper -* @createDate 2024-03-09 20:44:11 -* @Entity cn.qihangerp.jd.domain.JdGoodsSku +* @description 针对表【oms_jd_goods_sku(京东商品SKU表)】的数据库操作Mapper +* @createDate 2025-05-19 18:50:56 +* @Entity cn.qihangerp.module.open.jd.domain.JdGoodsSku */ public interface JdGoodsSkuMapper extends BaseMapper { IPage selectSkuPageList(Page page, @@ -22,7 +20,7 @@ public interface JdGoodsSkuMapper extends BaseMapper { @Param("skuId") Long skuId, @Param("outerId") String outerId, @Param("hasLink") Integer hasLink - ); + ); } diff --git a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/JdGoodsSkuService.java b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/JdGoodsSkuService.java index 0ee9345d..103822a0 100644 --- a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/JdGoodsSkuService.java +++ b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/JdGoodsSkuService.java @@ -2,6 +2,8 @@ package cn.qihangerp.module.open.jd.service; import cn.qihangerp.common.PageQuery; import cn.qihangerp.common.PageResult; +import cn.qihangerp.common.ResultVo; +import cn.qihangerp.domain.bo.LinkErpGoodsSkuBo; import cn.qihangerp.module.open.jd.domain.JdGoodsSku; import cn.qihangerp.module.open.jd.domain.bo.JdGoodsBo; import cn.qihangerp.module.open.jd.domain.vo.JdGoodsSkuListVo; @@ -14,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface JdGoodsSkuService extends IService { PageResult queryPageList(JdGoodsBo bo, PageQuery pageQuery); + ResultVo linkErpGoodsSku(LinkErpGoodsSkuBo bo); } diff --git a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdGoodsServiceImpl.java b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdGoodsServiceImpl.java index dadb971b..6d146966 100644 --- a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdGoodsServiceImpl.java +++ b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdGoodsServiceImpl.java @@ -71,8 +71,8 @@ public class JdGoodsServiceImpl extends ServiceImpl if(StringUtils.isNotEmpty(item.getOuterId())) { List oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper().eq(OGoodsSku::getSkuCode, item.getOuterId())); if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){ - item.setOGoodsId(oGoodsSkus.get(0).getGoodsId().toString()); - item.setOGoodsSkuId(Long.parseLong(oGoodsSkus.get(0).getId().toString())); + item.setErpGoodsId(oGoodsSkus.get(0).getGoodsId()); + item.setErpGoodsSkuId(oGoodsSkus.get(0).getId()); } } skuMapper.insert(item); @@ -92,8 +92,8 @@ public class JdGoodsServiceImpl extends ServiceImpl if(StringUtils.isNotEmpty(goodsSku.getOuterId())) { List oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper().eq(OGoodsSku::getSkuCode, goodsSku.getOuterId())); if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){ - goodsSku.setOGoodsId(oGoodsSkus.get(0).getGoodsId().toString()); - goodsSku.setOGoodsSkuId(Long.parseLong(oGoodsSkus.get(0).getId().toString())); + goodsSku.setErpGoodsId(oGoodsSkus.get(0).getGoodsId()); + goodsSku.setErpGoodsSkuId(oGoodsSkus.get(0).getId()); } } skuMapper.insert(goodsSku); @@ -104,8 +104,8 @@ public class JdGoodsServiceImpl extends ServiceImpl if(StringUtils.isNotEmpty(goodsSku.getOuterId())) { List oGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper().eq(OGoodsSku::getSkuCode, goodsSku.getOuterId())); if(oGoodsSkus!=null && !oGoodsSkus.isEmpty()){ - goodsSku.setOGoodsId(oGoodsSkus.get(0).getGoodsId().toString()); - goodsSku.setOGoodsSkuId(Long.parseLong(oGoodsSkus.get(0).getId().toString())); + goodsSku.setErpGoodsId(oGoodsSkus.get(0).getGoodsId()); + goodsSku.setErpGoodsSkuId(oGoodsSkus.get(0).getId()); } } goodsSku.setShopId(shopId); diff --git a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdGoodsSkuServiceImpl.java b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdGoodsSkuServiceImpl.java index f030d571..a6dffd4e 100644 --- a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdGoodsSkuServiceImpl.java +++ b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdGoodsSkuServiceImpl.java @@ -1,5 +1,13 @@ package cn.qihangerp.module.open.jd.service.impl; +import cn.qihangerp.common.ResultVo; +import cn.qihangerp.domain.bo.LinkErpGoodsSkuBo; +import cn.qihangerp.module.goods.domain.OGoodsSku; +import cn.qihangerp.module.goods.service.OGoodsSkuService; +import cn.qihangerp.module.open.jd.domain.JdGoods; +import cn.qihangerp.module.open.jd.mapper.JdGoodsMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.qihangerp.common.PageQuery; @@ -11,8 +19,11 @@ import cn.qihangerp.module.open.jd.service.JdGoodsSkuService; import cn.qihangerp.module.open.jd.mapper.JdGoodsSkuMapper; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; +import java.util.List; + /** * @author qilip * @description 针对表【jd_goods_sku】的数据库操作Service实现 @@ -23,6 +34,8 @@ import org.springframework.util.StringUtils; public class JdGoodsSkuServiceImpl extends ServiceImpl implements JdGoodsSkuService{ private final JdGoodsSkuMapper mapper; + private final JdGoodsMapper jdGoodsMapper; + private final OGoodsSkuService oGoodsSkuService; @Override public PageResult queryPageList(JdGoodsBo bo, PageQuery pageQuery) { if(StringUtils.hasText(bo.getOuterId())){ @@ -31,6 +44,33 @@ public class JdGoodsSkuServiceImpl extends ServiceImpl result = mapper.selectSkuPageList(pageQuery.build(), bo.getShopId(),bo.getWareId(),bo.getSkuId(),bo.getOuterId(),bo.getHasLink()); return PageResult.build(result); } + + @Transactional(rollbackFor = Exception.class) + @Override + public ResultVo linkErpGoodsSku(LinkErpGoodsSkuBo bo) { + OGoodsSku oGoodsSku = oGoodsSkuService.getById(bo.getErpGoodsSkuId()); + if(oGoodsSku == null) return ResultVo.error("未找到系统商品sku"); + JdGoodsSku taoGoodsSku = mapper.selectById(bo.getId()); + if(taoGoodsSku == null) { + return ResultVo.error("JD商品sku数据不存在"); + } + List jdGoods = jdGoodsMapper.selectList(new LambdaQueryWrapper().eq(JdGoods::getWareId, taoGoodsSku.getWareId())); + if(jdGoods==null||jdGoods.size()==0){ + return ResultVo.error("JD商品数据不存在"); + } + + JdGoodsSku sku = new JdGoodsSku(); + sku.setId(bo.getId()); + sku.setErpGoodsId(oGoodsSku.getGoodsId()); + sku.setErpGoodsSkuId(oGoodsSku.getId()); + mapper.updateById(sku); + + JdGoods goodsUp=new JdGoods(); + goodsUp.setId(jdGoods.get(0).getId()); + goodsUp.setErpGoodsId(oGoodsSku.getGoodsId()); + jdGoodsMapper.updateById(goodsUp); + return ResultVo.success(); + } } diff --git a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdOrderServiceImpl.java b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdOrderServiceImpl.java index ddaefb08..183ed7f0 100644 --- a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdOrderServiceImpl.java +++ b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdOrderServiceImpl.java @@ -113,10 +113,12 @@ public class JdOrderServiceImpl extends ServiceImpl // 添加item for (var item : order.getItems()) { - List pddGoodsSku = goodsSkuMapper.selectList(new LambdaQueryWrapper().eq(JdGoodsSku::getSkuId, item.getSkuId())); + List pddGoodsSku = goodsSkuMapper.selectList( + new LambdaQueryWrapper() + .eq(JdGoodsSku::getSkuId, item.getSkuId())); if (pddGoodsSku != null && !pddGoodsSku.isEmpty()) { - item.setoGoodsId(pddGoodsSku.get(0).getOGoodsId()); - item.setoGoodsSkuId(pddGoodsSku.get(0).getOGoodsSkuId()); + item.setoGoodsId(pddGoodsSku.get(0).getErpGoodsId().toString()); + item.setoGoodsSkuId(pddGoodsSku.get(0).getErpGoodsId()); } item.setOrderId(jdOrders.get(0).getId()); itemMapper.insert(item); @@ -158,8 +160,8 @@ public class JdOrderServiceImpl extends ServiceImpl for (var item : order.getItems()) { List pddGoodsSku = goodsSkuMapper.selectList(new LambdaQueryWrapper().eq(JdGoodsSku::getSkuId, item.getSkuId())); if (pddGoodsSku != null && !pddGoodsSku.isEmpty()) { - item.setoGoodsId(pddGoodsSku.get(0).getOGoodsId()); - item.setoGoodsSkuId(pddGoodsSku.get(0).getOGoodsSkuId()); + item.setoGoodsId(pddGoodsSku.get(0).getErpGoodsId().toString()); + item.setoGoodsSkuId(pddGoodsSku.get(0).getErpGoodsId()); } item.setOrderId(order.getId()); itemMapper.insert(item); diff --git a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdRefundServiceImpl.java b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdRefundServiceImpl.java index eef5b148..e2b526d6 100644 --- a/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdRefundServiceImpl.java +++ b/module/jd/src/main/java/cn/qihangerp/module/open/jd/service/impl/JdRefundServiceImpl.java @@ -80,8 +80,8 @@ public class JdRefundServiceImpl extends ServiceImpl } List jdGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper().eq(JdGoodsSku::getSkuId, after.getSkuId())); if(!jdGoodsSkus.isEmpty()){ - after.setOGoodsId(jdGoodsSkus.get(0).getOGoodsId()); - after.setOGoodsSkuId(jdGoodsSkus.get(0).getOGoodsSkuId()); + after.setOGoodsId(jdGoodsSkus.get(0).getErpGoodsId().toString()); + after.setOGoodsSkuId(jdGoodsSkus.get(0).getErpGoodsSkuId()); } }else { update.setServiceStatus(after.getServiceStatus()); @@ -126,8 +126,8 @@ public class JdRefundServiceImpl extends ServiceImpl } List jdGoodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper().eq(JdGoodsSku::getSkuId, after.getSkuId())); if(!jdGoodsSkus.isEmpty()){ - after.setOGoodsId(jdGoodsSkus.get(0).getOGoodsId()); - after.setOGoodsSkuId(jdGoodsSkus.get(0).getOGoodsSkuId()); + after.setOGoodsId(jdGoodsSkus.get(0).getErpGoodsId().toString()); + after.setOGoodsSkuId(jdGoodsSkus.get(0).getErpGoodsSkuId()); } } mapper.insert(after); diff --git a/module/jd/src/main/resources/mapper/jd/JdGoodsMapper.xml b/module/jd/src/main/resources/mapper/jd/JdGoodsMapper.xml index 0f403a53..1e368d47 100644 --- a/module/jd/src/main/resources/mapper/jd/JdGoodsMapper.xml +++ b/module/jd/src/main/resources/mapper/jd/JdGoodsMapper.xml @@ -6,16 +6,16 @@ - + - + - - - - + + + + @@ -32,10 +32,11 @@ - + + @@ -48,7 +49,7 @@ mobile_desc,introduction,after_sales, logo,market_price,cost_price, jd_price,brand_name,stock_num, - jd_shop_id,sell_point,after_sale_desc, - spu_id + sell_point,after_sale_desc,spu_id, + shop_id,erp_goods_id diff --git a/module/jd/src/main/resources/mapper/jd/JdGoodsSkuMapper.xml b/module/jd/src/main/resources/mapper/jd/JdGoodsSkuMapper.xml index 37b5d3c0..17cb386d 100644 --- a/module/jd/src/main/resources/mapper/jd/JdGoodsSkuMapper.xml +++ b/module/jd/src/main/resources/mapper/jd/JdGoodsSkuMapper.xml @@ -6,7 +6,6 @@ - @@ -20,18 +19,20 @@ - - + + + - id,goods_id,ware_id, - sku_id,status,jd_price, - outer_id,bar_code,logo, - sale_attrs,sku_name,stock_num, - modified,created,currency_spu_id, - o_goods_id,o_goods_sku_id + id,ware_id,sku_id, + status,jd_price,outer_id, + bar_code,logo,sale_attrs, + sku_name,stock_num,modified, + created,currency_spu_id,erp_goods_id, + erp_goods_sku_id,shop_id +