Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into develop

This commit is contained in:
YunaiV
2024-08-18 14:59:56 +08:00
14 changed files with 79 additions and 14 deletions

View File

@ -17,7 +17,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
@Tag(name = "管理后台 - 商品属性项")
@RestController
@ -69,4 +72,12 @@ public class ProductPropertyController {
return success(BeanUtils.toBean(pageResult, ProductPropertyRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得属性项精简列表")
public CommonResult<List<ProductPropertyRespVO>> getPropertySimpleList() {
List<ProductPropertyDO> list = productPropertyService.getPropertyList();
return success(convertList(list, property -> new ProductPropertyRespVO() // 只返回 id、name 属性
.setId(property.getId()).setName(property.getName())));
}
}

View File

@ -17,7 +17,11 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.singleton;
@Tag(name = "管理后台 - 商品属性值")
@RestController
@ -69,4 +73,13 @@ public class ProductPropertyValueController {
return success(BeanUtils.toBean(pageResult, ProductPropertyValueRespVO.class));
}
@GetMapping("/simple-list")
@Operation(summary = "获得属性值精简列表")
@Parameter(name = "propertyId", description = "属性项编号", required = true, example = "1024")
public CommonResult<List<ProductPropertyValueRespVO>> getPropertyValueSimpleList(@RequestParam("propertyId") Long propertyId) {
List<ProductPropertyValueDO> list = productPropertyValueService.getPropertyValueListByPropertyId(singleton(propertyId));
return success(convertList(list, value -> new ProductPropertyValueRespVO() // 只返回 id、name 属性
.setId(value.getId()).setName(value.getName())));
}
}

View File

@ -39,10 +39,6 @@ public class ProductPropertyDO extends BaseDO {
* 名称
*/
private String name;
/**
* 状态
*/
private Integer status;
/**
* 备注
*/

View File

@ -62,4 +62,11 @@ public interface ProductPropertyService {
*/
List<ProductPropertyDO> getPropertyList(Collection<Long> ids);
/**
* 获得指定状态的属性项列表
*
* @return 属性项列表
*/
List<ProductPropertyDO> getPropertyList();
}

View File

@ -109,4 +109,9 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
return productPropertyMapper.selectBatchIds(ids);
}
@Override
public List<ProductPropertyDO> getPropertyList() {
return productPropertyMapper.selectList();
}
}

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.promotion.enums.coupon.CouponStatusEnum;
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -30,6 +31,7 @@ public class CouponDO extends BaseDO {
/**
* 优惠劵编号
*/
@TableId
private Long id;
/**
* 优惠劵模板编号

View File

@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import jakarta.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -132,7 +133,7 @@ public class CouponServiceImpl implements CouponService {
@Transactional
public void deleteCoupon(Long id) {
// 校验存在
validateCouponExists(id);
CouponDO coupon = validateCouponExists(id);
// 更新优惠劵
int deleteCount = couponMapper.delete(id,
@ -140,8 +141,9 @@ public class CouponServiceImpl implements CouponService {
if (deleteCount == 0) {
throw exception(COUPON_DELETE_FAIL_USED);
}
// 减少优惠劵模板的领取数量 -1
couponTemplateService.updateCouponTemplateTakeCount(id, -1);
couponTemplateService.updateCouponTemplateTakeCount(coupon.getTemplateId(), -1);
}
@Override
@ -149,10 +151,12 @@ public class CouponServiceImpl implements CouponService {
return couponMapper.selectListByUserIdAndStatus(userId, status);
}
private void validateCouponExists(Long id) {
if (couponMapper.selectById(id) == null) {
private CouponDO validateCouponExists(Long id) {
CouponDO coupon = couponMapper.selectById(id);
if (coupon == null) {
throw exception(COUPON_NOT_EXISTS);
}
return coupon;
}
@Override

View File

@ -21,6 +21,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class AfterSalePageReqVO extends PageParam {
@Schema(description = "用户编号", example = "1024")
private Long userId;
@Schema(description = "售后流水号", example = "202211190847450020500077")
private String no;

View File

@ -22,4 +22,7 @@ public class AppProductSpuBaseRespVO {
@Schema(description = "商品主图地址", example = "https://www.iocoder.cn/xx.png")
private String picUrl;
@Schema(description = "商品分类编号", example = "1")
private Long categoryId;
}

View File

@ -16,6 +16,7 @@ public interface AfterSaleMapper extends BaseMapperX<AfterSaleDO> {
default PageResult<AfterSaleDO> selectPage(AfterSalePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<AfterSaleDO>()
.eqIfPresent(AfterSaleDO::getUserId, reqVO.getUserId())
.likeIfPresent(AfterSaleDO::getNo, reqVO.getNo())
.eqIfPresent(AfterSaleDO::getStatus, reqVO.getStatus())
.eqIfPresent(AfterSaleDO::getType, reqVO.getType())

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.trade.service.price.calculator;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
@ -61,7 +62,7 @@ public class TradePriceCalculatorHelper {
orderItem.setSpuName(spu.getName()).setCategoryId(spu.getCategoryId())
.setDeliveryTemplateId(spu.getDeliveryTemplateId())
.setGivePoint(spu.getGiveIntegral()).setUsePoint(0);
if (orderItem.getPicUrl() == null) {
if (StrUtil.isBlank(orderItem.getPicUrl())) {
orderItem.setPicUrl(spu.getPicUrl());
}
});
@ -240,7 +241,7 @@ public class TradePriceCalculatorHelper {
*
* 和 {@link #dividePrice(List, Integer)} 逻辑一致,只是传入的是 TradeOrderItemDO 对象
*
* @param items 订单项
* @param items 订单项
* @param price 订单支付金额
* @return 分摊金额数组,和传入的 orderItems 一一对应
*/