From 8c4e3db32b0769034ccb0a7e8ecd4809d953881c Mon Sep 17 00:00:00 2001 From: luowenfeng <1092164058@qq.com> Date: Mon, 24 Oct 2022 10:28:07 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feature(=E5=95=86=E5=9F=8E):=20=E5=95=86?= =?UTF-8?q?=E5=9F=8Ereview=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/value/ProductPropertyValueUpdateReqVO.java | 2 +- .../admin/spu/vo/ProductSpuDetailRespVO.java | 5 ++--- .../dal/mysql/property/ProductPropertyMapper.java | 3 +-- .../mysql/property/ProductPropertyValueMapper.java | 3 +-- .../product/dal/mysql/sku/ProductSkuMapper.java | 3 +-- .../service/property/ProductPropertyServiceImpl.java | 11 ++++------- .../property/ProductPropertyValueServiceImpl.java | 5 +++-- .../product/service/sku/ProductSkuServiceImpl.java | 2 +- .../product/service/spu/ProductSpuServiceImpl.java | 1 - 9 files changed, 14 insertions(+), 21 deletions(-) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java index 4a1bc5778..2437600a8 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java @@ -12,6 +12,6 @@ public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO @ApiModelProperty(value = "主键", required = true, example = "1024") @NotNull(message = "主键不能为空") - private Integer id; + private Long id; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java index d7c43b90f..bba1ba058 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java @@ -55,9 +55,8 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO { } - // TODO @luowenfeng: categoryIds => categoryId,example 也要改下哈 - @ApiModelProperty(value = "分类 id 数组,一直递归到一级父节点", example = "[1,2,4]") - private Long categoryIds; + @ApiModelProperty(value = "分类 id 数组,一直递归到一级父节点", example = "4") + private Long categoryId; // TODO @芋艿:在瞅瞅~ @ApiModelProperty(value = "规格属性修改和详情展示组合", example = "[{\"propertyId\":2,\"name\":\"内存\",\"propertyValues\":[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]},{\"propertyId\":3,\"name\":\"尺寸\",\"propertyValues\":[{\"v1\":16,\"v2\":\"6.1\"},{\"v1\":15,\"v2\":\"5.7\"}]}]") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java index 697beb22d..890df3477 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java @@ -25,10 +25,9 @@ public interface ProductPropertyMapper extends BaseMapperX { .orderByDesc(ProductPropertyDO::getId)); } - // TODO @luowenfeng: selectByNameLike,这样更清晰哈。 default ProductPropertyDO selectByName(String name) { return selectOne(new LambdaQueryWrapperX() - .likeIfPresent(ProductPropertyDO::getName, name)); + .eqIfPresent(ProductPropertyDO::getName, name)); } } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyValueMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyValueMapper.java index 4853afeae..ca9bafab2 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyValueMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyValueMapper.java @@ -17,8 +17,7 @@ import java.util.List; @Mapper public interface ProductPropertyValueMapper extends BaseMapperX { - // TODO @luowenfeng: selectListByPropertyId 是不是就可以啦 - default List selectListByPropertyValueListByPropertyId(List propertyIds) { + default List selectListByPropertyId(List propertyIds) { return selectList(new LambdaQueryWrapperX() .inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds)); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java index 6698007c6..b9dde2e68 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java @@ -40,8 +40,7 @@ public interface ProductSkuMapper extends BaseMapperX { } } - // TODO @luowenfeng: selectListByRemind,虽然不是很好,但是感觉会更清晰一些 - default List selectRemindSpuIds(){ + default List selectListByRemind(){ return selectList(new QueryWrapper().apply("stock <= warn_stock")); } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java index 17e38fc98..74e370f9c 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java @@ -19,6 +19,7 @@ import javax.annotation.Resource; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Objects; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_EXISTS; @@ -58,8 +59,8 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) { // 校验存在 this.validatePropertyExists(updateReqVO.getId()); - // TODO @luowenfeng:如果是自己的情况下,名字相同也是 ok 的呀~ - if (productPropertyMapper.selectByName(updateReqVO.getName()) != null) { + ProductPropertyDO productPropertyDO = productPropertyMapper.selectByName(updateReqVO.getName()); + if (productPropertyDO != null && !productPropertyDO.getId().equals(updateReqVO.getId())) { throw exception(PROPERTY_EXISTS); } // 更新 @@ -97,10 +98,6 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { return ProductPropertyConvert.INSTANCE.convertPage(pageResult); } - private List getPropertyValueListByPropertyId(List propertyIds) { - return productPropertyValueMapper.selectListByPropertyValueListByPropertyId(propertyIds); - } - @Override public ProductPropertyRespVO getProperty(Long id) { ProductPropertyDO property = productPropertyMapper.selectById(id); @@ -117,7 +114,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { List propertyList = getPropertyList(listReqVO); // 查询属性值 - List valueDOList = productPropertyValueMapper.selectListByPropertyValueListByPropertyId(CollectionUtils.convertList(propertyList, ProductPropertyRespVO::getId)); + List valueDOList = productPropertyValueMapper.selectListByPropertyId(CollectionUtils.convertList(propertyList, ProductPropertyRespVO::getId)); Map> valueDOMap = CollectionUtils.convertMultiMap(valueDOList, ProductPropertyValueDO::getPropertyId); return CollectionUtils.convertList(propertyList, m -> { ProductPropertyAndValueRespVO productPropertyAndValueRespVO = ProductPropertyConvert.INSTANCE.convert(m); diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java index 551fb00e3..5addb37e8 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.List; +import java.util.Objects; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS; @@ -42,8 +43,8 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ @Override public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) { - // TODO @luowenfeng:如果是自己的情况下,名字相同也是 ok 的呀~ - if (productPropertyValueMapper.selectByName(updateReqVO.getPropertyId(), updateReqVO.getName()) != null) { + ProductPropertyValueDO productPropertyValueDO = productPropertyValueMapper.selectByName(updateReqVO.getPropertyId(), updateReqVO.getName()); + if (productPropertyValueDO != null && !productPropertyValueDO.getId().equals(updateReqVO.getId())) { throw exception(PROPERTY_VALUE_EXISTS); } ProductPropertyValueDO convert = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO); diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java index cd9b68bff..8889e5a73 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java @@ -139,7 +139,7 @@ public class ProductSkuServiceImpl implements ProductSkuService { @Override public List getRemindSpuIds() { - return productSkuMapper.selectRemindSpuIds(); + return productSkuMapper.selectListByRemind(); } @Override diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 6cdebdee4..aa8e59e5f 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -164,7 +164,6 @@ public class ProductSpuServiceImpl implements ProductSpuService { }); respVO.setProductPropertyViews(productPropertyViews); } - respVO.setCategoryIds(respVO.getCategoryId()); } return respVO; } From dc4e3fcd6e32b4c99ba09c35f8f32680454999e0 Mon Sep 17 00:00:00 2001 From: luowenfeng <1092164058@qq.com> Date: Mon, 24 Oct 2022 10:30:47 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feature(=E5=95=86=E5=9F=8E):=20=E5=95=86?= =?UTF-8?q?=E5=9F=8Ereview=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin/src/views/mall/product/spu/save.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-ui-admin/src/views/mall/product/spu/save.vue b/yudao-ui-admin/src/views/mall/product/spu/save.vue index ea08de23b..5f6412d6d 100644 --- a/yudao-ui-admin/src/views/mall/product/spu/save.vue +++ b/yudao-ui-admin/src/views/mall/product/spu/save.vue @@ -458,7 +458,7 @@ export default { this.baseForm.id = data.id; this.baseForm.name = data.name; this.baseForm.sellPoint = data.sellPoint; - this.baseForm.categoryIds = data.categoryIds; + this.baseForm.categoryIds = data.categoryId; this.baseForm.videoUrl = data.videoUrl; this.baseForm.sort = data.sort; this.baseForm.description = data.description; From 356642ecea9136ef0458085e84d17de352df8944 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 25 Oct 2022 22:13:31 +0800 Subject: [PATCH 3/5] =?UTF-8?q?review=20=E5=95=86=E5=93=81=E7=9A=84=20save?= =?UTF-8?q?=20=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/ProductCategoryDO.java | 2 - .../spu/ProductSpuServiceImplTest.java | 12 ++--- .../dal/dataobject/order/TradeOrderDO.java | 2 +- .../service/order/TradeOrderServiceImpl.java | 2 +- .../src/views/mall/product/spu/save.vue | 51 +++++++++---------- 5 files changed, 30 insertions(+), 39 deletions(-) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java index 6671e9b44..93ec925a9 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java @@ -64,6 +64,4 @@ public class ProductCategoryDO extends BaseDO { */ private Integer status; - // TODO 芋艿:is_recommend 是否首页推荐:1-是;0-否 - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java index a254f636d..8f76cf7b2 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java +++ b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java @@ -29,9 +29,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -221,15 +219,15 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { // randomPojo(ProductSkuDO.class, o -> o.setSpuId(createReqVO.getId())) ); - Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); +// Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); // 调用 ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); - productSpuPageReqVO.setTabStatus(2); +// productSpuPageReqVO.setTabStatus(2); PageResult spuPage = productSpuService.getSpuPage(productSpuPageReqVO); - ArrayList resultRemindSpuIds = new ArrayList<>(); + Set resultRemindSpuIds = new HashSet<>(); resultRemindSpuIds.add(null); PageResult result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO, resultRemindSpuIds)); Assertions.assertIterableEquals(result.getList(), spuPage.getList()); @@ -249,7 +247,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { // randomPojo(ProductSkuDO.class, o -> o.setSpuId(createReqVO.getId())) ); - Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); +// Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); // 调用 AppSpuPageReqVO appSpuPageReqVO = new AppSpuPageReqVO(); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java index 77bdf66b0..0be06c418 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java @@ -38,7 +38,7 @@ public class TradeOrderDO extends BaseDO { * * 例如说,1146347329394184195 */ - private String sn; + private String no; /** * 订单类型 * diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java index f47152150..a6943909d 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java @@ -123,7 +123,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { Long loginUserId, String clientIp) { tradeOrderDO.setUserId(loginUserId); tradeOrderDO.setUserIp(clientIp); - tradeOrderDO.setSn(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的; + tradeOrderDO.setNo(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的; tradeOrderDO.setStatus(TradeOrderStatusEnum.WAITING_PAYMENT.getStatus()); tradeOrderDO.setType(TradeOrderTypeEnum.NORMAL.getType()); tradeOrderDO.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus()); diff --git a/yudao-ui-admin/src/views/mall/product/spu/save.vue b/yudao-ui-admin/src/views/mall/product/spu/save.vue index f24644135..b06c6b736 100644 --- a/yudao-ui-admin/src/views/mall/product/spu/save.vue +++ b/yudao-ui-admin/src/views/mall/product/spu/save.vue @@ -1,11 +1,14 @@ - 添加规格项目 - + 添加规格项目 @@ -76,15 +77,13 @@ @@ -112,17 +110,14 @@ @@ -134,17 +129,17 @@