修正相关问题让服务正常启动,改动位置都已加上TODO记录

pull/2/head
puhui999 2023-04-24 10:50:40 +08:00
parent 6786aa352b
commit c3e36ba9da
13 changed files with 45 additions and 40 deletions

View File

@ -16,7 +16,7 @@
<module>yudao-module-member</module> <module>yudao-module-member</module>
<module>yudao-module-system</module> <module>yudao-module-system</module>
<module>yudao-module-infra</module> <module>yudao-module-infra</module>
<!-- <module>yudao-module-pay</module>--> <module>yudao-module-pay</module>
<!-- <module>yudao-module-bpm</module>--> <!-- <module>yudao-module-bpm</module>-->
<!-- <module>yudao-module-report</module>--> <!-- <module>yudao-module-report</module>-->
<!-- <module>yudao-module-mp</module>--> <!-- <module>yudao-module-mp</module>-->

View File

@ -79,7 +79,7 @@ public class ProductSpuRespDTO {
* <p> * <p>
* {@link ProductSpuSpecTypeEnum} * {@link ProductSpuSpecTypeEnum}
*/ */
private Integer specType; private Boolean specType;
/** /**
* 使 * 使
* <p> * <p>

View File

@ -16,15 +16,15 @@ import java.util.Arrays;
@Deprecated @Deprecated
public enum ProductSpuSpecTypeEnum implements IntArrayValuable { public enum ProductSpuSpecTypeEnum implements IntArrayValuable {
RECYCLE(1, "统一规格"), RECYCLE(false, "统一规格"),
DISABLE(2, "多规格"); DISABLE(true, "多规格");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuSpecTypeEnum::getType).toArray();
//public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductSpuSpecTypeEnum::getType).toArray();// TODO 暂时先这样跑起来
public static final int[] ARRAYS = {};
/** /**
* *
*/ */
private final Integer type; private final Boolean type;
/** /**
* *
*/ */

View File

@ -57,8 +57,7 @@ public class ProductSpuBaseVO {
@Schema(description = "规格类型", required = true, example = "1") @Schema(description = "规格类型", required = true, example = "1")
@NotNull(message = "规格类型不能为空") @NotNull(message = "规格类型不能为空")
@InEnum(ProductSpuSpecTypeEnum.class) private Boolean specType;
private Integer specType;
@Schema(description = "是否展示库存", required = true, example = "true") @Schema(description = "是否展示库存", required = true, example = "true")
@NotNull(message = "是否展示库存不能为空") @NotNull(message = "是否展示库存不能为空")

View File

@ -35,8 +35,8 @@ public class AppProductSpuDetailRespVO {
// ========== SKU 相关字段 ========= // ========== SKU 相关字段 =========
@Schema(description = "规格类型", required = true, example = "1") @Schema(description = "规格类型", required = true, example = "true")
private Integer specType; private Boolean specType;
@Schema(description = "是否展示库存", required = true, example = "true") @Schema(description = "是否展示库存", required = true, example = "true")
private Boolean showStock; private Boolean showStock;

View File

@ -37,7 +37,8 @@ public interface ProductSkuConvert {
default List<ProductSkuDO> convertList06(List<ProductSkuCreateOrUpdateReqVO> list, Long spuId, String spuName) { default List<ProductSkuDO> convertList06(List<ProductSkuCreateOrUpdateReqVO> list, Long spuId, String spuName) {
List<ProductSkuDO> result = convertList06(list); List<ProductSkuDO> result = convertList06(list);
result.forEach(item -> item.setSpuId(spuId).setSpuName(spuName)); // result.forEach(item -> item.setSpuId(spuId).setSpuName(spuName)); TODO ProductSkuDO中已经没有name相关属性
result.forEach(item -> item.setSpuId(spuId));
return result; return result;
} }

View File

@ -26,8 +26,8 @@ public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> {
default List<ProductSkuDO> selectListBySpuIdAndStatus(Long spuId, default List<ProductSkuDO> selectListBySpuIdAndStatus(Long spuId,
Integer status) { Integer status) {
return selectList(new LambdaQueryWrapperX<ProductSkuDO>() return selectList(new LambdaQueryWrapperX<ProductSkuDO>()
.eq(ProductSkuDO::getSpuId, spuId) .eq(ProductSkuDO::getSpuId, spuId)// eqIfPresent(ProductSkuDO::getStatus, status) TODO ProductSkuDO已经没有status属性
.eqIfPresent(ProductSkuDO::getStatus, status)); );
} }
default List<ProductSkuDO> selectListBySpuId(Collection<Long> spuIds) { default List<ProductSkuDO> selectListBySpuId(Collection<Long> spuIds) {

View File

@ -52,7 +52,8 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
.eqIfPresent(ProductSpuDO::getStatus, status); .eqIfPresent(ProductSpuDO::getStatus, status);
// 排序逻辑 // 排序逻辑
if (Objects.equals(pageReqVO.getSortField(), AppProductSpuPageReqVO.SORT_FIELD_PRICE)) { if (Objects.equals(pageReqVO.getSortField(), AppProductSpuPageReqVO.SORT_FIELD_PRICE)) {
query.orderBy(true, pageReqVO.getSortAsc(), ProductSpuDO::getMaxPrice); // TODO ProductSpuDO 已经没有maxPrice 属性
//query.orderBy(true, pageReqVO.getSortAsc(), ProductSpuDO::getMaxPrice);
} else if (Objects.equals(pageReqVO.getSortField(), AppProductSpuPageReqVO.SORT_FIELD_SALES_COUNT)) { } else if (Objects.equals(pageReqVO.getSortField(), AppProductSpuPageReqVO.SORT_FIELD_SALES_COUNT)) {
query.orderBy(true, pageReqVO.getSortAsc(), ProductSpuDO::getSalesCount); query.orderBy(true, pageReqVO.getSortAsc(), ProductSpuDO::getSalesCount);
} }

View File

@ -50,7 +50,7 @@ public interface ProductSkuService {
* *
* @param list sku * @param list sku
*/ */
void validateSkuList(List<ProductSkuCreateOrUpdateReqVO> list, Integer specType); void validateSkuList(List<ProductSkuCreateOrUpdateReqVO> list, Boolean specType);
/** /**
* SKU * SKU

View File

@ -79,7 +79,7 @@ public class ProductSkuServiceImpl implements ProductSkuService {
} }
@Override @Override
public void validateSkuList(List<ProductSkuCreateOrUpdateReqVO> skus, Integer specType) { public void validateSkuList(List<ProductSkuCreateOrUpdateReqVO> skus, Boolean specType) {
// 非多规格,不需要校验 // 非多规格,不需要校验
if (ObjectUtil.notEqual(specType, ProductSpuSpecTypeEnum.DISABLE.getType())) { if (ObjectUtil.notEqual(specType, ProductSpuSpecTypeEnum.DISABLE.getType())) {
return; return;

View File

@ -102,9 +102,10 @@ public class ProductSpuServiceImpl implements ProductSpuService {
*/ */
private void initSpuFromSkus(ProductSpuDO spu, List<ProductSkuCreateOrUpdateReqVO> skus) { private void initSpuFromSkus(ProductSpuDO spu, List<ProductSkuCreateOrUpdateReqVO> skus) {
spu.setMarketPrice(getMaxValue(skus, ProductSkuCreateOrUpdateReqVO::getMarketPrice)); spu.setMarketPrice(getMaxValue(skus, ProductSkuCreateOrUpdateReqVO::getMarketPrice));
spu.setMaxPrice(getMaxValue(skus, ProductSkuCreateOrUpdateReqVO::getPrice)); // TODO ProductSpuDO中已没有相关属性
spu.setMinPrice(getMinValue(skus, ProductSkuCreateOrUpdateReqVO::getPrice)); //spu.setMaxPrice(getMaxValue(skus, ProductSkuCreateOrUpdateReqVO::getPrice));
spu.setTotalStock(getSumValue(skus, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum)); //spu.setMinPrice(getMinValue(skus, ProductSkuCreateOrUpdateReqVO::getPrice));
//spu.setTotalStock(getSumValue(skus, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum));
} }
/** /**

View File

@ -94,6 +94,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
ProductSpuDO productSpuDO = productSpuMapper.selectById(spu); ProductSpuDO productSpuDO = productSpuMapper.selectById(spu);
createReqVO.setMarketPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getMarketPrice)); createReqVO.setMarketPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getMarketPrice));
// TODO ProductSpuCreateReqVO中已没有相关属性
// createReqVO.setMaxPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice)); // createReqVO.setMaxPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice));
// createReqVO.setMinPrice(CollectionUtils.getMinValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice)); // createReqVO.setMinPrice(CollectionUtils.getMinValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice));
// createReqVO.setTotalStock(CollectionUtils.getSumValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum)); // createReqVO.setTotalStock(CollectionUtils.getSumValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum));
@ -118,6 +119,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
List<ProductSkuCreateOrUpdateReqVO> skuCreateReqList = reqVO.getSkus(); List<ProductSkuCreateOrUpdateReqVO> skuCreateReqList = reqVO.getSkus();
reqVO.setMarketPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getMarketPrice)); reqVO.setMarketPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getMarketPrice));
// TODO ProductSpuUpdateReqVO中已没有相关属性
// reqVO.setMaxPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice)); // reqVO.setMaxPrice(CollectionUtils.getMaxValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice));
// reqVO.setMinPrice(CollectionUtils.getMinValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice)); // reqVO.setMinPrice(CollectionUtils.getMinValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getPrice));
// reqVO.setTotalStock(CollectionUtils.getSumValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum)); // reqVO.setTotalStock(CollectionUtils.getSumValue(skuCreateReqList, ProductSkuCreateOrUpdateReqVO::getStock, Integer::sum));
@ -193,21 +195,21 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
// 准备参数 // 准备参数
ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{ ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{
o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()); o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
o.setTotalStock(500); //o.setTotalStock(500);
o.setMinPrice(1); //o.setMinPrice(1); // TODO ProductSpuDO中已没有相关属性
o.setMaxPrice(50); //o.setMaxPrice(50);
o.setMarketPrice(25); o.setMarketPrice(25);
o.setSpecType(ProductSpuSpecTypeEnum.RECYCLE.getType()); o.setSpecType(ProductSpuSpecTypeEnum.RECYCLE.getType());
o.setBrandId(brandId); o.setBrandId(brandId);
o.setCategoryId(categoryId); o.setCategoryId(categoryId);
o.setClickCount(100); //o.setClickCount(100);
o.setCode(code); //o.setCode(code); // TODO ProductSpuDO中已没有相关属性
o.setDescription("测试商品"); o.setDescription("测试商品");
o.setSliderPicUrls(new ArrayList<>()); o.setSliderPicUrls(new ArrayList<>());
o.setName("测试"); o.setName("测试");
o.setSalesCount(100); o.setSalesCount(100);
o.setSellPoint("超级加倍"); //o.setSellPoint("超级加倍");
o.setShowStock(true); //o.setShowStock(true); // TODO ProductSpuDO中已没有相关属性
o.setVideoUrl(""); o.setVideoUrl("");
}); });
productSpuMapper.insert(createReqVO); productSpuMapper.insert(createReqVO);
@ -241,21 +243,21 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
// 准备参数 // 准备参数
ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{ ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{
o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()); o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
o.setTotalStock(1); //o.setTotalStock(1);
o.setMinPrice(1); //o.setMinPrice(1); // TODO ProductSpuDO中已没有相关属性
o.setMaxPrice(1); //o.setMaxPrice(1);
o.setMarketPrice(1); o.setMarketPrice(1);
o.setSpecType(ProductSpuSpecTypeEnum.RECYCLE.getType()); o.setSpecType(ProductSpuSpecTypeEnum.RECYCLE.getType());
o.setBrandId(brandId); o.setBrandId(brandId);
o.setCategoryId(categoryId); o.setCategoryId(categoryId);
o.setClickCount(1); //o.setClickCount(1); // TODO ProductSpuDO中已没有相关属性
o.setCode(generateNo()); //o.setCode(generateNo());
o.setDescription("测试商品"); o.setDescription("测试商品");
o.setSliderPicUrls(new ArrayList<>()); o.setSliderPicUrls(new ArrayList<>());
o.setName("测试"); o.setName("测试");
o.setSalesCount(1); o.setSalesCount(1);
o.setSellPoint("卖点"); //o.setSellPoint("卖点");
o.setShowStock(true); //o.setShowStock(true); // TODO ProductSpuDO中已没有相关属性
}); });
// 准备参数 // 准备参数
@ -345,15 +347,15 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
public void testUpdateSpuStock() { public void testUpdateSpuStock() {
// 准备参数 // 准备参数
Map<Long, Integer> stockIncrCounts = MapUtil.builder(1L, 10).put(2L, -20).build(); Map<Long, Integer> stockIncrCounts = MapUtil.builder(1L, 10).put(2L, -20).build();
// mock 方法(数据) // mock 方法(数据) // TODO ProductSpuDO中已没有相关属性
productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> o.setId(1L).setTotalStock(20))); //productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> o.setId(1L).setTotalStock(20)));
productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> o.setId(2L).setTotalStock(30))); //productSpuMapper.insert(randomPojo(ProductSpuDO.class, o -> o.setId(2L).setTotalStock(30)));
// 调用 // 调用
productSpuService.updateSpuStock(stockIncrCounts); productSpuService.updateSpuStock(stockIncrCounts);
// 断言 // 断言 // TODO ProductSpuDO中已没有相关属性
assertEquals(productSpuService.getSpu(1L).getTotalStock(), 30); //assertEquals(productSpuService.getSpu(1L).getTotalStock(), 30);
assertEquals(productSpuService.getSpu(2L).getTotalStock(), 10); //assertEquals(productSpuService.getSpu(2L).getTotalStock(), 10);
} }
} }

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.controller.app.order;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO; import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
import cn.iocoder.yudao.module.product.api.property.ProductPropertyValueApi; import cn.iocoder.yudao.module.product.api.property.ProductPropertyValueApi;