Merge remote-tracking branch 'origin/feature/1.8.0-uniapp' into feature/1.8.0-uniapp

# Conflicts:
#	yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
This commit is contained in:
franky-mgmg-pc 2022-06-07 17:18:32 +08:00
commit c118d8198b
9 changed files with 67 additions and 53 deletions

View File

@ -1,31 +1,31 @@
package cn.iocoder.yudao.module.product.controller.admin.sku;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
// TODO @franky中英文之间要有空格哈商品 sku
@Api(tags = "管理后台 - 商品sku")
@RestController
@RequestMapping("/product/sku")

View File

@ -12,9 +12,13 @@ import javax.validation.constraints.*;
@Data
public class ProductSkuBaseVO {
// TODO @frankyexample 要写哈
@ApiModelProperty(value = "spu编号")
private Long spuId;
// TODO @franky类似这种字段有额外说明的可以写成 @ApiModelProperty(value = "规格值数组", required = true, notes = "json格式 [{propertyId: , valueId: }, {propertyId: , valueId: }]")
@ApiModelProperty(value = "规格值数组-json格式 [{propertyId: , valueId: }, {propertyId: , valueId: }]", required = true)
@NotNull(message = "规格值数组-json格式 [{propertyId: , valueId: }, {propertyId: , valueId: }]不能为空")
private List<Property> properties;
@ -42,6 +46,7 @@ public class ProductSkuBaseVO {
@ApiModelProperty(value = "状态: 0-正常 1-禁用")
private Integer status;
// TODO @franky 要有 swagger 注解
@Data
public static class Property {
@NotNull(message = "规格属性名id不能为空")

View File

@ -1,31 +1,29 @@
package cn.iocoder.yudao.module.product.controller.admin.spu;
import nonapi.io.github.classgraph.utils.LogNode;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*;
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert;
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "管理后台 - 商品spu")
@RestController
@ -43,6 +41,7 @@ public class ProductSpuController {
return success(spuService.createSpu(createReqVO));
}
// TODO @frankySpuUpdateReqVO 缺少前缀
@PutMapping("/update")
@ApiOperation("更新商品spu")
@PreAuthorize("@ss.hasPermission('product:spu:update')")

View File

@ -1,12 +1,14 @@
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateReqVO;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
@ApiModel("管理后台 - 商品spu创建 Request VO")
@Data
@ -14,6 +16,7 @@ import javax.validation.constraints.*;
@ToString(callSuper = true)
public class ProductSpuCreateReqVO extends ProductSpuBaseVO {
// TODO @franky这种可以缩写下skus
@ApiModelProperty(value = "sku组合")
@Valid
List<ProductSkuCreateReqVO> productSkuCreateReqVOS;

View File

@ -1,14 +1,11 @@
package cn.iocoder.yudao.module.product.dal.dataobject.spu;
import cn.hutool.log.Log;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.List;
/**
* 商品spu DO
*
@ -48,7 +45,7 @@ public class ProductSpuDO extends BaseDO {
/**
* 商品主图地址,* 数组以逗号分隔,最多上传15张
*/
// TODO frankyList<String>
// TODO frankyList<String>可以参考别的模块怎么处理这种类型的哈
private String picUrls;
/**
* 排序字段

View File

@ -8,6 +8,7 @@ import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
// TODO @JeromeSoar需要 Product 前缀
/**
* 商品分类 Service 接口
*

View File

@ -65,6 +65,7 @@ public class CategoryServiceImpl implements CategoryService {
}
private CategoryDO validateCategoryExists(Long id, ErrorCode errorCode) {
// TODO franky0 要枚举哈
if (id == 0) {
return new CategoryDO().setId(id);
}

View File

@ -1,10 +1,15 @@
package cn.iocoder.yudao.module.product.service.sku;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateReqVO;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuExportReqVO;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuPageReqVO;
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuUpdateReqVO;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* 商品sku Service 接口
@ -67,8 +72,10 @@ public interface ProductSkuService {
*/
List<ProductSkuDO> getSkuList(ProductSkuExportReqVO exportReqVO);
// TODO @frankyvalidateSkus;skuCreateReqList => list
/**
*对sku的组合的属性等进行合法性校验
* sku 的组合的属性等进行合法性校验
*
* @param skuCreateReqList sku组合的集合
*/
void validatedSkuReq(List<ProductSkuCreateReqVO> skuCreateReqList);
@ -76,7 +83,7 @@ public interface ProductSkuService {
/**
* 批量保存sku
* @param skuDOList sku对象集合
* @return
* @return // TODO @franky这里的 return 可以去掉方法名可以改成 createSkus(list)
*/
void batchSave(List<ProductSkuDO> skuDOList);

View File

@ -88,6 +88,7 @@ public class ProductSkuServiceImpl implements ProductSkuService {
return productSkuMapper.selectList(exportReqVO);
}
// TODO @franky这个方法貌似实现的还是有点问题哈例如说throw 异常后面还执行逻辑~
@Override
public void validatedSkuReq(List<ProductSkuCreateReqVO> skuCreateReqList) {
List<ProductSkuBaseVO.Property> skuPropertyList = skuCreateReqList.stream().flatMap(p -> p.getProperties().stream()).collect(Collectors.toList());