思迅商品同步
This commit is contained in:
parent
bc40ac66d6
commit
271ddfbb53
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
package com.suisung.mall.common.constant;
|
package com.suisung.mall.common.constant;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
|
||||||
public class CommonConstant {
|
public class CommonConstant {
|
||||||
|
|
||||||
public static final Integer Enable = 1; // 状态:1-有效;2-无效;0-无效
|
public static final Integer Enable = 1; // 状态:1-有效;2-无效;0-无效
|
||||||
@ -34,4 +36,7 @@ public class CommonConstant {
|
|||||||
public static final String STORE_RIGHT_GROUP_KF = "客服"; // 店铺管理员;
|
public static final String STORE_RIGHT_GROUP_KF = "客服"; // 店铺管理员;
|
||||||
public static final String STORE_RIGHT_GROUP_KZ1 = "扩展1"; // 店铺管理员;
|
public static final String STORE_RIGHT_GROUP_KZ1 = "扩展1"; // 店铺管理员;
|
||||||
public static final String STORE_RIGHT_GROUP_KZ2 = "扩展2"; // 店铺管理员;
|
public static final String STORE_RIGHT_GROUP_KZ2 = "扩展2"; // 店铺管理员;
|
||||||
|
|
||||||
|
public static final Integer PRODUCT_DATA_SOURCE_USER = 1;
|
||||||
|
public static final Integer PRODUCT_DATA_SOURCE_SX = 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,6 +74,12 @@ public class ShopBaseProductCategory implements Serializable {
|
|||||||
@ApiModelProperty(value = "PC页面编号")
|
@ApiModelProperty(value = "PC页面编号")
|
||||||
private Long page_id_pc;
|
private Long page_id_pc;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据来源:数据来源:1-自添加;2-思迅同步;")
|
||||||
|
private Integer data_source;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "店铺 Id,0表示公共的")
|
||||||
|
private String store_id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "子集数据")
|
@ApiModelProperty(value = "子集数据")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<ShopBaseProductCategory> sub;
|
private List<ShopBaseProductCategory> sub;
|
||||||
|
|||||||
@ -117,7 +117,7 @@ public class ShopProductBase implements Serializable {
|
|||||||
@ApiModelProperty(value = "平台佣金百分比")
|
@ApiModelProperty(value = "平台佣金百分比")
|
||||||
private BigDecimal product_commission_rate;
|
private BigDecimal product_commission_rate;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品来源(ENUM):1000-发布;1001-天猫;1002-淘宝;1003-阿里巴巴;1004-京东;")
|
@ApiModelProperty(value = "商品来源(ENUM):1000-发布;1001-天猫;1002-淘宝;1003-阿里巴巴;1004-京东;1005-思迅;")
|
||||||
private Integer product_from;
|
private Integer product_from;
|
||||||
|
|
||||||
@ApiModelProperty(value = "来源网址")
|
@ApiModelProperty(value = "来源网址")
|
||||||
|
|||||||
@ -48,8 +48,8 @@ public class SxSyncGoods implements Serializable {
|
|||||||
@ApiModelProperty(value = "商品条码")
|
@ApiModelProperty(value = "商品条码")
|
||||||
private String item_subno;
|
private String item_subno;
|
||||||
|
|
||||||
@ApiModelProperty(value = "大分类Id")
|
@ApiModelProperty(value = "小分类编号")
|
||||||
private String big_clsno;
|
private String item_clsno;
|
||||||
|
|
||||||
@ApiModelProperty(value = "大分类名称")
|
@ApiModelProperty(value = "大分类名称")
|
||||||
private String big_cls_name;
|
private String big_cls_name;
|
||||||
@ -78,6 +78,12 @@ public class SxSyncGoods implements Serializable {
|
|||||||
@ApiModelProperty(value = "会员价")
|
@ApiModelProperty(value = "会员价")
|
||||||
private BigDecimal vip_price;
|
private BigDecimal vip_price;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "允许积分")
|
||||||
|
private BigDecimal vip_acc_flag;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "积分值")
|
||||||
|
private BigDecimal vip_acc_num;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品状态")
|
@ApiModelProperty(value = "商品状态")
|
||||||
private Integer sale_flag;
|
private Integer sale_flag;
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.suisung.mall.common.domain.UserDto;
|
import com.suisung.mall.common.domain.UserDto;
|
||||||
import com.suisung.mall.common.modules.admin.ElTree;
|
import com.suisung.mall.common.modules.admin.ElTree;
|
||||||
import com.suisung.mall.common.modules.base.ShopBaseProductCategory;
|
import com.suisung.mall.common.modules.base.ShopBaseProductCategory;
|
||||||
|
import com.suisung.mall.common.modules.sixun.SxSyncCategory;
|
||||||
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
||||||
import com.suisung.mall.core.web.service.IBaseService;
|
import com.suisung.mall.core.web.service.IBaseService;
|
||||||
import com.suisung.mall.shop.base.req.ProductCategoryListReq;
|
import com.suisung.mall.shop.base.req.ProductCategoryListReq;
|
||||||
@ -108,4 +109,20 @@ public interface ShopBaseProductCategoryService extends IBaseService<ShopBasePro
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ProductCategoryFilterRes getCategoryFilter(Integer categoryId);
|
ProductCategoryFilterRes getCategoryFilter(Integer categoryId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把思迅的商品分类转出澜弛的商品分类
|
||||||
|
* @param sxSyncCategory
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ShopBaseProductCategory ConvSxCategoryToShopBaseProductCategory(SxSyncCategory sxSyncCategory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步思迅的商品分类到一个店铺的商品分类里
|
||||||
|
* @param storeId
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean syncSxCategoryToShopBaseProductCategory(String storeId, Integer pageNum, Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.suisung.mall.common.api.StateCode;
|
import com.suisung.mall.common.api.StateCode;
|
||||||
|
import com.suisung.mall.common.constant.CommonConstant;
|
||||||
import com.suisung.mall.common.constant.RedisConstant;
|
import com.suisung.mall.common.constant.RedisConstant;
|
||||||
import com.suisung.mall.common.domain.UserDto;
|
import com.suisung.mall.common.domain.UserDto;
|
||||||
import com.suisung.mall.common.exception.ApiException;
|
import com.suisung.mall.common.exception.ApiException;
|
||||||
@ -23,6 +24,7 @@ import com.suisung.mall.common.modules.distribution.ShopDistributionUser;
|
|||||||
import com.suisung.mall.common.modules.product.ShopProductImage;
|
import com.suisung.mall.common.modules.product.ShopProductImage;
|
||||||
import com.suisung.mall.common.modules.product.ShopProductIndex;
|
import com.suisung.mall.common.modules.product.ShopProductIndex;
|
||||||
import com.suisung.mall.common.modules.product.ShopProductItem;
|
import com.suisung.mall.common.modules.product.ShopProductItem;
|
||||||
|
import com.suisung.mall.common.modules.sixun.SxSyncCategory;
|
||||||
import com.suisung.mall.common.modules.store.ShopStoreActivityItem;
|
import com.suisung.mall.common.modules.store.ShopStoreActivityItem;
|
||||||
import com.suisung.mall.common.modules.user.ShopUserCart;
|
import com.suisung.mall.common.modules.user.ShopUserCart;
|
||||||
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
||||||
@ -45,6 +47,7 @@ import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
|||||||
import com.suisung.mall.shop.product.service.ShopProductImageService;
|
import com.suisung.mall.shop.product.service.ShopProductImageService;
|
||||||
import com.suisung.mall.shop.product.service.ShopProductIndexService;
|
import com.suisung.mall.shop.product.service.ShopProductIndexService;
|
||||||
import com.suisung.mall.shop.product.service.ShopProductItemService;
|
import com.suisung.mall.shop.product.service.ShopProductItemService;
|
||||||
|
import com.suisung.mall.shop.sixun.service.SxSyncCategoryService;
|
||||||
import com.suisung.mall.shop.store.service.ShopStoreActivityItemService;
|
import com.suisung.mall.shop.store.service.ShopStoreActivityItemService;
|
||||||
import com.suisung.mall.shop.user.service.ShopUserCartService;
|
import com.suisung.mall.shop.user.service.ShopUserCartService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -53,6 +56,7 @@ import org.springframework.cache.annotation.CacheEvict;
|
|||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -132,6 +136,9 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ShopBaseProductTypeService shopBaseProductTypeService;
|
private ShopBaseProductTypeService shopBaseProductTypeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SxSyncCategoryService sxSyncCategoryService;
|
||||||
|
|
||||||
private final String LANG = "zh_CN"; // todo 多语言动态
|
private final String LANG = "zh_CN"; // todo 多语言动态
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1108,6 +1115,62 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把思迅的商品分类转出澜弛的商品分类
|
||||||
|
*
|
||||||
|
* @param sxSyncCategory
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ShopBaseProductCategory ConvSxCategoryToShopBaseProductCategory(SxSyncCategory sxSyncCategory) {
|
||||||
|
if(sxSyncCategory==null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopBaseProductCategory output = new ShopBaseProductCategory();
|
||||||
|
output.setCategory_id(Convert.toInt(sxSyncCategory.getItem_clsno()));
|
||||||
|
output.setCategory_parent_id(Convert.toInt(sxSyncCategory.getCls_parent()));
|
||||||
|
output.setCategory_name(sxSyncCategory.getItem_clsname());
|
||||||
|
output.setCategory_order(sxSyncCategory.getItem_order());
|
||||||
|
output.setCategory_is_enable(sxSyncCategory.getDisplay_flag());
|
||||||
|
output.setData_source(CommonConstant.PRODUCT_DATA_SOURCE_SX);
|
||||||
|
output.setStore_id(sxSyncCategory.getStore_id());
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步思迅的商品分类到一个店铺的商品分类里
|
||||||
|
*
|
||||||
|
* @param storeId
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean syncSxCategoryToShopBaseProductCategory(String storeId, Integer pageNum, Integer pageSize) {
|
||||||
|
List<SxSyncCategory> sxCategoryList = sxSyncCategoryService.selectByStoreId(storeId, CommonConstant.Disable2, pageNum, pageSize).getRecords();
|
||||||
|
if (CollectionUtil.isEmpty(sxCategoryList)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Date now = new Date();
|
||||||
|
List<ShopBaseProductCategory> saveList = new ArrayList<>();
|
||||||
|
for (SxSyncCategory sxSyncCategory : sxCategoryList) {
|
||||||
|
saveList.add(ConvSxCategoryToShopBaseProductCategory(sxSyncCategory));
|
||||||
|
|
||||||
|
sxSyncCategory.setStatus(CommonConstant.Enable);
|
||||||
|
sxSyncCategory.setSync_time(now.getTime());
|
||||||
|
sxSyncCategory.setUpdated_at(now);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (saveOrUpdateBatch(saveList)) {
|
||||||
|
return sxSyncCategoryService.updateStatusBatch(sxCategoryList.stream().map(SxSyncCategory::getId).collect(Collectors.toList()), CommonConstant.Enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@CacheEvict(value = {"productCategoryTree", "productCategoryList", "pcLayoutData"}, allEntries = true)
|
@CacheEvict(value = {"productCategoryTree", "productCategoryList", "pcLayoutData"}, allEntries = true)
|
||||||
@Override
|
@Override
|
||||||
public boolean add(ShopBaseProductCategory a) {
|
public boolean add(ShopBaseProductCategory a) {
|
||||||
|
|||||||
@ -106,7 +106,7 @@ public class ShopProductBaseController extends BaseControllerImpl {
|
|||||||
@RequestParam(name = "productItems") String productItems) {
|
@RequestParam(name = "productItems") String productItems) {
|
||||||
if (StrUtil.isBlank(productObj) || StrUtil.isBlank(productItems))
|
if (StrUtil.isBlank(productObj) || StrUtil.isBlank(productItems))
|
||||||
return CommonResult.failed();
|
return CommonResult.failed();
|
||||||
return CommonResult.success(shopProductBaseService.saveProduct(productObj, productItems));
|
return CommonResult.success(shopProductBaseService.trySaveProduct(productObj, productItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "供应商分销复制产品", notes = "供应商分销复制产品")
|
@ApiOperation(value = "供应商分销复制产品", notes = "供应商分销复制产品")
|
||||||
|
|||||||
@ -108,7 +108,7 @@ public class ProductTempListener extends AnalysisEventListener<ProductTemp> {
|
|||||||
productItemList.add(productItemMap);
|
productItemList.add(productItemMap);
|
||||||
String productItems = JSONUtil.toJsonStr(productItemList);
|
String productItems = JSONUtil.toJsonStr(productItemList);
|
||||||
|
|
||||||
if (!shopProductBaseService.saveProduct(productObj, productItems)) {
|
if (!shopProductBaseService.trySaveProduct(productObj, productItems)) {
|
||||||
throw new ApiException(ResultCode.FAILED);
|
throw new ApiException(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import com.suisung.mall.common.pojo.dto.ProductRecommendDTO;
|
|||||||
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
import com.suisung.mall.common.pojo.dto.ProductSearchDTO;
|
||||||
import com.suisung.mall.core.web.service.IBaseService;
|
import com.suisung.mall.core.web.service.IBaseService;
|
||||||
import com.suisung.mall.shop.product.pojo.vo.ProductVo;
|
import com.suisung.mall.shop.product.pojo.vo.ProductVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -32,7 +31,7 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
|||||||
* @param productBase 商品SPU数据
|
* @param productBase 商品SPU数据
|
||||||
* @param productItems 商品SKU数据
|
* @param productItems 商品SKU数据
|
||||||
*/
|
*/
|
||||||
boolean saveProduct(String productBase, String productItems);
|
boolean trySaveProduct(String productBase, String productItems);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加商品,整理入库
|
* 添加商品,整理入库
|
||||||
@ -47,7 +46,7 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
|||||||
* @param virtual 虚拟商品信息
|
* @param virtual 虚拟商品信息
|
||||||
* @param assistIndices 辅助信息表
|
* @param assistIndices 辅助信息表
|
||||||
*/
|
*/
|
||||||
boolean saveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo productInfo, List<ShopProductItem> itemList, List<ShopProductImage> productImageList, ShopProductValidPeriod virtual, List<ShopProductAssistIndex> assistIndices);
|
boolean trySaveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo productInfo, List<ShopProductItem> itemList, List<ShopProductImage> productImageList, ShopProductValidPeriod virtual, List<ShopProductAssistIndex> assistIndices);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步添加供应商品
|
* 同步添加供应商品
|
||||||
@ -262,4 +261,13 @@ public interface ShopProductBaseService extends IBaseService<ShopProductBase> {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
boolean updateProductSubsite(Integer store_id);
|
boolean updateProductSubsite(Integer store_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步思迅的某个店铺的商品数据到澜弛商品系统
|
||||||
|
*
|
||||||
|
* @param storeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean syncSxGoodsToShopProductBase(String storeId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.api.ResultCode;
|
import com.suisung.mall.common.api.ResultCode;
|
||||||
import com.suisung.mall.common.api.StateCode;
|
import com.suisung.mall.common.api.StateCode;
|
||||||
|
import com.suisung.mall.common.constant.CommonConstant;
|
||||||
import com.suisung.mall.common.constant.ConfigConstant;
|
import com.suisung.mall.common.constant.ConfigConstant;
|
||||||
import com.suisung.mall.common.constant.MqConstant;
|
import com.suisung.mall.common.constant.MqConstant;
|
||||||
import com.suisung.mall.common.domain.UserDto;
|
import com.suisung.mall.common.domain.UserDto;
|
||||||
@ -30,6 +31,7 @@ import com.suisung.mall.common.modules.activity.ShopActivityGroupbooking;
|
|||||||
import com.suisung.mall.common.modules.base.*;
|
import com.suisung.mall.common.modules.base.*;
|
||||||
import com.suisung.mall.common.modules.order.ShopOrderItem;
|
import com.suisung.mall.common.modules.order.ShopOrderItem;
|
||||||
import com.suisung.mall.common.modules.product.*;
|
import com.suisung.mall.common.modules.product.*;
|
||||||
|
import com.suisung.mall.common.modules.sixun.SxSyncGoods;
|
||||||
import com.suisung.mall.common.modules.store.ShopStoreActivityBase;
|
import com.suisung.mall.common.modules.store.ShopStoreActivityBase;
|
||||||
import com.suisung.mall.common.modules.store.ShopStoreActivityItem;
|
import com.suisung.mall.common.modules.store.ShopStoreActivityItem;
|
||||||
import com.suisung.mall.common.modules.store.ShopStoreBase;
|
import com.suisung.mall.common.modules.store.ShopStoreBase;
|
||||||
@ -58,6 +60,7 @@ import com.suisung.mall.shop.order.service.ShopOrderItemService;
|
|||||||
import com.suisung.mall.shop.product.mapper.ShopProductBaseMapper;
|
import com.suisung.mall.shop.product.mapper.ShopProductBaseMapper;
|
||||||
import com.suisung.mall.shop.product.pojo.vo.ProductVo;
|
import com.suisung.mall.shop.product.pojo.vo.ProductVo;
|
||||||
import com.suisung.mall.shop.product.service.*;
|
import com.suisung.mall.shop.product.service.*;
|
||||||
|
import com.suisung.mall.shop.sixun.service.SxSyncGoodsService;
|
||||||
import com.suisung.mall.shop.store.service.*;
|
import com.suisung.mall.shop.store.service.*;
|
||||||
import com.suisung.mall.shop.user.service.*;
|
import com.suisung.mall.shop.user.service.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -69,10 +72,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
@ -231,10 +236,13 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ShopBaseLangMetaService shopBaseLangMetaService;
|
private ShopBaseLangMetaService shopBaseLangMetaService;
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class);
|
@Resource
|
||||||
|
private SxSyncGoodsService sxSyncGoodsService;
|
||||||
|
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(ShopProductBaseServiceImpl.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveProduct(String productObj, String productItems) {
|
public boolean trySaveProduct(String productObj, String productItems) {
|
||||||
|
|
||||||
List<Map> productItemMaps = JSONUtil.toList(JSONUtil.parseArray(productItems), Map.class);
|
List<Map> productItemMaps = JSONUtil.toList(JSONUtil.parseArray(productItems), Map.class);
|
||||||
Map<String, Object> productObjMap = JSONUtil.toBean(productObj, Map.class);
|
Map<String, Object> productObjMap = JSONUtil.toBean(productObj, Map.class);
|
||||||
@ -364,7 +372,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
// product_assist_data // 辅助属性值列(DOT)
|
// product_assist_data // 辅助属性值列(DOT)
|
||||||
|
|
||||||
if (StringUtils.isEmpty(product_transport_id)) {
|
if (StringUtils.isEmpty(product_transport_id)) {
|
||||||
shopProductIndex.setProduct_transport_id("10");
|
shopProductIndex.setProduct_transport_id(String.valueOf(StateCode.DELIVERY_TYPE_EXP));
|
||||||
} else {
|
} else {
|
||||||
shopProductIndex.setProduct_transport_id(product_transport_id);
|
shopProductIndex.setProduct_transport_id(product_transport_id);
|
||||||
}
|
}
|
||||||
@ -440,11 +448,8 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
productInfo.setProduct_buy_limit(product_buy_limit);
|
productInfo.setProduct_buy_limit(product_buy_limit);
|
||||||
|
|
||||||
//用来判断是否使用
|
//用来判断是否使用
|
||||||
|
|
||||||
|
|
||||||
cn.hutool.json.JSONArray spec_array = cn.hutool.json.JSONUtil.parseArray(productObjMap.get("productSpec"));
|
cn.hutool.json.JSONArray spec_array = cn.hutool.json.JSONUtil.parseArray(productObjMap.get("productSpec"));
|
||||||
List<Integer> spec_id_row = new ArrayList<>();
|
List<Integer> spec_id_row = new ArrayList<>();
|
||||||
|
|
||||||
for (Object spec_jo : spec_array) {
|
for (Object spec_jo : spec_array) {
|
||||||
cn.hutool.json.JSONObject item = (cn.hutool.json.JSONObject) spec_jo;
|
cn.hutool.json.JSONObject item = (cn.hutool.json.JSONObject) spec_jo;
|
||||||
Integer id = Convert.toInt(item.get("id"));
|
Integer id = Convert.toInt(item.get("id"));
|
||||||
@ -681,11 +686,24 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
cn.hutool.json.JSONArray assistsIndex = (cn.hutool.json.JSONArray) productObjMap.get("assistsIndex");
|
cn.hutool.json.JSONArray assistsIndex = (cn.hutool.json.JSONArray) productObjMap.get("assistsIndex");
|
||||||
List<ShopProductAssistIndex> assistIndices = JSONUtil.toList(assistsIndex, ShopProductAssistIndex.class);
|
List<ShopProductAssistIndex> assistIndices = JSONUtil.toList(assistsIndex, ShopProductAssistIndex.class);
|
||||||
|
|
||||||
return saveProduct(shopProductBase, shopProductIndex, shopProductData, shopProductDetail, productInfo, itemList, productImageList, virtual, assistIndices);
|
return trySaveProduct(shopProductBase, shopProductIndex, shopProductData, shopProductDetail, productInfo, itemList, productImageList, virtual, assistIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean saveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo productInfo, List<ShopProductItem> itemList, List<ShopProductImage> productImageList, ShopProductValidPeriod virtual, List<ShopProductAssistIndex> assistIndices) {
|
/**
|
||||||
|
* 尝试保存一个商品所有信息
|
||||||
|
*
|
||||||
|
* @param shopProductBase 商品基础表信息
|
||||||
|
* @param shopProductIndex 商品索引表信息
|
||||||
|
* @param shopProductData 商品数据表信息
|
||||||
|
* @param shopProductDetail 商品详情表信息
|
||||||
|
* @param shopProductInfo 商品信息表信息
|
||||||
|
* @param shopProductItemList 商品SKU信息
|
||||||
|
* @param shopProductImageList 商品图片信息
|
||||||
|
* @param shopProductValidPeriod 虚拟商品信息
|
||||||
|
* @param shopProductAssistIndexList 辅助信息表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean trySaveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo shopProductInfo, List<ShopProductItem> shopProductItemList, List<ShopProductImage> shopProductImageList, ShopProductValidPeriod shopProductValidPeriod, List<ShopProductAssistIndex> shopProductAssistIndexList) {
|
||||||
Integer store_id = shopProductBase.getStore_id();
|
Integer store_id = shopProductBase.getStore_id();
|
||||||
ShopStoreBase storeBase = null;
|
ShopStoreBase storeBase = null;
|
||||||
if (store_id == null) {
|
if (store_id == null) {
|
||||||
@ -765,7 +783,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
// 判断审核状态
|
// 判断审核状态
|
||||||
if (!verify_type) {
|
if (!verify_type) {
|
||||||
// 判断item状态,决定spu状态
|
// 判断item状态,决定spu状态
|
||||||
for (ShopProductItem item : itemList) {
|
for (ShopProductItem item : shopProductItemList) {
|
||||||
Integer item_enable = item.getItem_enable();
|
Integer item_enable = item.getItem_enable();
|
||||||
if (ObjectUtil.equal(item_enable, StateCode.PRODUCT_STATE_NORMAL)) {
|
if (ObjectUtil.equal(item_enable, StateCode.PRODUCT_STATE_NORMAL)) {
|
||||||
shopProductBase.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL);
|
shopProductBase.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL);
|
||||||
@ -780,24 +798,24 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
if (kind_id != StateCode.PRODUCT_KIND_ENTITY) {
|
if (kind_id != StateCode.PRODUCT_KIND_ENTITY) {
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
for (ShopProductItem s : itemList) {
|
for (ShopProductItem s : shopProductItemList) {
|
||||||
s.setItem_unit_points(ObjectUtil.defaultIfNull(s.getItem_unit_points(), BigDecimal.ZERO));
|
s.setItem_unit_points(ObjectUtil.defaultIfNull(s.getItem_unit_points(), BigDecimal.ZERO));
|
||||||
s.setItem_market_price(ObjectUtil.defaultIfNull(s.getItem_market_price(), BigDecimal.ZERO));
|
s.setItem_market_price(ObjectUtil.defaultIfNull(s.getItem_market_price(), BigDecimal.ZERO));
|
||||||
s.setItem_unit_sp(ObjectUtil.defaultIfNull(s.getItem_unit_sp(), BigDecimal.ZERO));
|
s.setItem_unit_sp(ObjectUtil.defaultIfNull(s.getItem_unit_sp(), BigDecimal.ZERO));
|
||||||
s.setItem_unit_price(ObjectUtil.defaultIfNull(s.getItem_unit_price(), BigDecimal.ZERO));
|
s.setItem_unit_price(ObjectUtil.defaultIfNull(s.getItem_unit_price(), BigDecimal.ZERO));
|
||||||
}
|
}
|
||||||
BigDecimal item_unit_price = itemList.stream().map(ShopProductItem::getItem_unit_price).min(BigDecimal::compareTo).get();
|
BigDecimal item_unit_price = shopProductItemList.stream().map(ShopProductItem::getItem_unit_price).min(BigDecimal::compareTo).get();
|
||||||
BigDecimal item_unit_price_max = itemList.stream().map(ShopProductItem::getItem_unit_price).max(BigDecimal::compareTo).get();
|
BigDecimal item_unit_price_max = shopProductItemList.stream().map(ShopProductItem::getItem_unit_price).max(BigDecimal::compareTo).get();
|
||||||
BigDecimal item_unit_points = itemList.stream().map(ShopProductItem::getItem_unit_points).min(BigDecimal::compareTo).get();
|
BigDecimal item_unit_points = shopProductItemList.stream().map(ShopProductItem::getItem_unit_points).min(BigDecimal::compareTo).get();
|
||||||
BigDecimal item_unit_sp = itemList.stream().map(ShopProductItem::getItem_unit_sp).min(BigDecimal::compareTo).get();
|
BigDecimal item_unit_sp = shopProductItemList.stream().map(ShopProductItem::getItem_unit_sp).min(BigDecimal::compareTo).get();
|
||||||
|
|
||||||
shopProductBase.setProduct_unit_price(item_unit_price);
|
shopProductBase.setProduct_unit_price(item_unit_price);
|
||||||
shopProductBase.setProduct_unit_points(item_unit_points);
|
shopProductBase.setProduct_unit_points(item_unit_points);
|
||||||
shopProductBase.setProduct_unit_sp(item_unit_sp.intValue());
|
shopProductBase.setProduct_unit_sp(item_unit_sp.intValue());
|
||||||
|
|
||||||
// todo 定制可以增加市场价 item_market_price
|
// todo 定制可以增加市场价 item_market_price
|
||||||
BigDecimal max_item_unit_price = itemList.stream().map(ShopProductItem::getItem_unit_price).max(BigDecimal::compareTo).get();
|
BigDecimal max_item_unit_price = shopProductItemList.stream().map(ShopProductItem::getItem_unit_price).max(BigDecimal::compareTo).get();
|
||||||
BigDecimal max_item_market_price = itemList.stream().map(ShopProductItem::getItem_market_price).max(BigDecimal::compareTo).get();
|
BigDecimal max_item_market_price = shopProductItemList.stream().map(ShopProductItem::getItem_market_price).max(BigDecimal::compareTo).get();
|
||||||
BigDecimal product_market_price = NumberUtil.max(max_item_unit_price, max_item_market_price);
|
BigDecimal product_market_price = NumberUtil.max(max_item_unit_price, max_item_market_price);
|
||||||
shopProductBase.setProduct_market_price(product_market_price);
|
shopProductBase.setProduct_market_price(product_market_price);
|
||||||
|
|
||||||
@ -808,8 +826,8 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
Long productId = shopProductBase.getProduct_id();
|
Long productId = shopProductBase.getProduct_id();
|
||||||
// 商品辅助属性
|
// 商品辅助属性
|
||||||
List<String> assistItemList = new ArrayList<>();
|
List<String> assistItemList = new ArrayList<>();
|
||||||
if (CollUtil.isNotEmpty(assistIndices)) {
|
if (CollUtil.isNotEmpty(shopProductAssistIndexList)) {
|
||||||
for (ShopProductAssistIndex assistIndex : assistIndices) {
|
for (ShopProductAssistIndex assistIndex : shopProductAssistIndexList) {
|
||||||
if (StringUtils.isNotBlank(assistIndex.getAssist_item_id())) {
|
if (StringUtils.isNotBlank(assistIndex.getAssist_item_id())) {
|
||||||
assistItemList.add(assistIndex.getAssist_item_id());
|
assistItemList.add(assistIndex.getAssist_item_id());
|
||||||
String product_assist_index_id = productId + "-" + assistIndex.getAssist_id();
|
String product_assist_index_id = productId + "-" + assistIndex.getAssist_id();
|
||||||
@ -845,7 +863,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
shopProductIndex.setStore_is_selfsupport(storeBase.getStore_is_selfsupport());
|
shopProductIndex.setStore_is_selfsupport(storeBase.getStore_is_selfsupport());
|
||||||
shopProductIndex.setStore_type(storeBase.getStore_type());
|
shopProductIndex.setStore_type(storeBase.getStore_type());
|
||||||
shopProductIndex.setSubsite_id(storeBase.getSubsite_id());
|
shopProductIndex.setSubsite_id(storeBase.getSubsite_id());
|
||||||
shopProductIndex.setProduct_number(productInfo.getProduct_number());
|
shopProductIndex.setProduct_number(shopProductInfo.getProduct_number());
|
||||||
|
|
||||||
// 判断商品货号是否唯一
|
// 判断商品货号是否唯一
|
||||||
String product_number = shopProductIndex.getProduct_number();
|
String product_number = shopProductIndex.getProduct_number();
|
||||||
@ -853,7 +871,6 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
QueryWrapper<ShopProductIndex> indexQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<ShopProductIndex> indexQueryWrapper = new QueryWrapper<>();
|
||||||
indexQueryWrapper.eq("product_number", product_number);
|
indexQueryWrapper.eq("product_number", product_number);
|
||||||
ShopProductIndex temp_info_row = shopProductIndexService.findOne(indexQueryWrapper);
|
ShopProductIndex temp_info_row = shopProductIndexService.findOne(indexQueryWrapper);
|
||||||
|
|
||||||
if (temp_info_row != null && !ObjectUtil.equal(temp_info_row.getProduct_id(), productId)) {
|
if (temp_info_row != null && !ObjectUtil.equal(temp_info_row.getProduct_id(), productId)) {
|
||||||
// 商品货号已经存在,不可重
|
// 商品货号已经存在,不可重
|
||||||
throw new ApiException(I18nUtil._("商品货号已经存在,不可重复!"));
|
throw new ApiException(I18nUtil._("商品货号已经存在,不可重复!"));
|
||||||
@ -886,7 +903,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
List<Long> product_image_id_now_row = new ArrayList<>();
|
List<Long> product_image_id_now_row = new ArrayList<>();
|
||||||
for (ShopProductImage product_image_row : product_image_rows) {
|
for (ShopProductImage product_image_row : product_image_rows) {
|
||||||
|
|
||||||
for (ShopProductImage image_row : productImageList) {
|
for (ShopProductImage image_row : shopProductImageList) {
|
||||||
Long color_id = image_row.getColor_id();
|
Long color_id = image_row.getColor_id();
|
||||||
Long _color_id = product_image_row.getColor_id();
|
Long _color_id = product_image_row.getColor_id();
|
||||||
if (ObjectUtil.equal(color_id, _color_id)) {
|
if (ObjectUtil.equal(color_id, _color_id)) {
|
||||||
@ -927,7 +944,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ShopProductImage image_row : productImageList) {
|
for (ShopProductImage image_row : shopProductImageList) {
|
||||||
//添加新的
|
//添加新的
|
||||||
if (CheckUtil.isEmpty(image_row.getProduct_image_id()) && CheckUtil.isNotEmpty(image_row.getItem_image_default())) {
|
if (CheckUtil.isEmpty(image_row.getProduct_image_id()) && CheckUtil.isNotEmpty(image_row.getItem_image_default())) {
|
||||||
add_baidu_image_row.add(image_row.getItem_image_default());
|
add_baidu_image_row.add(image_row.getItem_image_default());
|
||||||
@ -953,7 +970,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
// 读取商品基础数据, 为了判断是否为分销供应商商品
|
// 读取商品基础数据, 为了判断是否为分销供应商商品
|
||||||
Map product_uniqid = new HashMap();
|
Map product_uniqid = new HashMap();
|
||||||
ShopProductBase product_base_row = get(product_id);
|
ShopProductBase product_base_row = get(product_id);
|
||||||
for (ShopProductItem item_row : itemList) {
|
for (ShopProductItem item_row : shopProductItemList) {
|
||||||
item_row.setProduct_id(productId);
|
item_row.setProduct_id(productId);
|
||||||
item_row.setCategory_id(shopProductIndex.getCategory_id());
|
item_row.setCategory_id(shopProductIndex.getCategory_id());
|
||||||
item_row.setStore_id(shopProductBase.getStore_id());
|
item_row.setStore_id(shopProductBase.getStore_id());
|
||||||
@ -1031,7 +1048,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
product_uniqid.put(sku_uniqid, sku_uniqid_list);
|
product_uniqid.put(sku_uniqid, sku_uniqid_list);
|
||||||
|
|
||||||
if (kind_id == StateCode.PRODUCT_KIND_EDU) {
|
if (kind_id == StateCode.PRODUCT_KIND_EDU) {
|
||||||
Optional<ShopProductImage> imageOptional = productImageList.stream().filter(s -> ObjectUtil.equal(s.getColor_id(), item_row.getColor_id())).findFirst();
|
Optional<ShopProductImage> imageOptional = shopProductImageList.stream().filter(s -> ObjectUtil.equal(s.getColor_id(), item_row.getColor_id())).findFirst();
|
||||||
ShopProductImage image = imageOptional.orElseGet(ShopProductImage::new);
|
ShopProductImage image = imageOptional.orElseGet(ShopProductImage::new);
|
||||||
|
|
||||||
sku_uniqid_list.add(3, item_row.getItem_title());
|
sku_uniqid_list.add(3, item_row.getItem_title());
|
||||||
@ -1064,16 +1081,16 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
//start 清理sku相关数据
|
//start 清理sku相关数据
|
||||||
|
|
||||||
// info
|
// info
|
||||||
productInfo.setProduct_id(productId);
|
shopProductInfo.setProduct_id(productId);
|
||||||
productInfo.setProduct_uniqid(JSONUtil.toJsonStr(product_uniqid));
|
shopProductInfo.setProduct_uniqid(JSONUtil.toJsonStr(product_uniqid));
|
||||||
if (!shopProductInfoService.saveOrUpdate(productInfo)) {
|
if (!shopProductInfoService.saveOrUpdate(shopProductInfo)) {
|
||||||
throw new ApiException(ResultCode.FAILED);
|
throw new ApiException(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
if (virtual != null) {
|
if (shopProductValidPeriod != null) {
|
||||||
virtual.setProduct_id(productId);
|
shopProductValidPeriod.setProduct_id(productId);
|
||||||
if (!validPeriodService.saveOrUpdate(virtual)) {
|
if (!validPeriodService.saveOrUpdate(shopProductValidPeriod)) {
|
||||||
throw new ApiException(ResultCode.FAILED);
|
throw new ApiException(ResultCode.FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2823,10 +2840,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
cond_row.ne("product_src_id", 0);
|
cond_row.ne("product_src_id", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean supplier_market_flag = false;
|
boolean supplier_market_flag = ObjectUtil.equal(store_type, 2) && ObjectUtil.equal(product_fx_enable, 1);
|
||||||
if (ObjectUtil.equal(store_type, 2) && ObjectUtil.equal(product_fx_enable, 1)) {
|
|
||||||
supplier_market_flag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getCurrentUser().isPlatform()) {
|
if (!getCurrentUser().isPlatform()) {
|
||||||
|
|
||||||
@ -3214,7 +3228,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
wrapper.eq("subsite_id", subsite_id);
|
wrapper.eq("subsite_id", subsite_id);
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(day_flag) && day_flag) {
|
if (ObjectUtil.isNotNull(day_flag) && day_flag) {
|
||||||
wrapper.gt("product_add_time", DateUtil.current() - 3600 * 24 * 1 * 1000);
|
wrapper.gt("product_add_time", DateUtil.current() - 3600 * 24 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return shopProductIndexService.count(wrapper);
|
return shopProductIndexService.count(wrapper);
|
||||||
@ -3795,7 +3809,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
List<Map> product_analytics_rows = new ArrayList<>();
|
List<Map> product_analytics_rows = new ArrayList<>();
|
||||||
// 是否启用评论
|
// 是否启用评论
|
||||||
Boolean evaluation_enable = accountBaseConfigService.getConfig("evaluation_enable", false);
|
Boolean evaluation_enable = accountBaseConfigService.getConfig("evaluation_enable", false);
|
||||||
if (evaluation_enable || true) {
|
if (true) {
|
||||||
product_analytics_rows = shopProductAnalyticsService.getAnalytics(product_id_row);
|
product_analytics_rows = shopProductAnalyticsService.getAnalytics(product_id_row);
|
||||||
}
|
}
|
||||||
if (isNotFromCatagory) {
|
if (isNotFromCatagory) {
|
||||||
@ -3988,7 +4002,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
String item_spec_name = StrUtil.join(" ", item_name.split(","));
|
String item_spec_name = StrUtil.join(" ", item_name.split(","));
|
||||||
item_row.put("item_spec_name", item_spec_name);
|
item_row.put("item_spec_name", item_spec_name);
|
||||||
String product_name = Convert.toStr(item_row.get("product_name"));
|
String product_name = Convert.toStr(item_row.get("product_name"));
|
||||||
item_row.put("product_item_name", product_name + "" + item_name);
|
item_row.put("product_item_name", product_name + item_name);
|
||||||
item_row.put("item_sale_price", item_row.get("item_unit_price")); // todo pricessadsadasda
|
item_row.put("item_sale_price", item_row.get("item_unit_price")); // todo pricessadsadasda
|
||||||
|
|
||||||
// 是否虚拟
|
// 是否虚拟
|
||||||
@ -4130,7 +4144,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
int item_quantity = Integer.valueOf(StrUtil.isBlank(item_data.get("item_quantity").toString()) ? 1 : Integer.valueOf(item_data.get("item_quantity").toString()));
|
int item_quantity = Integer.valueOf(StrUtil.isBlank(item_data.get("item_quantity").toString()) ? 1 : Integer.valueOf(item_data.get("item_quantity").toString()));
|
||||||
item_data.put("activity_quantity", item_quantity);
|
item_data.put("activity_quantity", item_quantity);
|
||||||
BigDecimal item_unit_price = Convert.toBigDecimal(item_data.get("item_unit_price"), BigDecimal.valueOf(0));
|
BigDecimal item_unit_price = Convert.toBigDecimal(item_data.get("item_unit_price"), BigDecimal.valueOf(0));
|
||||||
item_data.put("activity_item_old_price", item_unit_price.multiply(BigDecimal.valueOf(item_quantity)).setScale(2, BigDecimal.ROUND_HALF_UP));
|
item_data.put("activity_item_old_price", item_unit_price.multiply(BigDecimal.valueOf(item_quantity)).setScale(2, RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
|
|
||||||
activity_item_row.put("reduction_item_data", product_item_data);
|
activity_item_row.put("reduction_item_data", product_item_data);
|
||||||
@ -4271,7 +4285,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
item_data.put("activity_quantity", item_quantity);
|
item_data.put("activity_quantity", item_quantity);
|
||||||
BigDecimal item_unit_price = Convert.toBigDecimal(item_data.get("item_unit_price"), BigDecimal.valueOf(0));
|
BigDecimal item_unit_price = Convert.toBigDecimal(item_data.get("item_unit_price"), BigDecimal.valueOf(0));
|
||||||
|
|
||||||
BigDecimal activity_item_old_price = item_unit_price.multiply(item_quantity).setScale(2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal activity_item_old_price = item_unit_price.multiply(item_quantity).setScale(2, RoundingMode.HALF_UP);
|
||||||
item_data.put("activity_item_old_price", activity_item_old_price);
|
item_data.put("activity_item_old_price", activity_item_old_price);
|
||||||
|
|
||||||
activity_old_price = activity_old_price.add(activity_item_old_price);
|
activity_old_price = activity_old_price.add(activity_item_old_price);
|
||||||
@ -4424,7 +4438,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
// 是否可以放入购物车
|
// 是否可以放入购物车
|
||||||
item_row.put("if_cart", 1);
|
item_row.put("if_cart", 1);
|
||||||
item_row.put("category_id", product_index_row.getCategory_id());
|
item_row.put("category_id", product_index_row.getCategory_id());
|
||||||
if (evaluation_enable || true) {
|
if (true) {
|
||||||
Optional<Map> analyticsOpl = product_analytics_rows.stream().filter(s -> ObjectUtil.equal(product_id, Convert.toLong(s.get("product_id")))).findFirst();
|
Optional<Map> analyticsOpl = product_analytics_rows.stream().filter(s -> ObjectUtil.equal(product_id, Convert.toLong(s.get("product_id")))).findFirst();
|
||||||
Map analytics = analyticsOpl.orElseGet(HashMap::new);
|
Map analytics = analyticsOpl.orElseGet(HashMap::new);
|
||||||
item_row.put("analytics_row", analytics);
|
item_row.put("analytics_row", analytics);
|
||||||
@ -5084,6 +5098,129 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步思迅的某个店铺的商品数据到澜弛商品系统
|
||||||
|
*
|
||||||
|
* @param storeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean syncSxGoodsToShopProductBase(String storeId) {
|
||||||
|
Long total = sxSyncGoodsService.countByStoreId(storeId, CommonConstant.Disable2);
|
||||||
|
Integer pageSize = 100;
|
||||||
|
Integer pages = com.suisung.mall.shop.sixun.utils.CommonUtil.getPagesCount(total.intValue(), pageSize);
|
||||||
|
|
||||||
|
for (int i = 1; i <= pages; i++) {
|
||||||
|
List<SxSyncGoods> goodsList = sxSyncGoodsService.pageByStoreId(storeId, CommonConstant.Disable2, i, pageSize).getRecords();
|
||||||
|
if (CollectionUtil.isEmpty(goodsList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//shopProductBase, shopProductIndex, shopProductData, shopProductDetail, productInfo, itemList, productImageList, virtual, assistIndices
|
||||||
|
for (SxSyncGoods sxSyncGoods : goodsList) {
|
||||||
|
Date currentDate = new Date();
|
||||||
|
|
||||||
|
Integer categoryId = Convert.toInt(sxSyncGoods.getItem_clsno(), 0);
|
||||||
|
Integer storeIdInt = Convert.toInt(storeId);
|
||||||
|
ShopStoreBase store_row = shopStoreBaseService.get(storeIdInt);
|
||||||
|
if (store_row == null) {
|
||||||
|
throw new ApiException(I18nUtil._("无法获取店铺信息!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopProductBase shopProductBase = new ShopProductBase();
|
||||||
|
shopProductBase.setProduct_sale_time(Convert.toDate(DateUtil.current() + 600)); //10分钟
|
||||||
|
shopProductBase.setProduct_name(sxSyncGoods.getItem_subname());
|
||||||
|
shopProductBase.setProduct_tips("");
|
||||||
|
shopProductBase.setStore_id(storeIdInt);
|
||||||
|
shopProductBase.setStore_name(store_row.getStore_name());
|
||||||
|
shopProductBase.setProduct_video("");
|
||||||
|
shopProductBase.setTransport_type_id(StateCode.DELIVERY_TYPE_SAME_CITY);
|
||||||
|
shopProductBase.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL);
|
||||||
|
shopProductBase.setProduct_inventory_lock(1002); //库存锁定(ENUM):1001-下单锁定;1002-支付锁定;
|
||||||
|
shopProductBase.setProduct_fx_enable(0); // 供应商是否允许批发市场分销
|
||||||
|
shopProductBase.setProduct_dist_enable(0); // 是否允许三级分销
|
||||||
|
shopProductBase.setProduct_from(1005);// 商品来源(ENUM):1000-发布;1001-天猫;1002-淘宝;1003-阿里巴巴;1004-京东;1005-思迅;
|
||||||
|
shopProductBase.setProduct_add_time(currentDate.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
// ShopProductIndex
|
||||||
|
ShopProductIndex shopProductIndex = new ShopProductIndex();
|
||||||
|
shopProductIndex.setProduct_add_time(currentDate.getTime());
|
||||||
|
shopProductIndex.setProduct_sale_time(DateUtil.current() + 600); //10分钟
|
||||||
|
shopProductIndex.setStore_category_ids(""); // 店铺分类编号(DOT)
|
||||||
|
shopProductIndex.setProduct_tags("");// 商品标签(DOT)
|
||||||
|
shopProductIndex.setBrand_id(0);
|
||||||
|
shopProductIndex.setProduct_name(shopProductBase.getProduct_name()); // 产品名称:店铺平台先在对用表中检索后通过id检索,检索使用
|
||||||
|
shopProductIndex.setProduct_name_index(shopProductIndex.getProduct_name()); // 名称索引关键字(DOT)
|
||||||
|
shopProductIndex.setCategory_id(categoryId); // 商品分类
|
||||||
|
shopProductIndex.setProduct_fx_enable(0); // 供应商是否允许批发市场分销
|
||||||
|
shopProductIndex.setProduct_dist_enable(0); // 是否允许三级分销
|
||||||
|
shopProductIndex.setStore_id(storeIdInt);
|
||||||
|
shopProductIndex.setStore_type(store_row.getStore_type());
|
||||||
|
shopProductIndex.setKind_id(StateCode.PRODUCT_KIND_ENTITY);// 实体商品
|
||||||
|
shopProductIndex.setStore_is_open(store_row.getStore_is_open());
|
||||||
|
shopProductIndex.setStore_is_selfsupport(store_row.getStore_is_selfsupport());
|
||||||
|
shopProductIndex.setStore_longitude(store_row.getStore_longitude());
|
||||||
|
shopProductIndex.setStore_latitude(store_row.getStore_latitude());
|
||||||
|
|
||||||
|
shopProductIndex.setCard_type_id(0);
|
||||||
|
shopProductIndex.setVoucher_activity_id("");
|
||||||
|
shopProductIndex.setCoupon_type_id(0);// product_assist_data // 辅助属性值列(DOT)
|
||||||
|
shopProductIndex.setProduct_transport_id(String.valueOf(StateCode.DELIVERY_TYPE_SAME_CITY));
|
||||||
|
|
||||||
|
ShopBaseProductCategory category_row = productCategoryService.get(categoryId);
|
||||||
|
if (ObjectUtil.isNotEmpty(category_row)) {
|
||||||
|
Integer type_id = category_row.getType_id();
|
||||||
|
shopProductIndex.setType_id(type_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// shop_product_data
|
||||||
|
ShopProductData shopProductData = new ShopProductData();
|
||||||
|
// product_id // 产品id
|
||||||
|
shopProductData.setProduct_edit_time(currentDate);
|
||||||
|
|
||||||
|
// shop_product_detail
|
||||||
|
ShopProductDetail shopProductDetail = new ShopProductDetail();
|
||||||
|
shopProductDetail.setProduct_detail("");
|
||||||
|
shopProductDetail.setProduct_param("");
|
||||||
|
shopProductDetail.setProduct_service("");
|
||||||
|
shopProductDetail.setProduct_tags("");
|
||||||
|
|
||||||
|
// shop_product_info
|
||||||
|
ShopProductInfo shopProductInfo = new ShopProductInfo();
|
||||||
|
shopProductInfo.setProduct_number(sxSyncGoods.getItem_no());// SPU商家编码:货号
|
||||||
|
shopProductInfo.setProduct_assist("");
|
||||||
|
shopProductInfo.setProduct_spec("");
|
||||||
|
shopProductInfo.setProduct_buy_limit(0); // 没人限购
|
||||||
|
//商品规格
|
||||||
|
shopProductInfo.setSpec_ids("");
|
||||||
|
|
||||||
|
List<ShopProductItem> shopProductItemList = new ArrayList<>();
|
||||||
|
ShopProductItem shopProductItem = new ShopProductItem();
|
||||||
|
shopProductItem.setStore_id(storeIdInt);
|
||||||
|
shopProductItem.setCategory_id(categoryId);
|
||||||
|
shopProductItem.setItem_unit_price(sxSyncGoods.getPrice());
|
||||||
|
shopProductItem.setItem_advice_price(sxSyncGoods.getSale_price());
|
||||||
|
shopProductItem.setItem_market_price(sxSyncGoods.getVip_price());
|
||||||
|
shopProductItem.setItem_unit_points(sxSyncGoods.getVip_acc_num());
|
||||||
|
shopProductItem.setItem_quantity(sxSyncGoods.getStock().intValue()); // 库存
|
||||||
|
shopProductItem.setItem_quantity_frozen(0);
|
||||||
|
shopProductItem.setItem_number(sxSyncGoods.getItem_no());// SKU商家编码
|
||||||
|
shopProductItem.setItem_barcode(sxSyncGoods.getItem_no()); // 条形码正常情况下就是货号
|
||||||
|
shopProductItem.setItem_is_default(1);
|
||||||
|
shopProductItem.setItem_enable(1);
|
||||||
|
|
||||||
|
shopProductItemList.add(shopProductItem);
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
trySaveProduct(shopProductBase, shopProductIndex, shopProductData, shopProductDetail, shopProductInfo, shopProductItemList, new ArrayList<ShopProductImage>(), new ShopProductValidPeriod(), new ArrayList<ShopProductAssistIndex>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String initProductLangIndex(Long productId, String productNameIndex) {
|
public String initProductLangIndex(Long productId, String productNameIndex) {
|
||||||
QueryWrapper<ShopBaseLangMeta> queryParams = new QueryWrapper<>();
|
QueryWrapper<ShopBaseLangMeta> queryParams = new QueryWrapper<>();
|
||||||
queryParams.eq("table_name", "shop_product_base");
|
queryParams.eq("table_name", "shop_product_base");
|
||||||
|
|||||||
@ -10,6 +10,8 @@ package com.suisung.mall.shop.sixun.controller;
|
|||||||
|
|
||||||
|
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
|
import com.suisung.mall.shop.base.service.ShopBaseProductCategoryService;
|
||||||
|
import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
||||||
import com.suisung.mall.shop.sixun.service.SxSyncCategoryService;
|
import com.suisung.mall.shop.sixun.service.SxSyncCategoryService;
|
||||||
import com.suisung.mall.shop.sixun.service.SxSyncGoodsService;
|
import com.suisung.mall.shop.sixun.service.SxSyncGoodsService;
|
||||||
import com.suisung.mall.shop.sixun.service.SxSyncVipService;
|
import com.suisung.mall.shop.sixun.service.SxSyncVipService;
|
||||||
@ -35,6 +37,12 @@ public class SxSyncController {
|
|||||||
@Resource
|
@Resource
|
||||||
private SxSyncGoodsService sxSyncGoodsService;
|
private SxSyncGoodsService sxSyncGoodsService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopBaseProductCategoryService shopBaseProductCategoryService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopProductBaseService shopProductBaseService;
|
||||||
|
|
||||||
@ApiOperation(value = "获取思迅商品分类新增到数据库", notes = "获取思迅商品分类新增到数据库")
|
@ApiOperation(value = "获取思迅商品分类新增到数据库", notes = "获取思迅商品分类新增到数据库")
|
||||||
@RequestMapping(value = "/goods/category/sync", method = RequestMethod.POST)
|
@RequestMapping(value = "/goods/category/sync", method = RequestMethod.POST)
|
||||||
public CommonResult syncGoodsCategory(@RequestParam(name = "storeId", defaultValue = "1") String storeId,
|
public CommonResult syncGoodsCategory(@RequestParam(name = "storeId", defaultValue = "1") String storeId,
|
||||||
@ -63,4 +71,28 @@ public class SxSyncController {
|
|||||||
return sxSyncGoodsService.syncGoods(storeId, pageNum, pageSize);
|
return sxSyncGoodsService.syncGoods(storeId, pageNum, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "1", notes = "1")
|
||||||
|
@RequestMapping(value = "/goods/category/sync2", method = RequestMethod.POST)
|
||||||
|
public CommonResult syncCategory2(@RequestParam(name = "storeId", defaultValue = "1") String storeId,
|
||||||
|
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize) {
|
||||||
|
|
||||||
|
if(shopBaseProductCategoryService.syncSxCategoryToShopBaseProductCategory(storeId, pageNum, pageSize)){
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CommonResult.failed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取思迅商品新增到数据库", notes = "获取思迅商品新增到数据库")
|
||||||
|
@RequestMapping(value = "/goods/sync2", method = RequestMethod.POST)
|
||||||
|
public CommonResult syncGoods(@RequestParam(name = "storeId", defaultValue = "1") String storeId) {
|
||||||
|
if( shopProductBaseService.syncSxGoodsToShopProductBase(storeId)){
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CommonResult.failed();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.suisung.mall.shop.sixun.service;
|
package com.suisung.mall.shop.sixun.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.modules.sixun.SxSyncCategory;
|
import com.suisung.mall.common.modules.sixun.SxSyncCategory;
|
||||||
|
|
||||||
@ -42,12 +43,12 @@ public interface SxSyncCategoryService {
|
|||||||
Integer insertBatch(String storeId, List<SxSyncCategory> list);
|
Integer insertBatch(String storeId, List<SxSyncCategory> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据分类编号更新一条记录
|
* 根据分类编号更新一条记录的状态
|
||||||
*
|
* @param itemClsno
|
||||||
* @param sxSyncCategory
|
* @param status 同步状态:1-已同步;2-未同步;
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateByItemClsNo(SxSyncCategory sxSyncCategory);
|
Boolean updateStatusByItemClsNo(String itemClsno, Integer status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据分类编号获取一条记录
|
* 根据分类编号获取一条记录
|
||||||
@ -57,4 +58,28 @@ public interface SxSyncCategoryService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SxSyncCategory getByItemClsno(String storeId, String itemClsNo);
|
SxSyncCategory getByItemClsno(String storeId, String itemClsNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺 Id 获取记录列表
|
||||||
|
* @param storeId
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<SxSyncCategory> selectByStoreId(String storeId, Integer status, Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更改记录
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updateBatch(List<SxSyncCategory> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新记录的状态
|
||||||
|
* @param list
|
||||||
|
* @param status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updateStatusBatch(List<Long> list, Integer status);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.suisung.mall.shop.sixun.service;
|
package com.suisung.mall.shop.sixun.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.modules.sixun.SxSyncGoods;
|
import com.suisung.mall.common.modules.sixun.SxSyncGoods;
|
||||||
|
|
||||||
@ -57,4 +58,21 @@ public interface SxSyncGoodsService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SxSyncGoods getByGoodsNo(String storeId, String goodsNo);
|
SxSyncGoods getByGoodsNo(String storeId, String goodsNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某个店铺的记录数
|
||||||
|
* @param storeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long countByStoreId(String storeId, Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺Id和同步状态,获取思迅商品列表
|
||||||
|
* @param storeId
|
||||||
|
* @param status
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<SxSyncGoods> pageByStoreId(String storeId, Integer status, Integer pageNum, Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,8 @@ import cn.hutool.json.JSONObject;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.constant.CommonConstant;
|
import com.suisung.mall.common.constant.CommonConstant;
|
||||||
import com.suisung.mall.common.modules.sixun.SxSyncCategory;
|
import com.suisung.mall.common.modules.sixun.SxSyncCategory;
|
||||||
@ -122,16 +124,18 @@ public class SxSyncCategoryServiceImpl extends BaseServiceImpl<SxSyncCategoryMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据分类编号更新一条记录
|
* 根据分类编号更新一条记录的状态
|
||||||
*
|
* @param itemClsno
|
||||||
* @param sxSyncCategory
|
* @param status 同步状态:1-已同步;2-未同步;
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByItemClsNo(SxSyncCategory sxSyncCategory) {
|
public Boolean updateStatusByItemClsNo(String itemClsno, Integer status){
|
||||||
UpdateWrapper<SxSyncCategory> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<SxSyncCategory> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.eq("item_clsno", sxSyncCategory.getItem_clsno());
|
updateWrapper.eq("item_clsno", itemClsno);
|
||||||
return update(sxSyncCategory, updateWrapper);
|
updateWrapper.set("status", status);
|
||||||
|
updateWrapper.set("updated_at", new Date());
|
||||||
|
return update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,6 +152,45 @@ public class SxSyncCategoryServiceImpl extends BaseServiceImpl<SxSyncCategoryMap
|
|||||||
return baseMapper.selectOne(queryWrapper);
|
return baseMapper.selectOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺 Id 获取记录列表
|
||||||
|
*
|
||||||
|
* @param storeId
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<SxSyncCategory> selectByStoreId(String storeId, Integer status, Integer pageNum, Integer pageSize) {
|
||||||
|
QueryWrapper<SxSyncCategory> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("store_id", storeId);
|
||||||
|
queryWrapper.eq("status", status);
|
||||||
|
queryWrapper.orderByAsc("id");
|
||||||
|
Page<SxSyncCategory> page = new Page<>(pageNum, pageSize);
|
||||||
|
return baseMapper.selectPage(page, queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更改记录
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateBatch(List<SxSyncCategory> list) {
|
||||||
|
return updateBatchById(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateStatusBatch(List<Long> ids, Integer status) {
|
||||||
|
UpdateWrapper updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.in("id", ids);
|
||||||
|
updateWrapper.set("status", status);
|
||||||
|
updateWrapper.set("updated_at", new Date());
|
||||||
|
return update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ########### 从思迅商锐9.7系统获取数据区域 开始
|
// ########### 从思迅商锐9.7系统获取数据区域 开始
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,8 @@ import cn.hutool.json.JSONObject;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.constant.CommonConstant;
|
import com.suisung.mall.common.constant.CommonConstant;
|
||||||
import com.suisung.mall.common.modules.sixun.SxSyncGoods;
|
import com.suisung.mall.common.modules.sixun.SxSyncGoods;
|
||||||
@ -151,6 +153,38 @@ public class SxSyncGoodsServiceImpl extends BaseServiceImpl<SxSyncGoodsMapper, S
|
|||||||
return baseMapper.selectOne(queryWrapper);
|
return baseMapper.selectOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某个店铺的记录数
|
||||||
|
*
|
||||||
|
* @param storeId
|
||||||
|
* @param status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long countByStoreId(String storeId, Integer status) {
|
||||||
|
QueryWrapper<SxSyncGoods> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("store_id", storeId);
|
||||||
|
queryWrapper.eq("status", status);
|
||||||
|
return baseMapper.selectCount(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺Id和同步状态,获取思迅商品列表
|
||||||
|
*
|
||||||
|
* @param storeId
|
||||||
|
* @param status
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<SxSyncGoods> pageByStoreId(String storeId, Integer status, Integer pageNum, Integer pageSize) {
|
||||||
|
QueryWrapper<SxSyncGoods> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("store_id", storeId);
|
||||||
|
queryWrapper.eq("status", status);
|
||||||
|
return baseMapper.selectPage(new Page<>(pageNum, pageSize), queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ########### 从思迅商锐9.7系统获取数据区域 开始
|
// ########### 从思迅商锐9.7系统获取数据区域 开始
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user