Commit db7e47faa2b8a00ae531beb166bba4859ef1423a
1 parent
36c45bd4
fix:完善 TODO 提到的问题
Showing
22 changed files
with
328 additions
and
167 deletions
yudao-module-mall/yudao-module-product-biz/pom.xml
| ... | ... | @@ -23,7 +23,11 @@ |
| 23 | 23 | <artifactId>yudao-module-product-api</artifactId> |
| 24 | 24 | <version>${revision}</version> |
| 25 | 25 | </dependency> |
| 26 | - | |
| 26 | + <dependency> | |
| 27 | + <groupId>cn.iocoder.boot</groupId> | |
| 28 | + <artifactId>yudao-module-trade-api</artifactId> | |
| 29 | + <version>${revision}</version> | |
| 30 | + </dependency> | |
| 27 | 31 | <dependency> |
| 28 | 32 | <groupId>cn.iocoder.boot</groupId> |
| 29 | 33 | <artifactId>yudao-module-member-api</artifactId> |
| ... | ... | @@ -35,11 +39,6 @@ |
| 35 | 39 | <groupId>cn.iocoder.boot</groupId> |
| 36 | 40 | <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId> |
| 37 | 41 | </dependency> |
| 38 | - <!-- TODO 芋艿:是不是可以去掉这个依赖呀? --> | |
| 39 | - <dependency> | |
| 40 | - <groupId>cn.iocoder.boot</groupId> | |
| 41 | - <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId> | |
| 42 | - </dependency> | |
| 43 | 42 | |
| 44 | 43 | <!-- Web 相关 --> |
| 45 | 44 | <dependency> | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java
| ... | ... | @@ -5,14 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; |
| 6 | 6 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageItemRespVO; |
| 7 | 7 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 8 | -import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | |
| 9 | 8 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; |
| 10 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 11 | 9 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 12 | -import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; | |
| 13 | -import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; | |
| 14 | -import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO; | |
| 15 | -import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; | |
| 16 | 10 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; |
| 17 | 11 | import io.swagger.v3.oas.annotations.Operation; |
| 18 | 12 | import io.swagger.v3.oas.annotations.Parameter; |
| ... | ... | @@ -25,12 +19,8 @@ import org.springframework.web.bind.annotation.RestController; |
| 25 | 19 | |
| 26 | 20 | import javax.annotation.Resource; |
| 27 | 21 | import javax.validation.Valid; |
| 28 | -import java.util.List; | |
| 29 | 22 | |
| 30 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 31 | 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 32 | -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_ENABLE; | |
| 33 | -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_EXISTS; | |
| 34 | 24 | |
| 35 | 25 | @Tag(name = "用户 APP - 商品 SPU") |
| 36 | 26 | @RestController |
| ... | ... | @@ -40,10 +30,6 @@ public class AppProductSpuController { |
| 40 | 30 | |
| 41 | 31 | @Resource |
| 42 | 32 | private ProductSpuService productSpuService; |
| 43 | - @Resource | |
| 44 | - private ProductSkuService productSkuService; | |
| 45 | - @Resource | |
| 46 | - private ProductPropertyValueService productPropertyValueService; | |
| 47 | 33 | |
| 48 | 34 | @GetMapping("/page") |
| 49 | 35 | @Operation(summary = "获得商品 SPU 分页") |
| ... | ... | @@ -56,22 +42,7 @@ public class AppProductSpuController { |
| 56 | 42 | @Operation(summary = "获得商品 SPU 明细") |
| 57 | 43 | @Parameter(name = "id", description = "编号", required = true) |
| 58 | 44 | public CommonResult<AppProductSpuDetailRespVO> getSpuDetail(@RequestParam("id") Long id) { |
| 59 | - // 获得商品 SPU | |
| 60 | - ProductSpuDO spu = productSpuService.getSpu(id); | |
| 61 | - if (spu == null) { | |
| 62 | - throw exception(SPU_NOT_EXISTS); | |
| 63 | - } | |
| 64 | - if (!ProductSpuStatusEnum.isEnable(spu.getStatus())) { | |
| 65 | - throw exception(SPU_NOT_ENABLE); | |
| 66 | - } | |
| 67 | - | |
| 68 | - // 查询商品 SKU | |
| 69 | - List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spu.getId()); | |
| 70 | - // 查询商品属性 | |
| 71 | - List<ProductPropertyValueDetailRespBO> propertyValues = productPropertyValueService | |
| 72 | - .getPropertyValueDetailList(ProductSkuConvert.INSTANCE.convertPropertyValueIds(skus)); | |
| 73 | - // 拼接 | |
| 74 | - return success(ProductSpuConvert.INSTANCE.convertForGetSpuDetail(spu, skus, propertyValues)); | |
| 45 | + return success(productSpuService.getAppProductSpuDetail(id)); | |
| 75 | 46 | } |
| 76 | 47 | |
| 77 | 48 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyDO.java
| 1 | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.property; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | |
| 5 | 4 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 7 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -23,6 +22,15 @@ import lombok.*; |
| 23 | 22 | public class ProductPropertyDO extends BaseDO { |
| 24 | 23 | |
| 25 | 24 | /** |
| 25 | + * 默认属性id | |
| 26 | + */ | |
| 27 | + public static final Long PROPERTY_ID = 0L; | |
| 28 | + /** | |
| 29 | + * 默认属性名字 | |
| 30 | + */ | |
| 31 | + public static final String PROPERTY_NAME = "默认"; | |
| 32 | + | |
| 33 | + /** | |
| 26 | 34 | * 主键 |
| 27 | 35 | */ |
| 28 | 36 | @TableId | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/property/ProductPropertyValueDO.java
| 1 | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.property; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | |
| 5 | 4 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 7 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -24,6 +23,15 @@ import lombok.*; |
| 24 | 23 | public class ProductPropertyValueDO extends BaseDO { |
| 25 | 24 | |
| 26 | 25 | /** |
| 26 | + * 默认属性值id | |
| 27 | + */ | |
| 28 | + public static final Long VALUE_ID = 0L; | |
| 29 | + /** | |
| 30 | + * 默认属性值名字 | |
| 31 | + */ | |
| 32 | + public static final String VALUE_NAME = "默认"; | |
| 33 | + | |
| 34 | + /** | |
| 27 | 35 | * 主键 |
| 28 | 36 | */ |
| 29 | 37 | @TableId | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.product.dal.mysql.sku; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.lang.Assert; |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 7 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 8 | 6 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 9 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 10 | 7 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 11 | 8 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 12 | 9 | import org.apache.ibatis.annotations.Mapper; |
| ... | ... | @@ -63,23 +60,4 @@ public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> { |
| 63 | 60 | return selectList(new QueryWrapper<ProductSkuDO>().apply("stock <= warn_stock")); |
| 64 | 61 | } |
| 65 | 62 | |
| 66 | - // TODO @puhui999:貌似 IN 不出来数据哈。直接全部查询出来,处理就好列; | |
| 67 | - /** | |
| 68 | - * 更新 sku 属性值时使用的分页查询 | |
| 69 | - * | |
| 70 | - * @param pageParam 页面参数 | |
| 71 | - * @return {@link PageResult}<{@link ProductSkuDO}> | |
| 72 | - */ | |
| 73 | - default PageResult<ProductSkuDO> selectPage(PageParam pageParam) { | |
| 74 | - return selectPage(pageParam, new LambdaQueryWrapper<ProductSkuDO>().isNotNull(ProductSkuDO::getProperties)); | |
| 75 | - } | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * 查询 sku properties 不等于 null 的数量 | |
| 79 | - * | |
| 80 | - * @return {@link Long} | |
| 81 | - */ | |
| 82 | - default Long selectCountByPropertyNotNull() { | |
| 83 | - return selectCount(new LambdaQueryWrapper<ProductSkuDO>().isNotNull(ProductSkuDO::getProperties)); | |
| 84 | - } | |
| 85 | 63 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java
| ... | ... | @@ -68,7 +68,10 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { |
| 68 | 68 | throw exception(CATEGORY_EXISTS_CHILDREN); |
| 69 | 69 | } |
| 70 | 70 | // 校验分类是否绑定了 SPU |
| 71 | - validateProductCategoryIsHaveBindSpu(id); | |
| 71 | + Long count = productSpuService.getSpuCountByCategoryId(id); | |
| 72 | + if (0 != count) { | |
| 73 | + throw exception(CATEGORY_HAVE_BIND_SPU); | |
| 74 | + } | |
| 72 | 75 | // 删除 |
| 73 | 76 | productCategoryMapper.deleteById(id); |
| 74 | 77 | } |
| ... | ... | @@ -96,14 +99,6 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { |
| 96 | 99 | } |
| 97 | 100 | } |
| 98 | 101 | |
| 99 | - // TODO @puhui999:不用抽方法,因为不太会复用这个方法哈。 | |
| 100 | - private void validateProductCategoryIsHaveBindSpu(Long id) { | |
| 101 | - Long count = productSpuService.getSpuCountByCategoryId(id); | |
| 102 | - if (0 != count) { | |
| 103 | - throw exception(CATEGORY_HAVE_BIND_SPU); | |
| 104 | - } | |
| 105 | - } | |
| 106 | - | |
| 107 | 102 | @Override |
| 108 | 103 | public ProductCategoryDO getCategory(Long id) { |
| 109 | 104 | return productCategoryMapper.selectById(id); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImpl.java
| ... | ... | @@ -8,7 +8,11 @@ import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommen |
| 8 | 8 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentAdditionalReqVO; |
| 9 | 9 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; |
| 10 | 10 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; |
| 11 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 11 | 12 | import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; |
| 13 | +import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | |
| 14 | +import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi; | |
| 15 | +import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; | |
| 12 | 16 | import org.springframework.stereotype.Service; |
| 13 | 17 | import org.springframework.util.StringUtils; |
| 14 | 18 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -18,6 +22,7 @@ import java.util.Objects; |
| 18 | 22 | |
| 19 | 23 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 20 | 24 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; |
| 25 | +import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND; | |
| 21 | 26 | |
| 22 | 27 | /** |
| 23 | 28 | * 商品评论 Service 实现类 |
| ... | ... | @@ -30,6 +35,11 @@ public class ProductCommentServiceImpl implements ProductCommentService { |
| 30 | 35 | |
| 31 | 36 | @Resource |
| 32 | 37 | private ProductCommentMapper productCommentMapper; |
| 38 | + @Resource | |
| 39 | + private TradeOrderApi tradeOrderApi; | |
| 40 | + | |
| 41 | + @Resource | |
| 42 | + private ProductSpuService productSpuService; | |
| 33 | 43 | |
| 34 | 44 | @Override |
| 35 | 45 | public PageResult<ProductCommentDO> getCommentPage(ProductCommentPageReqVO pageReqVO) { |
| ... | ... | @@ -60,6 +70,16 @@ public class ProductCommentServiceImpl implements ProductCommentService { |
| 60 | 70 | @Override |
| 61 | 71 | public void createComment(ProductCommentDO productComment, Boolean system) { |
| 62 | 72 | if (!system) { |
| 73 | + // TODO 判断订单是否存在 fix | |
| 74 | + TradeOrderRespDTO order = tradeOrderApi.getOrder(productComment.getOrderId()); | |
| 75 | + if (null == order) { | |
| 76 | + throw exception(ORDER_NOT_FOUND); | |
| 77 | + } | |
| 78 | + // TODO 判断 SPU 是否存在 fix | |
| 79 | + ProductSpuDO spu = productSpuService.getSpu(productComment.getSpuId()); | |
| 80 | + if (null == spu) { | |
| 81 | + throw exception(SPU_NOT_EXISTS); | |
| 82 | + } | |
| 63 | 83 | // 判断当前订单的当前商品用户是否评价过 |
| 64 | 84 | ProductCommentDO exist = productCommentMapper.findByUserIdAndOrderIdAndSpuId(productComment.getId(), productComment.getOrderId(), productComment.getSpuId()); |
| 65 | 85 | if (null != exist) { | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java
| ... | ... | @@ -71,8 +71,8 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { |
| 71 | 71 | // 更新 |
| 72 | 72 | ProductPropertyDO updateObj = ProductPropertyConvert.INSTANCE.convert(updateReqVO); |
| 73 | 73 | productPropertyMapper.updateById(updateObj); |
| 74 | - // TODO @puhui:是不是只要传递变量,不传递整个 updateObj 变量哈 | |
| 75 | - productSkuService.updateSkuProperty(updateObj); | |
| 74 | + // 更新 sku 相关属性 | |
| 75 | + productSkuService.updateSkuProperty(updateObj.getId(), updateObj.getName()); | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | @Override | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java
| ... | ... | @@ -73,10 +73,8 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ |
| 73 | 73 | // 更新 |
| 74 | 74 | ProductPropertyValueDO updateObj = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO); |
| 75 | 75 | productPropertyValueMapper.updateById(updateObj); |
| 76 | - | |
| 77 | - // TODO 芋艿:更新时,需要看看 sku 表 fix | |
| 78 | - // TODO @puhui:是不是只要传递变量,不传递整个 updateObj 变量哈 | |
| 79 | - productSkuService.updateSkuPropertyValue(updateObj); | |
| 76 | + // 更新 sku 相关属性 | |
| 77 | + productSkuService.updateSkuPropertyValue(updateObj.getId(), updateObj.getName()); | |
| 80 | 78 | } |
| 81 | 79 | |
| 82 | 80 | @Override | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java
| ... | ... | @@ -2,8 +2,6 @@ package cn.iocoder.yudao.module.product.service.sku; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; |
| 4 | 4 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; |
| 5 | -import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; | |
| 6 | -import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; | |
| 7 | 5 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 8 | 6 | |
| 9 | 7 | import java.util.Collection; |
| ... | ... | @@ -111,16 +109,18 @@ public interface ProductSkuService { |
| 111 | 109 | /** |
| 112 | 110 | * 更新 sku 属性 |
| 113 | 111 | * |
| 114 | - * @param updateObj 属性对象 | |
| 112 | + * @param propertyId 属性 id | |
| 113 | + * @param propertyName 属性名 | |
| 115 | 114 | * @return int 影响的行数 |
| 116 | 115 | */ |
| 117 | - int updateSkuProperty(ProductPropertyDO updateObj); | |
| 116 | + int updateSkuProperty(Long propertyId, String propertyName); | |
| 118 | 117 | |
| 119 | 118 | /** |
| 120 | 119 | * 更新 sku 属性值 |
| 121 | 120 | * |
| 122 | - * @param updateObj 属性值对象 | |
| 121 | + * @param propertyValueId 属性值 id | |
| 122 | + * @param propertyValueName 属性值名字 | |
| 123 | 123 | * @return int 影响的行数 |
| 124 | 124 | */ |
| 125 | - int updateSkuPropertyValue(ProductPropertyValueDO updateObj); | |
| 125 | + int updateSkuPropertyValue(Long propertyValueId, String propertyValueName); | |
| 126 | 126 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java
| ... | ... | @@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.product.service.sku; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | 5 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; |
| 6 | +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuBaseVO; | |
| 8 | 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; |
| 9 | 8 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; |
| 10 | 9 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; |
| ... | ... | @@ -80,16 +79,25 @@ public class ProductSkuServiceImpl implements ProductSkuService { |
| 80 | 79 | |
| 81 | 80 | @Override |
| 82 | 81 | public void validateSkuList(List<ProductSkuCreateOrUpdateReqVO> skus, Boolean specType) { |
| 83 | - // 非多规格,不需要校验 | |
| 84 | - if (ObjectUtil.notEqual(specType, true)) { | |
| 85 | - return; | |
| 86 | - } | |
| 87 | - | |
| 88 | 82 | // 0、校验skus是否为空 |
| 89 | 83 | if (CollUtil.isEmpty(skus)) { |
| 90 | 84 | throw exception(SKU_NOT_EXISTS); |
| 91 | 85 | } |
| 92 | - | |
| 86 | + // 单规格处理 | |
| 87 | + if (ObjectUtil.equal(specType, false)) { | |
| 88 | + ProductSkuCreateOrUpdateReqVO skuVO = skus.get(0); | |
| 89 | + // 赋予单规格默认属性 | |
| 90 | + List<ProductSkuBaseVO.Property> properties = new ArrayList<>(); | |
| 91 | + ProductSkuBaseVO.Property property = new ProductSkuBaseVO.Property(); | |
| 92 | + property.setPropertyId(ProductPropertyDO.PROPERTY_ID); | |
| 93 | + property.setPropertyName(ProductPropertyDO.PROPERTY_NAME); | |
| 94 | + property.setValueId(ProductPropertyValueDO.VALUE_ID); | |
| 95 | + property.setValueName(ProductPropertyValueDO.VALUE_NAME); | |
| 96 | + properties.add(property); | |
| 97 | + skuVO.setProperties(properties); | |
| 98 | + // 单规格不需要后续的校验 | |
| 99 | + return; | |
| 100 | + } | |
| 93 | 101 | // 1、校验属性项存在 |
| 94 | 102 | Set<Long> propertyIds = skus.stream().filter(p -> p.getProperties() != null) |
| 95 | 103 | // 遍历多个 Property 属性 |
| ... | ... | @@ -156,81 +164,51 @@ public class ProductSkuServiceImpl implements ProductSkuService { |
| 156 | 164 | } |
| 157 | 165 | |
| 158 | 166 | @Override |
| 159 | - public int updateSkuProperty(ProductPropertyDO updateObj) { | |
| 160 | - // TODO 看了一下数据库有关于 json 字符串的处理,怕数据库出现兼容问题这里还是用数据库常规操作来实现 | |
| 161 | - // TODO @puhui999:直接全部查询处理,批量处理就好列;一般项目的商品不会超过几十万的哈。 | |
| 162 | - Long count = productSkuMapper.selectCountByPropertyNotNull(); | |
| 163 | - int currentPage = 1; | |
| 167 | + public int updateSkuProperty(Long propertyId, String propertyName) { | |
| 168 | + // 获取所有的 sku | |
| 169 | + List<ProductSkuDO> skuDOList = productSkuMapper.selectList(); | |
| 170 | + // 处理后需要更新的 sku | |
| 164 | 171 | List<ProductSkuDO> updateSkus = new ArrayList<>(); |
| 165 | - if (count == 0) { | |
| 172 | + if (CollUtil.isEmpty(skuDOList)) { | |
| 166 | 173 | return 0; |
| 167 | 174 | } |
| 168 | - int pageSize = 100; | |
| 169 | - for (int i = 0; i <= count / 100; i++) { | |
| 170 | - PageParam pageParam = new PageParam().setPageNo(currentPage + i).setPageSize(pageSize); | |
| 171 | - // 分页查找出 sku 属性不为 null 的 | |
| 172 | - PageResult<ProductSkuDO> skuPage = productSkuMapper.selectPage(pageParam); | |
| 173 | - List<ProductSkuDO> records = skuPage.getList(); | |
| 174 | - if (CollUtil.isEmpty(records)) { | |
| 175 | - break; | |
| 176 | - } | |
| 177 | - records.stream().filter(sku -> sku.getProperties() != null) | |
| 178 | - .forEach(sku -> sku.getProperties().forEach(property -> { | |
| 179 | - if (property.getPropertyId().equals(updateObj.getId())) { | |
| 180 | - property.setPropertyName(updateObj.getName()); | |
| 181 | - updateSkus.add(sku); | |
| 182 | - } | |
| 183 | - })); | |
| 184 | - } | |
| 175 | + skuDOList.stream().filter(sku -> sku.getProperties() != null) | |
| 176 | + .forEach(sku -> sku.getProperties().forEach(property -> { | |
| 177 | + if (property.getPropertyId().equals(propertyId)) { | |
| 178 | + property.setPropertyName(propertyName); | |
| 179 | + updateSkus.add(sku); | |
| 180 | + } | |
| 181 | + })); | |
| 185 | 182 | if (CollUtil.isEmpty(updateSkus)) { |
| 186 | 183 | return 0; |
| 187 | 184 | } |
| 188 | - // TODO @puhui999:貌似 updateBatch 自己会拆分批次,这里不用再拆分了 | |
| 189 | - // 每批处理的大小 | |
| 190 | - int batchSize = 1000; | |
| 191 | - for (int i = 0; i < updateSkus.size(); i += batchSize) { | |
| 192 | - List<ProductSkuDO> batchSkuDOs = updateSkus.subList(i, Math.min(i + batchSize, updateSkus.size())); | |
| 193 | - productSkuMapper.updateBatch(batchSkuDOs, batchSize); | |
| 194 | - } | |
| 185 | + | |
| 186 | + productSkuMapper.updateBatch(updateSkus); | |
| 195 | 187 | return updateSkus.size(); |
| 196 | 188 | } |
| 197 | 189 | |
| 198 | 190 | @Override |
| 199 | - public int updateSkuPropertyValue(ProductPropertyValueDO updateObj) { | |
| 200 | - // TODO 看了一下数据库有关于 json 字符串的处理,怕数据库出现兼容问题这里还是用数据库常规操作来实现 | |
| 201 | - Long count = productSkuMapper.selectCountByPropertyNotNull(); | |
| 202 | - int currentPage = 1; | |
| 191 | + public int updateSkuPropertyValue(Long propertyValueId, String propertyValueName) { | |
| 192 | + // 获取所有的 sku | |
| 193 | + List<ProductSkuDO> skuDOList = productSkuMapper.selectList(); | |
| 194 | + // 处理后需要更新的 sku | |
| 203 | 195 | List<ProductSkuDO> updateSkus = new ArrayList<>(); |
| 204 | - if (count == 0) { | |
| 196 | + if (CollUtil.isEmpty(skuDOList)) { | |
| 205 | 197 | return 0; |
| 206 | 198 | } |
| 207 | - int pageSize = 100; | |
| 208 | - for (int i = 0; i <= count / 100; i++) { | |
| 209 | - PageParam pageParam = new PageParam().setPageNo(currentPage + i).setPageSize(pageSize); | |
| 210 | - // 分页查找出 sku 属性不为 null 的 | |
| 211 | - PageResult<ProductSkuDO> skuPage = productSkuMapper.selectPage(pageParam); | |
| 212 | - List<ProductSkuDO> records = skuPage.getList(); | |
| 213 | - if (CollUtil.isEmpty(records)) { | |
| 214 | - break; | |
| 215 | - } | |
| 216 | - records.stream() | |
| 217 | - .filter(sku -> sku.getProperties() != null) | |
| 218 | - .forEach(sku -> sku.getProperties().forEach(property -> { | |
| 219 | - if (property.getValueId().equals(updateObj.getId())) { | |
| 220 | - property.setValueName(updateObj.getName()); | |
| 221 | - updateSkus.add(sku); | |
| 222 | - } | |
| 223 | - })); | |
| 224 | - } | |
| 199 | + skuDOList.stream() | |
| 200 | + .filter(sku -> sku.getProperties() != null) | |
| 201 | + .forEach(sku -> sku.getProperties().forEach(property -> { | |
| 202 | + if (property.getValueId().equals(propertyValueId)) { | |
| 203 | + property.setValueName(propertyValueName); | |
| 204 | + updateSkus.add(sku); | |
| 205 | + } | |
| 206 | + })); | |
| 225 | 207 | if (CollUtil.isEmpty(updateSkus)) { |
| 226 | 208 | return 0; |
| 227 | 209 | } |
| 228 | - // 每批处理的大小 | |
| 229 | - int batchSize = 1000; | |
| 230 | - for (int i = 0; i < updateSkus.size(); i += batchSize) { | |
| 231 | - List<ProductSkuDO> batchSkuDOs = updateSkus.subList(i, Math.min(i + batchSize, updateSkus.size())); | |
| 232 | - productSkuMapper.updateBatch(batchSkuDOs, batchSize); | |
| 233 | - } | |
| 210 | + | |
| 211 | + productSkuMapper.updateBatch(updateSkus); | |
| 234 | 212 | return updateSkus.size(); |
| 235 | 213 | } |
| 236 | 214 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.service.spu; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 5 | +import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; | |
| 5 | 6 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 6 | 7 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 7 | 8 | |
| ... | ... | @@ -135,4 +136,11 @@ public interface ProductSpuService { |
| 135 | 136 | */ |
| 136 | 137 | Long getSpuCountByCategoryId(Long id); |
| 137 | 138 | |
| 139 | + /** | |
| 140 | + * 通过 spu id 获取商品 SPU 明细 | |
| 141 | + * | |
| 142 | + * @param id id | |
| 143 | + * @return 用户 App - 商品 SPU 明细 | |
| 144 | + */ | |
| 145 | + AppProductSpuDetailRespVO getAppProductSpuDetail(Long id); | |
| 138 | 146 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java
| ... | ... | @@ -7,15 +7,21 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 7 | 7 | import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryListReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; |
| 9 | 9 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 10 | +import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; | |
| 10 | 11 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 12 | +import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | |
| 11 | 13 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; |
| 12 | 14 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; |
| 15 | +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; | |
| 16 | +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; | |
| 13 | 17 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 14 | 18 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 15 | 19 | import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; |
| 16 | 20 | import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum; |
| 17 | 21 | import cn.iocoder.yudao.module.product.service.brand.ProductBrandService; |
| 18 | 22 | import cn.iocoder.yudao.module.product.service.category.ProductCategoryService; |
| 23 | +import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; | |
| 24 | +import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO; | |
| 19 | 25 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; |
| 20 | 26 | import org.springframework.context.annotation.Lazy; |
| 21 | 27 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -50,6 +56,9 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 50 | 56 | private ProductBrandService brandService; |
| 51 | 57 | @Resource |
| 52 | 58 | private ProductCategoryService categoryService; |
| 59 | + @Resource | |
| 60 | + @Lazy // 循环依赖,避免报错 | |
| 61 | + private ProductPropertyValueService productPropertyValueService; | |
| 53 | 62 | |
| 54 | 63 | @Override |
| 55 | 64 | @Transactional(rollbackFor = Exception.class) |
| ... | ... | @@ -140,7 +149,11 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 140 | 149 | // 校验存在 |
| 141 | 150 | validateSpuExists(id); |
| 142 | 151 | // 校验商品状态不是回收站不能删除 |
| 143 | - validateSpuStatus(id); | |
| 152 | + ProductSpuDO spuDO = productSpuMapper.selectById(id); | |
| 153 | + // 判断 SPU 状态是否为回收站 | |
| 154 | + if (ObjectUtil.notEqual(spuDO.getStatus(), ProductSpuStatusEnum.RECYCLE.getStatus())) { | |
| 155 | + throw exception(SPU_NOT_RECYCLE); | |
| 156 | + } | |
| 144 | 157 | |
| 145 | 158 | // 删除 SPU |
| 146 | 159 | productSpuMapper.deleteById(id); |
| ... | ... | @@ -154,20 +167,6 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 154 | 167 | } |
| 155 | 168 | } |
| 156 | 169 | |
| 157 | - /** | |
| 158 | - * 验证 SPU 状态是否为回收站 | |
| 159 | - * | |
| 160 | - * @param id id | |
| 161 | - */ | |
| 162 | - // TODO puhui999:感觉不用独立出来一个方法,直接在 deleteSpu 方法中校验即可 | |
| 163 | - private void validateSpuStatus(Long id) { | |
| 164 | - ProductSpuDO spuDO = productSpuMapper.selectById(id); | |
| 165 | - // 判断 SPU 状态是否为回收站 | |
| 166 | - if (ObjectUtil.notEqual(spuDO.getStatus(), ProductSpuStatusEnum.RECYCLE.getStatus())) { | |
| 167 | - throw exception(SPU_NOT_RECYCLE); | |
| 168 | - } | |
| 169 | - } | |
| 170 | - | |
| 171 | 170 | @Override |
| 172 | 171 | public ProductSpuDO getSpu(Long id) { |
| 173 | 172 | return productSpuMapper.selectById(id); |
| ... | ... | @@ -257,4 +256,35 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 257 | 256 | return productSpuMapper.selectCount(ProductSpuDO::getCategoryId, id); |
| 258 | 257 | } |
| 259 | 258 | |
| 259 | + @Override | |
| 260 | + public AppProductSpuDetailRespVO getAppProductSpuDetail(Long id) { | |
| 261 | + // 获得商品 SPU | |
| 262 | + ProductSpuDO spu = getSpu(id); | |
| 263 | + if (spu == null) { | |
| 264 | + throw exception(SPU_NOT_EXISTS); | |
| 265 | + } | |
| 266 | + if (!ProductSpuStatusEnum.isEnable(spu.getStatus())) { | |
| 267 | + throw exception(SPU_NOT_ENABLE); | |
| 268 | + } | |
| 269 | + | |
| 270 | + // 查询商品 SKU | |
| 271 | + List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spu.getId()); | |
| 272 | + List<ProductPropertyValueDetailRespBO> propertyValues = new ArrayList<>(); | |
| 273 | + // 单规格商品 赋予默认属性值 | |
| 274 | + if (ObjectUtil.equal(spu.getSpecType(), false)) { | |
| 275 | + ProductPropertyValueDetailRespBO respBO = new ProductPropertyValueDetailRespBO(); | |
| 276 | + respBO.setPropertyId(ProductPropertyDO.PROPERTY_ID); | |
| 277 | + respBO.setPropertyName(ProductPropertyDO.PROPERTY_NAME); | |
| 278 | + respBO.setValueId(ProductPropertyValueDO.VALUE_ID); | |
| 279 | + respBO.setValueName(ProductPropertyValueDO.VALUE_NAME); | |
| 280 | + propertyValues.add(respBO); | |
| 281 | + } else { | |
| 282 | + // 多规格商品则查询商品属性 | |
| 283 | + propertyValues = productPropertyValueService | |
| 284 | + .getPropertyValueDetailList(ProductSkuConvert.INSTANCE.convertPropertyValueIds(skus)); | |
| 285 | + } | |
| 286 | + // 拼接 | |
| 287 | + return ProductSpuConvert.INSTANCE.convertForGetSpuDetail(spu, skus, propertyValues); | |
| 288 | + } | |
| 289 | + | |
| 260 | 290 | } | ... | ... |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.api.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 订单 API 接口 | |
| 7 | + * | |
| 8 | + * @author HUIHUI | |
| 9 | + */ | |
| 10 | +public interface TradeOrderApi { | |
| 11 | + | |
| 12 | + /** | |
| 13 | + * 获取订单通过订单 id | |
| 14 | + * | |
| 15 | + * @param id id | |
| 16 | + * @return 订单信息 Response DTO | |
| 17 | + */ | |
| 18 | + TradeOrderRespDTO getOrder(Long id); | |
| 19 | + | |
| 20 | +} | ... | ... |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/dto/TradeOrderRespDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.api.order.dto; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.TerminalEnum; | |
| 4 | +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCancelTypeEnum; | |
| 5 | +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; | |
| 6 | +import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 订单信息 Response DTO | |
| 13 | + * | |
| 14 | + * @author HUIHUI | |
| 15 | + */ | |
| 16 | +@Data | |
| 17 | +public class TradeOrderRespDTO { | |
| 18 | + | |
| 19 | + // ========== 订单基本信息 ========== | |
| 20 | + /** | |
| 21 | + * 订单编号,主键自增 | |
| 22 | + */ | |
| 23 | + private Long id; | |
| 24 | + /** | |
| 25 | + * 订单流水号 | |
| 26 | + * <p> | |
| 27 | + * 例如说,1146347329394184195 | |
| 28 | + */ | |
| 29 | + private String no; | |
| 30 | + /** | |
| 31 | + * 订单类型 | |
| 32 | + * <p> | |
| 33 | + * 枚举 {@link TradeOrderTypeEnum} | |
| 34 | + */ | |
| 35 | + private Integer type; | |
| 36 | + /** | |
| 37 | + * 订单来源 | |
| 38 | + * <p> | |
| 39 | + * 枚举 {@link TerminalEnum} | |
| 40 | + */ | |
| 41 | + private Integer terminal; | |
| 42 | + /** | |
| 43 | + * 用户编号 | |
| 44 | + * <p> | |
| 45 | + * 关联 MemberUserDO 的 id 编号 | |
| 46 | + */ | |
| 47 | + private Long userId; | |
| 48 | + /** | |
| 49 | + * 用户 IP | |
| 50 | + */ | |
| 51 | + private String userIp; | |
| 52 | + /** | |
| 53 | + * 用户备注 | |
| 54 | + */ | |
| 55 | + private String userRemark; | |
| 56 | + /** | |
| 57 | + * 订单状态 | |
| 58 | + * <p> | |
| 59 | + * 枚举 {@link TradeOrderStatusEnum} | |
| 60 | + */ | |
| 61 | + private Integer status; | |
| 62 | + /** | |
| 63 | + * 购买的商品数量 | |
| 64 | + */ | |
| 65 | + private Integer productCount; | |
| 66 | + /** | |
| 67 | + * 订单完成时间 | |
| 68 | + */ | |
| 69 | + private LocalDateTime finishTime; | |
| 70 | + /** | |
| 71 | + * 订单取消时间 | |
| 72 | + */ | |
| 73 | + private LocalDateTime cancelTime; | |
| 74 | + /** | |
| 75 | + * 取消类型 | |
| 76 | + * <p> | |
| 77 | + * 枚举 {@link TradeOrderCancelTypeEnum} | |
| 78 | + */ | |
| 79 | + private Integer cancelType; | |
| 80 | + /** | |
| 81 | + * 商家备注 | |
| 82 | + */ | |
| 83 | + private String remark; | |
| 84 | + /** | |
| 85 | + * 是否评价 | |
| 86 | + * <p> | |
| 87 | + * true - 已评价 | |
| 88 | + * false - 未评价 | |
| 89 | + */ | |
| 90 | + private Boolean commentStatus; | |
| 91 | + | |
| 92 | +} | ... | ... |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/package-info.java
0 → 100644
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApiImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.api.order; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; | |
| 4 | +import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert; | |
| 5 | +import cn.iocoder.yudao.module.trade.service.order.TradeOrderService; | |
| 6 | +import org.springframework.stereotype.Service; | |
| 7 | +import org.springframework.validation.annotation.Validated; | |
| 8 | + | |
| 9 | +import javax.annotation.Resource; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 订单 API 接口实现类 | |
| 13 | + * | |
| 14 | + * @author HUIHUI | |
| 15 | + */ | |
| 16 | +@Service | |
| 17 | +@Validated | |
| 18 | +public class TradeOrderApiImpl implements TradeOrderApi { | |
| 19 | + | |
| 20 | + @Resource | |
| 21 | + private TradeOrderService tradeOrderService; | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public TradeOrderRespDTO getOrder(Long id) { | |
| 25 | + return TradeOrderConvert.INSTANCE.convert(tradeOrderService.getOrder(id)); | |
| 26 | + } | |
| 27 | + | |
| 28 | +} | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/api/package-info.java
0 → 100644
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressTemplateController.java
| ... | ... | @@ -70,14 +70,14 @@ public class DeliveryExpressTemplateController { |
| 70 | 70 | return success(DeliveryExpressTemplateConvert.INSTANCE.convertList(list)); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - // TODO @puhui999:DeliveryExpressTemplateRespVO 搞个 simple 的哈 | |
| 73 | + // TODO @puhui999:DeliveryExpressTemplateRespVO 搞个 simple 的哈 fix | |
| 74 | 74 | @GetMapping("/list-all-simple") |
| 75 | 75 | @Operation(summary = "获取快递模版精简信息列表", description = "主要用于前端的下拉选项") |
| 76 | - public CommonResult<List<DeliveryExpressTemplateRespVO>> getSimpleTemplateList() { | |
| 76 | + public CommonResult<List<DeliveryExpressTemplateSimpleRespVO>> getSimpleTemplateList() { | |
| 77 | 77 | // 获取运费模版列表,只要开启状态的 |
| 78 | 78 | List<DeliveryExpressTemplateDO> list = deliveryExpressTemplateService.getDeliveryExpressTemplateList(); |
| 79 | 79 | // 排序后,返回给前端 |
| 80 | - return success(DeliveryExpressTemplateConvert.INSTANCE.convertList(list)); | |
| 80 | + return success(DeliveryExpressTemplateConvert.INSTANCE.convertList1(list)); | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | @GetMapping("/page") | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateSimpleRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.AllArgsConstructor; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.NoArgsConstructor; | |
| 7 | + | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - 模版精简信息 Response VO") | |
| 10 | +@Data | |
| 11 | +@NoArgsConstructor | |
| 12 | +@AllArgsConstructor | |
| 13 | +public class DeliveryExpressTemplateSimpleRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "模版编号", required = true, example = "1024") | |
| 16 | + private Long id; | |
| 17 | + | |
| 18 | + @Schema(description = "模板名称", required = true, example = "测试模版") | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressTemplateConvert.java
| ... | ... | @@ -28,11 +28,13 @@ public interface DeliveryExpressTemplateConvert { |
| 28 | 28 | |
| 29 | 29 | List<DeliveryExpressTemplateRespVO> convertList(List<DeliveryExpressTemplateDO> list); |
| 30 | 30 | |
| 31 | + List<DeliveryExpressTemplateSimpleRespVO> convertList1(List<DeliveryExpressTemplateDO> list); | |
| 32 | + | |
| 31 | 33 | PageResult<DeliveryExpressTemplateRespVO> convertPage(PageResult<DeliveryExpressTemplateDO> page); |
| 32 | 34 | |
| 33 | 35 | default DeliveryExpressTemplateDetailRespVO convert(DeliveryExpressTemplateDO bean, |
| 34 | 36 | List<DeliveryExpressTemplateChargeDO> chargeList, |
| 35 | - List<DeliveryExpressTemplateFreeDO> freeList){ | |
| 37 | + List<DeliveryExpressTemplateFreeDO> freeList) { | |
| 36 | 38 | DeliveryExpressTemplateDetailRespVO respVO = convert2(bean); |
| 37 | 39 | respVO.setTemplateCharge(convertTemplateChargeList(chargeList)); |
| 38 | 40 | respVO.setTemplateFree(convertTemplateFreeList(freeList)); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java
| ... | ... | @@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 11 | 11 | import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO; |
| 12 | 12 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; |
| 13 | 13 | import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateReqDTO; |
| 14 | +import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; | |
| 14 | 15 | import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; |
| 15 | 16 | import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; |
| 16 | 17 | import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDetailRespVO; |
| ... | ... | @@ -62,6 +63,8 @@ public interface TradeOrderConvert { |
| 62 | 63 | TradeOrderDO convert(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO, |
| 63 | 64 | TradePriceCalculateRespBO calculateRespBO, AddressRespDTO address); |
| 64 | 65 | |
| 66 | + TradeOrderRespDTO convert(TradeOrderDO orderDO); | |
| 67 | + | |
| 65 | 68 | default List<TradeOrderItemDO> convertList(TradeOrderDO tradeOrderDO, TradePriceCalculateRespBO calculateRespBO) { |
| 66 | 69 | return CollectionUtils.convertList(calculateRespBO.getItems(), item -> { |
| 67 | 70 | TradeOrderItemDO orderItem = convert(item); | ... | ... |