商品模块代码提交
This commit is contained in:
parent
9e6e300972
commit
6f35f159d9
|
|
@ -1,10 +1,12 @@
|
||||||
package com.czg.controller.user;
|
package com.czg.controller.user;
|
||||||
|
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.product.param.MiniHomeProductParam;
|
|
||||||
import com.czg.product.param.ShopProductSkuParam;
|
import com.czg.product.param.ShopProductSkuParam;
|
||||||
import com.czg.product.service.UProductService;
|
import com.czg.product.service.UProductService;
|
||||||
import com.czg.product.vo.*;
|
import com.czg.product.vo.ShopGroupProductVo;
|
||||||
|
import com.czg.product.vo.ShopProductInfoVo;
|
||||||
|
import com.czg.product.vo.ShopProductSkuInfoVo;
|
||||||
|
import com.czg.product.vo.ShopProductVo;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.validator.ValidatorUtil;
|
import com.czg.validator.ValidatorUtil;
|
||||||
|
|
@ -30,17 +32,6 @@ import java.util.List;
|
||||||
public class UProductController {
|
public class UProductController {
|
||||||
private final UProductService uProductService;
|
private final UProductService uProductService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 小程序点餐-首页-商品列表
|
|
||||||
*/
|
|
||||||
//@GetMapping("/miniApp/home/queryProduct")
|
|
||||||
//@OperationLog("小程序点餐-首页-商品列表")
|
|
||||||
public CzgResult<MiniAppHomeProductVo> queryProductForMiniAppHome(MiniHomeProductParam param) {
|
|
||||||
MiniAppHomeProductVo data = uProductService.queryProductForMiniAppHome(param);
|
|
||||||
return CzgResult.success(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序点餐-热销商品列表
|
* 小程序点餐-热销商品列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -14,20 +14,63 @@ import java.util.List;
|
||||||
* @since 1.0 2025-02-20
|
* @since 1.0 2025-02-20
|
||||||
*/
|
*/
|
||||||
public interface ConsGroupService extends IService<ConsGroup> {
|
public interface ConsGroupService extends IService<ConsGroup> {
|
||||||
|
/**
|
||||||
|
* 获取耗材分组分页
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 耗材分组分页
|
||||||
|
*/
|
||||||
Page<ConsGroupDTO> getConsGroupPage(ConsGroupDTO param);
|
Page<ConsGroupDTO> getConsGroupPage(ConsGroupDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取耗材分组列表
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 耗材分组列表
|
||||||
|
*/
|
||||||
List<ConsGroupDTO> getConsGroupList(ConsGroupDTO param);
|
List<ConsGroupDTO> getConsGroupList(ConsGroupDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取耗材分组详情
|
||||||
|
*
|
||||||
|
* @param id 耗材分组id
|
||||||
|
* @return 耗材分组详情
|
||||||
|
*/
|
||||||
ConsGroupDTO getConsGroupById(Long id);
|
ConsGroupDTO getConsGroupById(Long id);
|
||||||
|
|
||||||
boolean addConsGroup(ConsGroupDTO dto);
|
/**
|
||||||
|
* 新增耗材分组
|
||||||
|
*
|
||||||
|
* @param dto 耗材分组dto
|
||||||
|
*/
|
||||||
|
void addConsGroup(ConsGroupDTO dto);
|
||||||
|
|
||||||
boolean updateConsGroup(ConsGroupDTO dto);
|
/**
|
||||||
|
* 更新耗材分组
|
||||||
|
*
|
||||||
|
* @param dto 耗材分组dto
|
||||||
|
*/
|
||||||
|
void updateConsGroup(ConsGroupDTO dto);
|
||||||
|
|
||||||
boolean deleteConsGroup(Long id);
|
/**
|
||||||
|
* 删除耗材分组
|
||||||
|
*
|
||||||
|
* @param id 耗材分组id
|
||||||
|
*/
|
||||||
|
void deleteConsGroup(Long id);
|
||||||
|
|
||||||
boolean disableConsGroup(Long id);
|
/**
|
||||||
|
* 禁用耗材分组
|
||||||
|
*
|
||||||
|
* @param id 耗材分组id
|
||||||
|
*/
|
||||||
|
void disableConsGroup(Long id);
|
||||||
|
|
||||||
boolean enableConsGroup(Long id);
|
/**
|
||||||
|
* 启用耗材分组
|
||||||
|
*
|
||||||
|
* @param id 耗材分组id
|
||||||
|
*/
|
||||||
|
void enableConsGroup(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -15,24 +15,81 @@ import java.util.List;
|
||||||
* @since 1.0 2025-02-20
|
* @since 1.0 2025-02-20
|
||||||
*/
|
*/
|
||||||
public interface ConsInfoService extends IService<ConsInfo> {
|
public interface ConsInfoService extends IService<ConsInfo> {
|
||||||
|
/**
|
||||||
|
* 获取耗材信息分页
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 耗材信息分页
|
||||||
|
*/
|
||||||
Page<ConsInfoDTO> getConsInfoPage(ConsInfoDTO param);
|
Page<ConsInfoDTO> getConsInfoPage(ConsInfoDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取耗材信息列表
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 耗材信息列表
|
||||||
|
*/
|
||||||
List<ConsInfoDTO> getConsInfoList(ConsInfoDTO param);
|
List<ConsInfoDTO> getConsInfoList(ConsInfoDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取耗材信息详情
|
||||||
|
*
|
||||||
|
* @param id 耗材信息ID
|
||||||
|
* @return 耗材信息详情
|
||||||
|
*/
|
||||||
ConsInfoDTO getConsInfoById(Long id);
|
ConsInfoDTO getConsInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增耗材信息
|
||||||
|
*
|
||||||
|
* @param dto 耗材信息DTO
|
||||||
|
* @return 新增耗材信息是否成功
|
||||||
|
*/
|
||||||
boolean addConsInfo(ConsInfoDTO dto);
|
boolean addConsInfo(ConsInfoDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新耗材信息
|
||||||
|
*
|
||||||
|
* @param dto 耗材信息DTO
|
||||||
|
* @return 更新耗材信息是否成功
|
||||||
|
*/
|
||||||
boolean updateConsInfo(ConsInfoDTO dto);
|
boolean updateConsInfo(ConsInfoDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除耗材信息
|
||||||
|
*
|
||||||
|
* @param id 耗材信息ID
|
||||||
|
* @return 删除耗材信息是否成功
|
||||||
|
*/
|
||||||
boolean deleteConsInfo(Long id);
|
boolean deleteConsInfo(Long id);
|
||||||
|
|
||||||
boolean disableConsInfo(Long id);
|
/**
|
||||||
|
* 禁用耗材信息
|
||||||
|
*
|
||||||
|
* @param id 耗材信息ID
|
||||||
|
*/
|
||||||
|
void disableConsInfo(Long id);
|
||||||
|
|
||||||
boolean enableConsInfo(Long id);
|
/**
|
||||||
|
* 启用耗材信息
|
||||||
|
*
|
||||||
|
* @param id 耗材信息ID
|
||||||
|
*/
|
||||||
|
void enableConsInfo(Long id);
|
||||||
|
|
||||||
boolean onOffConsInfo(Long id, Integer isStock);
|
/**
|
||||||
|
* 是否检测耗材
|
||||||
|
*
|
||||||
|
* @param id 耗材信息ID
|
||||||
|
* @param isStock 是否检测耗材
|
||||||
|
*/
|
||||||
|
void onOffConsInfo(Long id, Integer isStock);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改耗材单位
|
||||||
|
*
|
||||||
|
* @param param 修改单位参数
|
||||||
|
*/
|
||||||
void modifySubUnit(ConsSubUnitParam param);
|
void modifySubUnit(ConsSubUnitParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,9 +14,20 @@ import java.util.List;
|
||||||
* @since 1.0 2025-02-20
|
* @since 1.0 2025-02-20
|
||||||
*/
|
*/
|
||||||
public interface ProdConsRelationService extends IService<ProdConsRelation> {
|
public interface ProdConsRelationService extends IService<ProdConsRelation> {
|
||||||
|
/**
|
||||||
|
* 获取商品耗材绑定关系列表
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 商品耗材绑定关系列表
|
||||||
|
*/
|
||||||
List<ProdConsRelationDTO> getProdConsRelationList(ProdConsRelationDTO param);
|
List<ProdConsRelationDTO> getProdConsRelationList(ProdConsRelationDTO param);
|
||||||
|
|
||||||
boolean saveProdConsRelation(ProdConsBindDTO dto);
|
/**
|
||||||
|
* 保存商品耗材绑定关系
|
||||||
|
*
|
||||||
|
* @param dto 商品耗材绑定关系DTO
|
||||||
|
* @return 保存结果
|
||||||
|
*/
|
||||||
|
void saveProdConsRelation(ProdConsBindDTO dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,20 +14,63 @@ import java.util.List;
|
||||||
* @since 1.0 2025-02-17
|
* @since 1.0 2025-02-17
|
||||||
*/
|
*/
|
||||||
public interface ProdGroupService extends IService<ProdGroup> {
|
public interface ProdGroupService extends IService<ProdGroup> {
|
||||||
|
/**
|
||||||
|
* 获取商品分组分页
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 商品分组分页
|
||||||
|
*/
|
||||||
Page<ProdGroupDTO> getProdGroupPage(ProdGroupDTO param);
|
Page<ProdGroupDTO> getProdGroupPage(ProdGroupDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品分组列表
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 商品分组列表
|
||||||
|
*/
|
||||||
List<ProdGroupDTO> getProdGroupList(ProdGroupDTO param);
|
List<ProdGroupDTO> getProdGroupList(ProdGroupDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品分组详情
|
||||||
|
*
|
||||||
|
* @param id 商品分组ID
|
||||||
|
* @return 商品分组详情
|
||||||
|
*/
|
||||||
ProdGroupDTO getProdGroupById(Long id);
|
ProdGroupDTO getProdGroupById(Long id);
|
||||||
|
|
||||||
boolean addProdGroup(ProdGroupDTO dto);
|
/**
|
||||||
|
* 添加商品分组
|
||||||
|
*
|
||||||
|
* @param dto 商品分组DTO
|
||||||
|
*/
|
||||||
|
void addProdGroup(ProdGroupDTO dto);
|
||||||
|
|
||||||
boolean deleteProdGroup(Long id);
|
/**
|
||||||
|
* 删除商品分组
|
||||||
|
*
|
||||||
|
* @param id 商品分组ID
|
||||||
|
*/
|
||||||
|
void deleteProdGroup(Long id);
|
||||||
|
|
||||||
boolean updateProdGroup(ProdGroupDTO dto);
|
/**
|
||||||
|
* 更新商品分组
|
||||||
|
*
|
||||||
|
* @param dto 商品分组DTO
|
||||||
|
*/
|
||||||
|
void updateProdGroup(ProdGroupDTO dto);
|
||||||
|
|
||||||
boolean disableProdGroup(Long id);
|
/**
|
||||||
|
* 禁用商品分组
|
||||||
|
*
|
||||||
|
* @param id 商品分组ID
|
||||||
|
*/
|
||||||
|
void disableProdGroup(Long id);
|
||||||
|
|
||||||
boolean enableProdGroup(Long id);
|
/**
|
||||||
|
* 启用商品分组
|
||||||
|
*
|
||||||
|
* @param id 商品分组ID
|
||||||
|
*/
|
||||||
|
void enableProdGroup(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -17,23 +17,76 @@ import java.util.List;
|
||||||
* @since 1.0 2025-02-16
|
* @since 1.0 2025-02-16
|
||||||
*/
|
*/
|
||||||
public interface ProductService extends IService<Product> {
|
public interface ProductService extends IService<Product> {
|
||||||
|
/**
|
||||||
|
* 获取商品分页
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
Page<ProductDTO> getProductPage(ProductDTO param);
|
Page<ProductDTO> getProductPage(ProductDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品列表
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 商品列表数据
|
||||||
|
*/
|
||||||
List<ProductDTO> getProductList(ProductDTO param);
|
List<ProductDTO> getProductList(ProductDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品详情
|
||||||
|
*
|
||||||
|
* @param id 商品ID
|
||||||
|
* @return 商品详情数据
|
||||||
|
*/
|
||||||
ProductDTO getProductById(Long id);
|
ProductDTO getProductById(Long id);
|
||||||
|
|
||||||
boolean addProduct(ProductDTO dto);
|
/**
|
||||||
|
* 添加商品
|
||||||
|
*
|
||||||
|
* @param dto 商品信息
|
||||||
|
*/
|
||||||
|
void addProduct(ProductDTO dto);
|
||||||
|
|
||||||
boolean updateProduct(ProductDTO dto);
|
/**
|
||||||
|
* 更新商品
|
||||||
|
*
|
||||||
|
* @param dto 商品信息
|
||||||
|
*/
|
||||||
|
void updateProduct(ProductDTO dto);
|
||||||
|
|
||||||
boolean deleteProduct(Long id);
|
/**
|
||||||
|
* 删除商品
|
||||||
|
*
|
||||||
|
* @param id 商品ID
|
||||||
|
*/
|
||||||
|
void deleteProduct(Long id);
|
||||||
|
|
||||||
boolean onOffProduct(ProductIsSaleParam param);
|
/**
|
||||||
|
* 上架/下架商品
|
||||||
|
*
|
||||||
|
* @param param 商品上架/下架参数
|
||||||
|
*/
|
||||||
|
void onOffProduct(ProductIsSaleParam param);
|
||||||
|
|
||||||
boolean markProductIsSoldOut(ProductIsSoldOutParam param);
|
/**
|
||||||
|
* 标记商品售罄
|
||||||
|
*
|
||||||
|
* @param param 入参
|
||||||
|
*/
|
||||||
|
void markProductIsSoldOut(ProductIsSoldOutParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退货到库存
|
||||||
|
*
|
||||||
|
* @param param 退货到库存参数
|
||||||
|
*/
|
||||||
void refundToStock(ProdRefundToStockParam param);
|
void refundToStock(ProdRefundToStockParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存预警
|
||||||
|
*
|
||||||
|
* @param warnLine 预警线
|
||||||
|
*/
|
||||||
void stockWarning(Integer warnLine);
|
void stockWarning(Integer warnLine);
|
||||||
}
|
}
|
||||||
|
|
@ -15,20 +15,61 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ShopProdCategoryService extends IService<ShopProdCategory> {
|
public interface ShopProdCategoryService extends IService<ShopProdCategory> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取店铺商品分类分页
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 店铺商品分类分页
|
||||||
|
*/
|
||||||
Page<ShopProdCategoryDTO> getShopProdCategoryPage(ShopProdCategoryDTO param);
|
Page<ShopProdCategoryDTO> getShopProdCategoryPage(ShopProdCategoryDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取店铺商品分类列表
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 店铺商品分类列表
|
||||||
|
*/
|
||||||
List<ShopProdCategoryDTO> getShopProdCategoryList(ShopProdCategoryDTO param);
|
List<ShopProdCategoryDTO> getShopProdCategoryList(ShopProdCategoryDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取店铺商品分类详情
|
||||||
|
* @param id id
|
||||||
|
* @return 店铺商品分类详情
|
||||||
|
*/
|
||||||
ShopProdCategoryDTO getShopProdCategoryById(Long id);
|
ShopProdCategoryDTO getShopProdCategoryById(Long id);
|
||||||
|
|
||||||
boolean addShopProdCategory(ShopProdCategoryDTO dto);
|
/**
|
||||||
|
* 添加店铺商品分类
|
||||||
|
*
|
||||||
|
* @param dto 商品分类信息
|
||||||
|
*/
|
||||||
|
void addShopProdCategory(ShopProdCategoryDTO dto);
|
||||||
|
|
||||||
boolean updateShopProdCategory(ShopProdCategoryDTO dto);
|
/**
|
||||||
|
* 更新店铺商品分类
|
||||||
|
*
|
||||||
|
* @param dto 商品分类信息
|
||||||
|
*/
|
||||||
|
void updateShopProdCategory(ShopProdCategoryDTO dto);
|
||||||
|
|
||||||
boolean deleteShopProdCategory(Long id);
|
/**
|
||||||
|
* 删除店铺商品分类
|
||||||
|
*
|
||||||
|
* @param id 商品分类id
|
||||||
|
*/
|
||||||
|
void deleteShopProdCategory(Long id);
|
||||||
|
|
||||||
boolean disableShopProdCategory(Long id);
|
/**
|
||||||
|
* 禁用店铺商品分类
|
||||||
|
*
|
||||||
|
* @param id 商品分类id
|
||||||
|
*/
|
||||||
|
void disableShopProdCategory(Long id);
|
||||||
|
|
||||||
boolean enableShopProdCategory(Long id);
|
/**
|
||||||
|
* 启用店铺商品分类
|
||||||
|
*
|
||||||
|
* @param id 商品分类id
|
||||||
|
*/
|
||||||
|
void enableShopProdCategory(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,21 +14,64 @@ import java.util.List;
|
||||||
* @since 1.0 2025-02-13
|
* @since 1.0 2025-02-13
|
||||||
*/
|
*/
|
||||||
public interface ShopProdSpecService extends IService<ShopProdSpec> {
|
public interface ShopProdSpecService extends IService<ShopProdSpec> {
|
||||||
|
/**
|
||||||
|
* 获取商品规格分页数据
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
Page<ShopProdSpecDTO> getShopProdSpecPage(ShopProdSpecDTO param);
|
Page<ShopProdSpecDTO> getShopProdSpecPage(ShopProdSpecDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品规格列表数据
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 列表数据
|
||||||
|
*/
|
||||||
List<ShopProdSpecDTO> getShopProdSpecList(ShopProdSpecDTO param);
|
List<ShopProdSpecDTO> getShopProdSpecList(ShopProdSpecDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取商品规格详情
|
||||||
|
*
|
||||||
|
* @param id 规格id
|
||||||
|
* @return 商品规格详情数据
|
||||||
|
*/
|
||||||
ShopProdSpecDTO getShopProdSpecById(Long id);
|
ShopProdSpecDTO getShopProdSpecById(Long id);
|
||||||
|
|
||||||
boolean addShopProdSpec(ShopProdSpecDTO dto);
|
/**
|
||||||
|
* 添加商品规格
|
||||||
|
*
|
||||||
|
* @param dto 商品规格DTO
|
||||||
|
*/
|
||||||
|
void addShopProdSpec(ShopProdSpecDTO dto);
|
||||||
|
|
||||||
boolean deleteShopProdSpec(Long id);
|
/**
|
||||||
|
* 删除商品规格
|
||||||
|
*
|
||||||
|
* @param id 规格id
|
||||||
|
*/
|
||||||
|
void deleteShopProdSpec(Long id);
|
||||||
|
|
||||||
boolean updateShopProdSpec(ShopProdSpecDTO dto);
|
/**
|
||||||
|
* 更新商品规格
|
||||||
|
*
|
||||||
|
* @param dto 商品规格DTO
|
||||||
|
*/
|
||||||
|
void updateShopProdSpec(ShopProdSpecDTO dto);
|
||||||
|
|
||||||
boolean disableShopProdSpec(Long id);
|
/**
|
||||||
|
* 禁用商品规格
|
||||||
|
*
|
||||||
|
* @param id 规格id
|
||||||
|
*/
|
||||||
|
void disableShopProdSpec(Long id);
|
||||||
|
|
||||||
boolean enableShopProdSpec(Long id);
|
/**
|
||||||
|
* 启用商品规格
|
||||||
|
*
|
||||||
|
* @param id 规格id
|
||||||
|
*/
|
||||||
|
void enableShopProdSpec(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 快速添加商品规格
|
* 快速添加商品规格
|
||||||
|
|
|
||||||
|
|
@ -15,20 +15,61 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ShopProdUnitService extends IService<ShopProdUnit> {
|
public interface ShopProdUnitService extends IService<ShopProdUnit> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品单位分页
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 商品单位分页数据
|
||||||
|
*/
|
||||||
Page<ShopProdUnitDTO> getShopProdUnitPage(ShopProdUnitDTO param);
|
Page<ShopProdUnitDTO> getShopProdUnitPage(ShopProdUnitDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品单位列表
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 商品单位列表数据
|
||||||
|
*/
|
||||||
List<ShopProdUnitDTO> getShopProdUnitList(ShopProdUnitDTO param);
|
List<ShopProdUnitDTO> getShopProdUnitList(ShopProdUnitDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品单位详情
|
||||||
|
* @param id 商品单位ID
|
||||||
|
* @return 商品单位详情数据
|
||||||
|
*/
|
||||||
ShopProdUnitDTO getShopProdUnitById(Long id);
|
ShopProdUnitDTO getShopProdUnitById(Long id);
|
||||||
|
|
||||||
boolean addShopProdUnit(ShopProdUnitDTO dto);
|
/**
|
||||||
|
* 新增商品单位
|
||||||
|
*
|
||||||
|
* @param dto 商品单位数据
|
||||||
|
*/
|
||||||
|
void addShopProdUnit(ShopProdUnitDTO dto);
|
||||||
|
|
||||||
boolean updateShopProdUnit(ShopProdUnitDTO dto);
|
/**
|
||||||
|
* 更新商品单位
|
||||||
|
*
|
||||||
|
* @param dto 商品单位数据
|
||||||
|
*/
|
||||||
|
void updateShopProdUnit(ShopProdUnitDTO dto);
|
||||||
|
|
||||||
boolean deleteShopProdUnit(Long id);
|
/**
|
||||||
|
* 删除商品单位
|
||||||
|
*
|
||||||
|
* @param id 商品单位ID
|
||||||
|
*/
|
||||||
|
void deleteShopProdUnit(Long id);
|
||||||
|
|
||||||
boolean disableShopProdUnit(Long id);
|
/**
|
||||||
|
* 禁用商品单位
|
||||||
|
*
|
||||||
|
* @param id 商品单位ID
|
||||||
|
*/
|
||||||
|
void disableShopProdUnit(Long id);
|
||||||
|
|
||||||
boolean enableShopProdUnit(Long id);
|
/**
|
||||||
|
* 启用商品单位
|
||||||
|
*
|
||||||
|
* @param id 商品单位ID
|
||||||
|
*/
|
||||||
|
void enableShopProdUnit(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,16 +14,47 @@ import java.util.List;
|
||||||
* @since 1.0 2025-02-20
|
* @since 1.0 2025-02-20
|
||||||
*/
|
*/
|
||||||
public interface ShopVendorService extends IService<ShopVendor> {
|
public interface ShopVendorService extends IService<ShopVendor> {
|
||||||
|
/**
|
||||||
|
* 供应商分页查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
Page<ShopVendorDTO> getShopVendorPage(ShopVendorDTO param);
|
Page<ShopVendorDTO> getShopVendorPage(ShopVendorDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商列表查询
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
List<ShopVendorDTO> getShopVendorList(ShopVendorDTO param);
|
List<ShopVendorDTO> getShopVendorList(ShopVendorDTO param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供应商明细
|
||||||
|
* @param id 供应商id
|
||||||
|
* @return 供应商信息
|
||||||
|
*/
|
||||||
ShopVendorDTO getShopVendorById(Long id);
|
ShopVendorDTO getShopVendorById(Long id);
|
||||||
|
|
||||||
boolean addShopVendor(ShopVendorDTO dto);
|
/**
|
||||||
|
* 添加供应商
|
||||||
|
*
|
||||||
|
* @param dto 供应商信息
|
||||||
|
*/
|
||||||
|
void addShopVendor(ShopVendorDTO dto);
|
||||||
|
|
||||||
boolean updateShopVendor(ShopVendorDTO dto);
|
/**
|
||||||
|
* 修改供应商
|
||||||
|
*
|
||||||
|
* @param dto 供应商信息
|
||||||
|
*/
|
||||||
|
void updateShopVendor(ShopVendorDTO dto);
|
||||||
|
|
||||||
boolean deleteShopVendor(Long id);
|
/**
|
||||||
|
* 删除供应商
|
||||||
|
*
|
||||||
|
* @param id 供应商id
|
||||||
|
*/
|
||||||
|
void deleteShopVendor(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
package com.czg.product.service;
|
package com.czg.product.service;
|
||||||
|
|
||||||
import com.czg.product.entity.Product;
|
import com.czg.product.entity.Product;
|
||||||
import com.czg.product.param.MiniHomeProductParam;
|
|
||||||
import com.czg.product.param.ShopProductSkuParam;
|
import com.czg.product.param.ShopProductSkuParam;
|
||||||
import com.czg.product.vo.*;
|
import com.czg.product.vo.ShopGroupProductVo;
|
||||||
|
import com.czg.product.vo.ShopProductInfoVo;
|
||||||
|
import com.czg.product.vo.ShopProductSkuInfoVo;
|
||||||
|
import com.czg.product.vo.ShopProductVo;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -15,13 +17,30 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface UProductService extends IService<Product> {
|
public interface UProductService extends IService<Product> {
|
||||||
|
|
||||||
MiniAppHomeProductVo queryProductForMiniAppHome(MiniHomeProductParam param);
|
/**
|
||||||
|
* 用户端获取热门商品
|
||||||
|
*
|
||||||
|
* @return 热门商品
|
||||||
|
*/
|
||||||
List<ShopProductVo> queryHotsProductList();
|
List<ShopProductVo> queryHotsProductList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端获取分组商品
|
||||||
|
* @return 分组商品
|
||||||
|
*/
|
||||||
List<ShopGroupProductVo> queryGroupProductList();
|
List<ShopGroupProductVo> queryGroupProductList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端获取商品详情
|
||||||
|
* @param id 商品ID
|
||||||
|
* @return 商品详情
|
||||||
|
*/
|
||||||
ShopProductInfoVo getProductInfo(Long id);
|
ShopProductInfoVo getProductInfo(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户端获取商品SKU详情
|
||||||
|
* @param param 商品SKU查询参数
|
||||||
|
* @return 商品详情
|
||||||
|
*/
|
||||||
ShopProductSkuInfoVo getProductSkuInfo(ShopProductSkuParam param);
|
ShopProductSkuInfoVo getProductSkuInfo(ShopProductSkuParam param);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean addConsGroup(ConsGroupDTO dto) {
|
public void addConsGroup(ConsGroupDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
boolean exists = super.exists(query().eq(ConsGroup::getName, dto.getName()).eq(ConsGroup::getShopId, shopId));
|
boolean exists = super.exists(query().eq(ConsGroup::getName, dto.getName()).eq(ConsGroup::getShopId, shopId));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
@ -88,7 +88,7 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
||||||
super.save(entity);
|
super.save(entity);
|
||||||
List<Long> consIds = dto.getConsIds();
|
List<Long> consIds = dto.getConsIds();
|
||||||
if (CollUtil.isEmpty(consIds)) {
|
if (CollUtil.isEmpty(consIds)) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
for (Long consId : consIds) {
|
for (Long consId : consIds) {
|
||||||
ConsGroupRelation relation = new ConsGroupRelation();
|
ConsGroupRelation relation = new ConsGroupRelation();
|
||||||
|
|
@ -97,11 +97,10 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
||||||
relation.setSort(consId.intValue());
|
relation.setSort(consId.intValue());
|
||||||
consGroupRelationMapper.insert(relation);
|
consGroupRelationMapper.insert(relation);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateConsGroup(ConsGroupDTO dto) {
|
public void updateConsGroup(ConsGroupDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
boolean exists = super.exists(query().eq(ConsGroup::getName, dto.getName()).eq(ConsGroup::getShopId, shopId).ne(ConsGroup::getId, dto.getId()));
|
boolean exists = super.exists(query().eq(ConsGroup::getName, dto.getName()).eq(ConsGroup::getShopId, shopId).ne(ConsGroup::getId, dto.getId()));
|
||||||
|
|
@ -112,7 +111,7 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
||||||
super.updateById(entity);
|
super.updateById(entity);
|
||||||
List<Long> consIds = dto.getConsIds();
|
List<Long> consIds = dto.getConsIds();
|
||||||
if (CollUtil.isEmpty(consIds)) {
|
if (CollUtil.isEmpty(consIds)) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
consGroupRelationMapper.deleteByQuery(query().eq(ConsGroupRelation::getGroupId, entity.getId()));
|
consGroupRelationMapper.deleteByQuery(query().eq(ConsGroupRelation::getGroupId, entity.getId()));
|
||||||
for (Long consId : consIds) {
|
for (Long consId : consIds) {
|
||||||
|
|
@ -122,19 +121,18 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
||||||
relation.setSort(consId.intValue());
|
relation.setSort(consId.intValue());
|
||||||
consGroupRelationMapper.insert(relation);
|
consGroupRelationMapper.insert(relation);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteConsGroup(Long id) {
|
public void deleteConsGroup(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return super.remove(query().eq(ConsGroup::getId, id).eq(ConsGroup::getShopId, shopId));
|
super.remove(query().eq(ConsGroup::getId, id).eq(ConsGroup::getShopId, shopId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableConsGroup(Long id) {
|
public void disableConsGroup(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ConsGroup.class)
|
UpdateChain.of(ConsGroup.class)
|
||||||
.set(ConsGroup::getStatus, StatusEnum.DISABLE.value())
|
.set(ConsGroup::getStatus, StatusEnum.DISABLE.value())
|
||||||
.eq(ConsGroup::getId, id)
|
.eq(ConsGroup::getId, id)
|
||||||
.eq(ConsGroup::getShopId, shopId)
|
.eq(ConsGroup::getShopId, shopId)
|
||||||
|
|
@ -142,9 +140,9 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enableConsGroup(Long id) {
|
public void enableConsGroup(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ConsGroup.class)
|
UpdateChain.of(ConsGroup.class)
|
||||||
.set(ConsGroup::getStatus, StatusEnum.ENABLED.value())
|
.set(ConsGroup::getStatus, StatusEnum.ENABLED.value())
|
||||||
.eq(ConsGroup::getId, id)
|
.eq(ConsGroup::getId, id)
|
||||||
.eq(ConsGroup::getShopId, shopId)
|
.eq(ConsGroup::getShopId, shopId)
|
||||||
|
|
|
||||||
|
|
@ -143,9 +143,9 @@ public class ConsInfoServiceImpl extends ServiceImpl<ConsInfoMapper, ConsInfo> i
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableConsInfo(Long id) {
|
public void disableConsInfo(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ConsInfo.class)
|
UpdateChain.of(ConsInfo.class)
|
||||||
.set(ConsInfo::getStatus, StatusEnum.DISABLE.value())
|
.set(ConsInfo::getStatus, StatusEnum.DISABLE.value())
|
||||||
.eq(ConsInfo::getId, id)
|
.eq(ConsInfo::getId, id)
|
||||||
.eq(ConsInfo::getShopId, shopId)
|
.eq(ConsInfo::getShopId, shopId)
|
||||||
|
|
@ -153,9 +153,9 @@ public class ConsInfoServiceImpl extends ServiceImpl<ConsInfoMapper, ConsInfo> i
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enableConsInfo(Long id) {
|
public void enableConsInfo(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ConsInfo.class)
|
UpdateChain.of(ConsInfo.class)
|
||||||
.set(ConsInfo::getStatus, StatusEnum.ENABLED.value())
|
.set(ConsInfo::getStatus, StatusEnum.ENABLED.value())
|
||||||
.eq(ConsInfo::getId, id)
|
.eq(ConsInfo::getId, id)
|
||||||
.eq(ConsInfo::getShopId, shopId)
|
.eq(ConsInfo::getShopId, shopId)
|
||||||
|
|
@ -163,12 +163,11 @@ public class ConsInfoServiceImpl extends ServiceImpl<ConsInfoMapper, ConsInfo> i
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOffConsInfo(Long id, Integer isStock) {
|
public void onOffConsInfo(Long id, Integer isStock) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
ConsInfo entity = super.getOne(query().eq(ConsInfo::getId, id).eq(ConsInfo::getShopId, shopId));
|
ConsInfo entity = super.getOne(query().eq(ConsInfo::getId, id).eq(ConsInfo::getShopId, shopId));
|
||||||
entity.setIsStock(isStock);
|
entity.setIsStock(isStock);
|
||||||
super.updateById(entity);
|
super.updateById(entity);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean saveProdConsRelation(ProdConsBindDTO dto) {
|
public void saveProdConsRelation(ProdConsBindDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
long count = productMapper.selectCountByQuery(query().eq(Product::getShopId, shopId).eq(Product::getId, dto.getId()));
|
long count = productMapper.selectCountByQuery(query().eq(Product::getShopId, shopId).eq(Product::getId, dto.getId()));
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
|
|
@ -58,7 +58,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
|
||||||
}
|
}
|
||||||
super.remove(query().eq(ProdConsRelation::getShopId, shopId).eq(ProdConsRelation::getProductId, dto.getId()));
|
super.remove(query().eq(ProdConsRelation::getShopId, shopId).eq(ProdConsRelation::getProductId, dto.getId()));
|
||||||
if (CollUtil.isEmpty(dto.getConsList())) {
|
if (CollUtil.isEmpty(dto.getConsList())) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
ValidatorUtil.validateEntityList(dto.getConsList(), DefaultGroup.class);
|
ValidatorUtil.validateEntityList(dto.getConsList(), DefaultGroup.class);
|
||||||
List<ProdConsRelationDTO> consList = dto.getConsList();
|
List<ProdConsRelationDTO> consList = dto.getConsList();
|
||||||
|
|
@ -73,7 +73,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
|
||||||
throw new CzgException("非法操作,绑定关系商品不一致");
|
throw new CzgException("非法操作,绑定关系商品不一致");
|
||||||
}
|
}
|
||||||
List<ProdConsRelation> entityList = BeanUtil.copyToList(consList, ProdConsRelation.class);
|
List<ProdConsRelation> entityList = BeanUtil.copyToList(consList, ProdConsRelation.class);
|
||||||
return super.saveBatch(entityList);
|
super.saveBatch(entityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ public class ProdGroupServiceImpl extends ServiceImpl<ProdGroupMapper, ProdGroup
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean addProdGroup(ProdGroupDTO dto) {
|
public void addProdGroup(ProdGroupDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
boolean exists = super.exists(query().eq(ProdGroup::getName, dto.getName()).eq(ProdGroup::getShopId, shopId));
|
boolean exists = super.exists(query().eq(ProdGroup::getName, dto.getName()).eq(ProdGroup::getShopId, shopId));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
@ -103,12 +103,11 @@ public class ProdGroupServiceImpl extends ServiceImpl<ProdGroupMapper, ProdGroup
|
||||||
prodGroupRelationMapper.insert(prodGroupRelation);
|
prodGroupRelationMapper.insert(prodGroupRelation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean updateProdGroup(ProdGroupDTO dto) {
|
public void updateProdGroup(ProdGroupDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
boolean exists = super.exists(query().eq(ProdGroup::getName, dto.getName()).eq(ProdGroup::getShopId, shopId).ne(ProdGroup::getId, dto.getId()));
|
boolean exists = super.exists(query().eq(ProdGroup::getName, dto.getName()).eq(ProdGroup::getShopId, shopId).ne(ProdGroup::getId, dto.getId()));
|
||||||
|
|
@ -130,22 +129,20 @@ public class ProdGroupServiceImpl extends ServiceImpl<ProdGroupMapper, ProdGroup
|
||||||
prodGroupRelationMapper.insert(prodGroupRelation);
|
prodGroupRelationMapper.insert(prodGroupRelation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean deleteProdGroup(Long id) {
|
public void deleteProdGroup(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
super.remove(query().eq(ProdGroup::getId, id).eq(ProdGroup::getShopId, shopId));
|
super.remove(query().eq(ProdGroup::getId, id).eq(ProdGroup::getShopId, shopId));
|
||||||
prodGroupRelationMapper.deleteByQuery(query().eq(ProdGroupRelation::getProdGroupId, id));
|
prodGroupRelationMapper.deleteByQuery(query().eq(ProdGroupRelation::getProdGroupId, id));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableProdGroup(Long id) {
|
public void disableProdGroup(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ProdGroup.class)
|
UpdateChain.of(ProdGroup.class)
|
||||||
.set(ProdGroup::getStatus, StatusEnum.DISABLE.value())
|
.set(ProdGroup::getStatus, StatusEnum.DISABLE.value())
|
||||||
.eq(ProdGroup::getId, id)
|
.eq(ProdGroup::getId, id)
|
||||||
.eq(ProdGroup::getShopId, shopId)
|
.eq(ProdGroup::getShopId, shopId)
|
||||||
|
|
@ -153,9 +150,9 @@ public class ProdGroupServiceImpl extends ServiceImpl<ProdGroupMapper, ProdGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enableProdGroup(Long id) {
|
public void enableProdGroup(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ProdGroup.class)
|
UpdateChain.of(ProdGroup.class)
|
||||||
.set(ProdGroup::getStatus, StatusEnum.ENABLED.value())
|
.set(ProdGroup::getStatus, StatusEnum.ENABLED.value())
|
||||||
.eq(ProdGroup::getId, id)
|
.eq(ProdGroup::getId, id)
|
||||||
.eq(ProdGroup::getShopId, shopId)
|
.eq(ProdGroup::getShopId, shopId)
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean addProduct(ProductDTO dto) {
|
public void addProduct(ProductDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId));
|
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
@ -194,11 +194,10 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||||
}
|
}
|
||||||
prodSkuMapper.insertBatch(prodSkuList);
|
prodSkuMapper.insertBatch(prodSkuList);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateProduct(ProductDTO dto) {
|
public void updateProduct(ProductDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId).ne(Product::getId, dto.getId()));
|
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId).ne(Product::getId, dto.getId()));
|
||||||
|
|
@ -249,13 +248,12 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||||
.eq(ProdSku::getShopId, shopId)
|
.eq(ProdSku::getShopId, shopId)
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteProduct(Long id) {
|
public void deleteProduct(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(Product.class)
|
UpdateChain.of(Product.class)
|
||||||
.set(Product::getIsDel, DeleteEnum.DELETED.value())
|
.set(Product::getIsDel, DeleteEnum.DELETED.value())
|
||||||
.eq(Product::getId, id)
|
.eq(Product::getId, id)
|
||||||
.eq(Product::getShopId, shopId)
|
.eq(Product::getShopId, shopId)
|
||||||
|
|
@ -264,7 +262,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean onOffProduct(ProductIsSaleParam param) {
|
public void onOffProduct(ProductIsSaleParam param) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
String type = param.getType();
|
String type = param.getType();
|
||||||
Long id = param.getId();
|
Long id = param.getId();
|
||||||
|
|
@ -280,12 +278,11 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||||
.eq(Product::getShopId, shopId)
|
.eq(Product::getShopId, shopId)
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean markProductIsSoldOut(ProductIsSoldOutParam param) {
|
public void markProductIsSoldOut(ProductIsSoldOutParam param) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
String type = param.getType();
|
String type = param.getType();
|
||||||
Long id = param.getId();
|
Long id = param.getId();
|
||||||
|
|
@ -301,7 +298,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||||
.eq(Product::getShopId, shopId)
|
.eq(Product::getShopId, shopId)
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addShopProdCategory(ShopProdCategoryDTO dto) {
|
public void addShopProdCategory(ShopProdCategoryDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
boolean exists = super.exists(query().eq(ShopProdCategory::getName, dto.getName()).eq(ShopProdCategory::getShopId, shopId));
|
boolean exists = super.exists(query().eq(ShopProdCategory::getName, dto.getName()).eq(ShopProdCategory::getShopId, shopId));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
@ -67,16 +67,16 @@ public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMap
|
||||||
ShopProdCategory entity = BeanUtil.copyProperties(dto, ShopProdCategory.class);
|
ShopProdCategory entity = BeanUtil.copyProperties(dto, ShopProdCategory.class);
|
||||||
// 简称
|
// 简称
|
||||||
entity.setShortName(dto.getName());
|
entity.setShortName(dto.getName());
|
||||||
if(entity.getStatus() == null){
|
if (entity.getStatus() == null) {
|
||||||
entity.setStatus(StatusEnum.ENABLED.value());
|
entity.setStatus(StatusEnum.ENABLED.value());
|
||||||
}
|
}
|
||||||
entity.setPid(0L);
|
entity.setPid(0L);
|
||||||
entity.setShopId(shopId);
|
entity.setShopId(shopId);
|
||||||
return super.save(entity);
|
super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateShopProdCategory(ShopProdCategoryDTO dto) {
|
public void updateShopProdCategory(ShopProdCategoryDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
boolean exists = super.exists(query().eq(ShopProdCategory::getName, dto.getName()).eq(ShopProdCategory::getShopId, shopId).ne(ShopProdCategory::getId, dto.getId()));
|
boolean exists = super.exists(query().eq(ShopProdCategory::getName, dto.getName()).eq(ShopProdCategory::getShopId, shopId).ne(ShopProdCategory::getId, dto.getId()));
|
||||||
|
|
@ -84,19 +84,19 @@ public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMap
|
||||||
throw new CzgException("商品分类已存在");
|
throw new CzgException("商品分类已存在");
|
||||||
}
|
}
|
||||||
ShopProdCategory entity = BeanUtil.copyProperties(dto, ShopProdCategory.class);
|
ShopProdCategory entity = BeanUtil.copyProperties(dto, ShopProdCategory.class);
|
||||||
return super.updateById(entity);
|
super.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteShopProdCategory(Long id) {
|
public void deleteShopProdCategory(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return super.remove(query().eq(ShopProdCategory::getId, id).eq(ShopProdCategory::getShopId, shopId));
|
super.remove(query().eq(ShopProdCategory::getId, id).eq(ShopProdCategory::getShopId, shopId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableShopProdCategory(Long id) {
|
public void disableShopProdCategory(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ShopProdCategory.class)
|
UpdateChain.of(ShopProdCategory.class)
|
||||||
.set(ShopProdCategory::getStatus, StatusEnum.DISABLE.value())
|
.set(ShopProdCategory::getStatus, StatusEnum.DISABLE.value())
|
||||||
.eq(ShopProdCategory::getId, id)
|
.eq(ShopProdCategory::getId, id)
|
||||||
.eq(ShopProdCategory::getShopId, shopId)
|
.eq(ShopProdCategory::getShopId, shopId)
|
||||||
|
|
@ -104,9 +104,9 @@ public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMap
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enableShopProdCategory(Long id) {
|
public void enableShopProdCategory(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ShopProdCategory.class)
|
UpdateChain.of(ShopProdCategory.class)
|
||||||
.set(ShopProdCategory::getStatus, StatusEnum.ENABLED.value())
|
.set(ShopProdCategory::getStatus, StatusEnum.ENABLED.value())
|
||||||
.eq(ShopProdCategory::getId, id)
|
.eq(ShopProdCategory::getId, id)
|
||||||
.eq(ShopProdCategory::getShopId, shopId)
|
.eq(ShopProdCategory::getShopId, shopId)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addShopProdUnit(ShopProdUnitDTO dto) {
|
public void addShopProdUnit(ShopProdUnitDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
boolean exists = super.exists(query().eq(ShopProdUnit::getName, dto.getName()).eq(ShopProdUnit::getShopId, shopId));
|
boolean exists = super.exists(query().eq(ShopProdUnit::getName, dto.getName()).eq(ShopProdUnit::getShopId, shopId));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
@ -74,11 +74,11 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||||
entity.setIsSystem(YesNoEnum.NO.value());
|
entity.setIsSystem(YesNoEnum.NO.value());
|
||||||
entity.setStatus(StatusEnum.ENABLED.value());
|
entity.setStatus(StatusEnum.ENABLED.value());
|
||||||
entity.setShopId(shopId);
|
entity.setShopId(shopId);
|
||||||
return super.save(entity);
|
super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateShopProdUnit(ShopProdUnitDTO dto) {
|
public void updateShopProdUnit(ShopProdUnitDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
boolean exists = super.exists(query().eq(ShopProdUnit::getName, dto.getName()).eq(ShopProdUnit::getShopId, shopId).ne(ShopProdUnit::getId, dto.getId()));
|
boolean exists = super.exists(query().eq(ShopProdUnit::getName, dto.getName()).eq(ShopProdUnit::getShopId, shopId).ne(ShopProdUnit::getId, dto.getId()));
|
||||||
|
|
@ -86,19 +86,19 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||||
throw new CzgException("单位名称已存在");
|
throw new CzgException("单位名称已存在");
|
||||||
}
|
}
|
||||||
ShopProdUnit entity = BeanUtil.copyProperties(dto, ShopProdUnit.class);
|
ShopProdUnit entity = BeanUtil.copyProperties(dto, ShopProdUnit.class);
|
||||||
return super.updateById(entity);
|
super.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteShopProdUnit(Long id) {
|
public void deleteShopProdUnit(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return super.remove(query().eq(ShopProdUnit::getId, id).eq(ShopProdUnit::getShopId, shopId));
|
super.remove(query().eq(ShopProdUnit::getId, id).eq(ShopProdUnit::getShopId, shopId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableShopProdUnit(Long id) {
|
public void disableShopProdUnit(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ShopProdUnit.class)
|
UpdateChain.of(ShopProdUnit.class)
|
||||||
.set(ShopProdUnit::getStatus, StatusEnum.DISABLE.value())
|
.set(ShopProdUnit::getStatus, StatusEnum.DISABLE.value())
|
||||||
.eq(ShopProdUnit::getId, id)
|
.eq(ShopProdUnit::getId, id)
|
||||||
.eq(ShopProdUnit::getShopId, shopId)
|
.eq(ShopProdUnit::getShopId, shopId)
|
||||||
|
|
@ -106,9 +106,9 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enableShopProdUnit(Long id) {
|
public void enableShopProdUnit(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ShopProdUnit.class)
|
UpdateChain.of(ShopProdUnit.class)
|
||||||
.set(ShopProdUnit::getStatus, StatusEnum.ENABLED.value())
|
.set(ShopProdUnit::getStatus, StatusEnum.ENABLED.value())
|
||||||
.eq(ShopProdUnit::getId, id)
|
.eq(ShopProdUnit::getId, id)
|
||||||
.eq(ShopProdUnit::getShopId, shopId)
|
.eq(ShopProdUnit::getShopId, shopId)
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addShopProdSpec(ShopProdSpecDTO dto) {
|
public void addShopProdSpec(ShopProdSpecDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
boolean exists = super.exists(query()
|
boolean exists = super.exists(query()
|
||||||
.eq(ShopProdSpec::getName, dto.getName())
|
.eq(ShopProdSpec::getName, dto.getName())
|
||||||
|
|
@ -100,12 +100,11 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
|
||||||
entity.setShopId(shopId);
|
entity.setShopId(shopId);
|
||||||
super.save(entity);
|
super.save(entity);
|
||||||
dto.setId(entity.getId());
|
dto.setId(entity.getId());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean updateShopProdSpec(ShopProdSpecDTO dto) {
|
public void updateShopProdSpec(ShopProdSpecDTO dto) {
|
||||||
//上级规格不能为自身
|
//上级规格不能为自身
|
||||||
if (dto.getId().equals(dto.getPid())) {
|
if (dto.getId().equals(dto.getPid())) {
|
||||||
throw new CzgException("上级规格不能为自身");
|
throw new CzgException("上级规格不能为自身");
|
||||||
|
|
@ -137,31 +136,31 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
|
||||||
.setRaw(ShopProdSpec::getFullName, StrUtil.format("replace(full_name, '{}', '{}')", oldName, entity.getName()))
|
.setRaw(ShopProdSpec::getFullName, StrUtil.format("replace(full_name, '{}', '{}')", oldName, entity.getName()))
|
||||||
.like(ShopProdSpec::getPids, "," + entity.getId() + ",")
|
.like(ShopProdSpec::getPids, "," + entity.getId() + ",")
|
||||||
.eq(ShopProdSpec::getShopId, entity.getShopId()).update();
|
.eq(ShopProdSpec::getShopId, entity.getShopId()).update();
|
||||||
return super.updateById(entity);
|
super.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteShopProdSpec(Long id) {
|
public void deleteShopProdSpec(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return super.remove(query()
|
super.remove(query()
|
||||||
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
||||||
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ","))))
|
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ","))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean disableShopProdSpec(Long id) {
|
public void disableShopProdSpec(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ShopProdSpec.class)
|
UpdateChain.of(ShopProdSpec.class)
|
||||||
.set(SHOP_PROD_SPEC.STATUS, StatusEnum.DISABLE.value())
|
.set(SHOP_PROD_SPEC.STATUS, StatusEnum.DISABLE.value())
|
||||||
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
||||||
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ",")))).update();
|
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ",")))).update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enableShopProdSpec(Long id) {
|
public void enableShopProdSpec(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ShopProdSpec.class)
|
UpdateChain.of(ShopProdSpec.class)
|
||||||
.set(SHOP_PROD_SPEC.STATUS, StatusEnum.ENABLED.value())
|
.set(SHOP_PROD_SPEC.STATUS, StatusEnum.ENABLED.value())
|
||||||
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
||||||
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ",")))).update();
|
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ",")))).update();
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addShopVendor(ShopVendorDTO dto) {
|
public void addShopVendor(ShopVendorDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
boolean exists = super.exists(query().eq(ShopVendor::getName, dto.getName()).eq(ShopVendor::getShopId, shopId));
|
boolean exists = super.exists(query().eq(ShopVendor::getName, dto.getName()).eq(ShopVendor::getShopId, shopId));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
|
|
@ -68,11 +68,11 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
|
||||||
ShopVendor entity = BeanUtil.copyProperties(dto, ShopVendor.class);
|
ShopVendor entity = BeanUtil.copyProperties(dto, ShopVendor.class);
|
||||||
entity.setIsDel(DeleteEnum.NORMAL.value());
|
entity.setIsDel(DeleteEnum.NORMAL.value());
|
||||||
entity.setShopId(shopId);
|
entity.setShopId(shopId);
|
||||||
return super.save(entity);
|
super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateShopVendor(ShopVendorDTO dto) {
|
public void updateShopVendor(ShopVendorDTO dto) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
boolean exists = super.exists(query().eq(ShopVendor::getName, dto.getName()).eq(ShopVendor::getShopId, shopId).ne(ShopVendor::getId, dto.getId()));
|
boolean exists = super.exists(query().eq(ShopVendor::getName, dto.getName()).eq(ShopVendor::getShopId, shopId).ne(ShopVendor::getId, dto.getId()));
|
||||||
|
|
@ -80,13 +80,13 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
|
||||||
throw new CzgException("供应商已存在");
|
throw new CzgException("供应商已存在");
|
||||||
}
|
}
|
||||||
ShopVendor entity = BeanUtil.copyProperties(dto, ShopVendor.class);
|
ShopVendor entity = BeanUtil.copyProperties(dto, ShopVendor.class);
|
||||||
return super.updateById(entity);
|
super.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteShopVendor(Long id) {
|
public void deleteShopVendor(Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
return UpdateChain.of(ShopVendor.class)
|
UpdateChain.of(ShopVendor.class)
|
||||||
.set(ShopVendor::getIsDel, DeleteEnum.DELETED.value())
|
.set(ShopVendor::getIsDel, DeleteEnum.DELETED.value())
|
||||||
.eq(ShopVendor::getId, id)
|
.eq(ShopVendor::getId, id)
|
||||||
.eq(ShopVendor::getShopId, shopId)
|
.eq(ShopVendor::getShopId, shopId)
|
||||||
|
|
|
||||||
|
|
@ -7,40 +7,36 @@ import com.czg.enums.DeleteEnum;
|
||||||
import com.czg.enums.StatusEnum;
|
import com.czg.enums.StatusEnum;
|
||||||
import com.czg.enums.YesNoEnum;
|
import com.czg.enums.YesNoEnum;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.product.dto.ProdSkuDTO;
|
|
||||||
import com.czg.product.dto.ProductDTO;
|
|
||||||
import com.czg.product.entity.ProdGroup;
|
import com.czg.product.entity.ProdGroup;
|
||||||
import com.czg.product.entity.ProdGroupRelation;
|
import com.czg.product.entity.ProdGroupRelation;
|
||||||
import com.czg.product.entity.ProdSku;
|
import com.czg.product.entity.ProdSku;
|
||||||
import com.czg.product.entity.Product;
|
import com.czg.product.entity.Product;
|
||||||
import com.czg.product.param.MiniHomeProductParam;
|
|
||||||
import com.czg.product.param.ShopProductSkuParam;
|
import com.czg.product.param.ShopProductSkuParam;
|
||||||
import com.czg.product.service.UProductService;
|
import com.czg.product.service.UProductService;
|
||||||
import com.czg.product.vo.*;
|
import com.czg.product.vo.ShopGroupProductVo;
|
||||||
|
import com.czg.product.vo.ShopProductInfoVo;
|
||||||
|
import com.czg.product.vo.ShopProductSkuInfoVo;
|
||||||
|
import com.czg.product.vo.ShopProductVo;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.product.mapper.ProdGroupMapper;
|
import com.czg.service.product.mapper.ProdGroupMapper;
|
||||||
import com.czg.service.product.mapper.ProdGroupRelationMapper;
|
import com.czg.service.product.mapper.ProdGroupRelationMapper;
|
||||||
import com.czg.service.product.mapper.ProdSkuMapper;
|
import com.czg.service.product.mapper.ProdSkuMapper;
|
||||||
import com.czg.service.product.mapper.ProductMapper;
|
import com.czg.service.product.mapper.ProductMapper;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.format.TextStyle;
|
import java.time.format.TextStyle;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.czg.product.entity.table.ProductTableDef.PRODUCT;
|
|
||||||
import static com.czg.product.entity.table.ShopProdCategoryTableDef.SHOP_PROD_CATEGORY;
|
|
||||||
import static com.czg.product.entity.table.ShopProdSpecTableDef.SHOP_PROD_SPEC;
|
|
||||||
import static com.czg.product.entity.table.ShopProdUnitTableDef.SHOP_PROD_UNIT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品
|
* 商品
|
||||||
*
|
*
|
||||||
|
|
@ -57,111 +53,6 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
|
||||||
private final ProdGroupMapper prodGroupMapper;
|
private final ProdGroupMapper prodGroupMapper;
|
||||||
private final ProdGroupRelationMapper prodGroupRelationMapper;
|
private final ProdGroupRelationMapper prodGroupRelationMapper;
|
||||||
|
|
||||||
private QueryWrapper buildQueryWrapper(MiniHomeProductParam param) {
|
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
|
||||||
String weekDayEnName = getWeekDayEnName();
|
|
||||||
LocalTime now = LocalTime.now().withNano(0);
|
|
||||||
QueryWrapper queryWrapper = query();
|
|
||||||
queryWrapper.select(PRODUCT.ALL_COLUMNS)
|
|
||||||
.select(SHOP_PROD_UNIT.NAME.as(ProductDTO::getUnitName))
|
|
||||||
.select(SHOP_PROD_CATEGORY.NAME.as(ProductDTO::getCategoryName))
|
|
||||||
.select(SHOP_PROD_SPEC.NAME.as(ProductDTO::getSpecName), SHOP_PROD_SPEC.FULL_NAME.as(ProductDTO::getSpecFullName))
|
|
||||||
.from(PRODUCT)
|
|
||||||
.leftJoin(SHOP_PROD_UNIT).on(SHOP_PROD_UNIT.ID.eq(PRODUCT.UNIT_ID))
|
|
||||||
.leftJoin(SHOP_PROD_CATEGORY).on(SHOP_PROD_CATEGORY.ID.eq(PRODUCT.CATEGORY_ID))
|
|
||||||
.leftJoin(SHOP_PROD_SPEC).on(SHOP_PROD_SPEC.ID.eq(PRODUCT.SPEC_ID))
|
|
||||||
.where(PRODUCT.SHOP_ID.eq(shopId))
|
|
||||||
.and(PRODUCT.DAYS.like(weekDayEnName))
|
|
||||||
.and(PRODUCT.START_TIME.le(now))
|
|
||||||
.and(PRODUCT.END_TIME.ge(now))
|
|
||||||
.and(PRODUCT.IS_DEL.eq(DeleteEnum.NORMAL.value()))
|
|
||||||
.and(PRODUCT.IS_SALE.eq(YesNoEnum.YES.value()))
|
|
||||||
.orderBy(PRODUCT.SORT, false)
|
|
||||||
.orderBy(PRODUCT.ID, false);
|
|
||||||
if (CollUtil.isNotEmpty(param.getProductIdList())) {
|
|
||||||
queryWrapper.and(PRODUCT.ID.in(param.getProductIdList()));
|
|
||||||
}
|
|
||||||
return queryWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
private QueryWrapper buildHotsQueryWrapper(MiniHomeProductParam param) {
|
|
||||||
// 查询在可售时间内的热门商品
|
|
||||||
QueryWrapper queryWrapper = buildQueryWrapper(param);
|
|
||||||
queryWrapper.and(PRODUCT.IS_HOT.eq(YesNoEnum.YES.value()));
|
|
||||||
return queryWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<MiniAppHomeProductInfoVo> buildProductList(QueryWrapper queryWrapper) {
|
|
||||||
List<ProductDTO> dtoList = productMapper.selectListByQueryAs(queryWrapper, ProductDTO.class);
|
|
||||||
if (CollUtil.isEmpty(dtoList)) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
List<Long> prodIdList = dtoList.stream().map(ProductDTO::getId).distinct().toList();
|
|
||||||
List<ProdSkuDTO> skuList = prodSkuMapper.selectListByQueryAs(query()
|
|
||||||
.in(ProdSku::getProductId, prodIdList)
|
|
||||||
.eq(ProdSku::getIsDel, DeleteEnum.NORMAL.value())
|
|
||||||
.eq(ProdSku::getIsGrounding, YesNoEnum.YES.value())
|
|
||||||
, ProdSkuDTO.class);
|
|
||||||
Map<Long, List<ProdSkuDTO>> collect = skuList.stream().collect(Collectors.groupingBy(ProdSkuDTO::getProductId));
|
|
||||||
List<MiniAppHomeProductInfoVo> products = new ArrayList<>();
|
|
||||||
for (ProductDTO dto : dtoList) {
|
|
||||||
MiniAppHomeProductInfoVo prod = new MiniAppHomeProductInfoVo();
|
|
||||||
prod.setId(dto.getId());
|
|
||||||
prod.setName(dto.getName());
|
|
||||||
prod.setCoverImg(dto.getCoverImg());
|
|
||||||
prod.setImages(dto.getImages());
|
|
||||||
prod.setUnitName(dto.getUnitName());
|
|
||||||
prod.setCategoryName(dto.getCategoryName());
|
|
||||||
prod.setType(dto.getType());
|
|
||||||
prod.setGroupType(dto.getGroupType());
|
|
||||||
prod.setSelectSpecInfo(dto.getSelectSpecInfo());
|
|
||||||
prod.setIsSoldStock(dto.getIsSoldStock());
|
|
||||||
prod.setStockNumber(dto.getStockNumber());
|
|
||||||
prod.setIsSale(dto.getIsSale());
|
|
||||||
|
|
||||||
List<ProdSkuDTO> list = collect.getOrDefault(dto.getId(), Collections.emptyList());
|
|
||||||
Optional<BigDecimal> lowPriceIsPresent = list.stream().map(ProdSkuDTO::getSalePrice).min(BigDecimal::compareTo);
|
|
||||||
lowPriceIsPresent.ifPresent(prod::setLowPrice);
|
|
||||||
|
|
||||||
Optional<BigDecimal> lowMemberPriceIsPresent = list.stream().map(ProdSkuDTO::getMemberPrice).min(BigDecimal::compareTo);
|
|
||||||
lowMemberPriceIsPresent.ifPresent(prod::setLowMemberPrice);
|
|
||||||
|
|
||||||
prod.setSkuList(list);
|
|
||||||
products.add(prod);
|
|
||||||
}
|
|
||||||
return products;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MiniAppHomeProductVo queryProductForMiniAppHome(MiniHomeProductParam param) {
|
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
|
||||||
MiniAppHomeProductVo vo = new MiniAppHomeProductVo();
|
|
||||||
|
|
||||||
List<MiniAppHomeProductInfoVo> hots = buildProductList(buildHotsQueryWrapper(param));
|
|
||||||
vo.setHots(hots);
|
|
||||||
// 查询可用商品分组,构建分组商品数据
|
|
||||||
QueryWrapper queryWrapper = query()
|
|
||||||
.eq(ProdGroup::getShopId, shopId)
|
|
||||||
.eq(ProdGroup::getStatus, StatusEnum.ENABLED.value())
|
|
||||||
.orderBy(ProdGroup::getSort, true);
|
|
||||||
if (param.getProdGroupId() != null) {
|
|
||||||
queryWrapper.eq(ProdGroup::getId, param.getProdGroupId());
|
|
||||||
}
|
|
||||||
List<MiniAppHomeProdGroupVo> groupList = prodGroupMapper.selectListByQueryAs(queryWrapper, MiniAppHomeProdGroupVo.class);
|
|
||||||
for (MiniAppHomeProdGroupVo dto : groupList) {
|
|
||||||
List<Long> productIdList = prodGroupRelationMapper.selectObjectListByQueryAs(query().select(ProdGroupRelation::getProductId).eq(ProdGroupRelation::getProdGroupId, dto.getId()).orderBy(ProdGroupRelation::getSort, true), Long.class);
|
|
||||||
if (CollUtil.isNotEmpty(productIdList)) {
|
|
||||||
param.setProductIdList(productIdList);
|
|
||||||
List<MiniAppHomeProductInfoVo> products = buildProductList(buildQueryWrapper(param));
|
|
||||||
dto.setProducts(products);
|
|
||||||
} else {
|
|
||||||
dto.setProducts(new ArrayList<>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vo.setProductInfo(groupList);
|
|
||||||
return vo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ShopProductVo> queryHotsProductList() {
|
public List<ShopProductVo> queryHotsProductList() {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue