|
@@ -3,6 +3,7 @@ package com.caimei365.commodity.service.impl;
|
|
|
import com.caimei365.commodity.components.PriceUtilService;
|
|
|
import com.caimei365.commodity.mapper.ShopMapper;
|
|
|
import com.caimei365.commodity.model.ResponseJson;
|
|
|
+import com.caimei365.commodity.model.dto.ProductDto;
|
|
|
import com.caimei365.commodity.model.search.ProductListVo;
|
|
|
import com.caimei365.commodity.model.vo.PaginationVo;
|
|
|
import com.caimei365.commodity.model.vo.ProductItemVo;
|
|
@@ -10,6 +11,7 @@ import com.caimei365.commodity.service.ShopService;
|
|
|
import com.caimei365.commodity.utils.ImageUtils;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -74,7 +76,7 @@ public class ShopServiceImpl implements ShopService {
|
|
|
* @param productCode 货号
|
|
|
* @param validFlag 状态:0逻辑删除,1待审核,2已上架,3已下架,8审核未通过,9已隐身,10已冻结
|
|
|
* @param featuredFlag 是否主推:0否,1是
|
|
|
- * @param typeSort 分类类型:1产品,2仪器
|
|
|
+ * @param commodityType 商品属性:1产品,2仪器
|
|
|
* @param bigTypeId 一级分类Id
|
|
|
* @param smallTypeId 二级分类Id
|
|
|
* @param tinyTypeId 三级级分类Id
|
|
@@ -83,13 +85,13 @@ public class ShopServiceImpl implements ShopService {
|
|
|
* @return Map<String, Object>
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResponseJson<Map<String, Object>> getShopProducts(Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer typeSort, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId, int pageNum, int pageSize) {
|
|
|
+ public ResponseJson<Map<String, Object>> getShopProducts(Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId, int pageNum, int pageSize) {
|
|
|
if (null == shopId) {
|
|
|
return ResponseJson.error("参数异常:缺少供应商Id", null);
|
|
|
}
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
- List<ProductItemVo> productList = shopMapper.getShopProductsSelect(shopId, name, productCode, validFlag, featuredFlag, typeSort, bigTypeId, smallTypeId, tinyTypeId);
|
|
|
+ List<ProductItemVo> productList = shopMapper.getShopProductsSelect(shopId, name, productCode, validFlag, featuredFlag, commodityType, bigTypeId, smallTypeId, tinyTypeId);
|
|
|
if (null != productList && productList.size() > 0) {
|
|
|
for (ProductItemVo product : productList) {
|
|
|
product.setImage(ImageUtils.getImageURL("product", product.getImage(), 0, domain));
|
|
@@ -106,4 +108,92 @@ public class ShopServiceImpl implements ShopService {
|
|
|
map.put("featuredNum", featuredNum);
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 供应商-发布商品
|
|
|
+ *
|
|
|
+ * @param productDto {
|
|
|
+ * aliasName 内部商品名称
|
|
|
+ * allAreaFlag 销售区域:1全部区域, 0指定区域
|
|
|
+ * bigTypeId 一级分类id
|
|
|
+ * brandId 品牌id
|
|
|
+ * brandName 品牌名称
|
|
|
+ * commodityType 商品属性:1产品,2仪器
|
|
|
+ * costPrice 成本价
|
|
|
+ * detailInfo 商品详情信息
|
|
|
+ * includedTax 是否含税:0不含税,1含税,2未知
|
|
|
+ * invoiceType 发票类型
|
|
|
+ * machineType 械字号类型
|
|
|
+ * minBuyNumber 最小购买量
|
|
|
+ * name 商品名称
|
|
|
+ * normalPrice 市场价
|
|
|
+ * orderInfo 订购方案
|
|
|
+ * price 机构价格
|
|
|
+ * productCode 商品货号
|
|
|
+ * productType 商品类型:0其它,1妆字号,2械字号
|
|
|
+ * provinceIds 指定的销售区域
|
|
|
+ * qualificationImg 械字号资质证书图
|
|
|
+ * searchKey 搜索关键词
|
|
|
+ * serviceInfo 服务详情
|
|
|
+ * shopId 供应商id
|
|
|
+ * smallTypeId 二级分类id
|
|
|
+ * step 购买数量
|
|
|
+ * stock 库存
|
|
|
+ * tags 商品标签,逗号隔开
|
|
|
+ * taxPoint 开票税点
|
|
|
+ * tinyTypeId 三级分类id
|
|
|
+ * unit 包装规格
|
|
|
+ * userId 用户Id
|
|
|
+ * }
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson releaseProduct(ProductDto productDto) {
|
|
|
+ // 参数校验
|
|
|
+ if (null == productDto.getShopId()) {
|
|
|
+ return ResponseJson.error("参数异常:供应商id不能为空!", null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(productDto.getName())) {
|
|
|
+ return ResponseJson.error("参数异常:商品名称不能为空!", null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(productDto.getAliasName())) {
|
|
|
+ return ResponseJson.error("参数异常:内部商品名称不能为空!", null);
|
|
|
+ }
|
|
|
+ if (null == productDto.getCommodityType()) {
|
|
|
+ return ResponseJson.error("参数异常:商品属性不能为空!", null);
|
|
|
+ }
|
|
|
+ if (null == productDto.getBigTypeId()) {
|
|
|
+ return ResponseJson.error("参数异常:商品分类不能为空!", null);
|
|
|
+ }
|
|
|
+ if (null == productDto.getBrandId()) {
|
|
|
+ return ResponseJson.error("参数异常:品牌id不能为空!", null);
|
|
|
+ }
|
|
|
+ if (null == productDto.getProductType()) {
|
|
|
+ return ResponseJson.error("参数异常:商品类型不能为空!", null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(productDto.getTags())) {
|
|
|
+ return ResponseJson.error("参数异常:商品标签不能为空!", null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(productDto.getUnit())) {
|
|
|
+ return ResponseJson.error("参数异常:包装规格不能为空!", null);
|
|
|
+ }
|
|
|
+ if (null == productDto.getNormalPrice()) {
|
|
|
+ return ResponseJson.error("参数异常:市场价不能为空!", null);
|
|
|
+ }
|
|
|
+ if (null == productDto.getPrice()) {
|
|
|
+ return ResponseJson.error("参数异常:机构价格不能为空!", null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(productDto.getIncludedTax())) {
|
|
|
+ return ResponseJson.error("参数异常:是否含税不能为空!", null);
|
|
|
+ }
|
|
|
+ if (null == productDto.getMinBuyNumber()) {
|
|
|
+ return ResponseJson.error("参数异常:最小购买量不能为空!", null);
|
|
|
+ }
|
|
|
+ if (null == productDto.getStock()) {
|
|
|
+ return ResponseJson.error("参数异常:库存不能为空!", null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(productDto.getDetailInfo())) {
|
|
|
+ return ResponseJson.error("参数异常:商品详情信息不能为空!", null);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|