生成订单

优惠券字段
This commit is contained in:
2025-02-24 14:19:30 +08:00
parent 9ef904c915
commit da3f548ca0
15 changed files with 539 additions and 184 deletions

View File

@@ -1,10 +1,10 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.Product;
import com.czg.account.service.ProductService;
import com.czg.service.account.mapper.ProductMapper;
import org.springframework.stereotype.Service;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
/**
* 商品 服务层实现。
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* @author zs
* @since 2025-02-20
*/
@Service
@DubboService
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService{
}

View File

@@ -2,14 +2,17 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.czg.account.dto.ShopCouponDTO;
import com.czg.account.entity.Product;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.entity.ShopCoupon;
import com.czg.account.service.ProductService;
import com.czg.account.service.ShopActivateCouponRecordService;
import com.czg.account.service.ShopCouponService;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.ShopCouponMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import java.util.List;
@@ -25,13 +28,22 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
@Resource
private ShopActivateCouponRecordService couponRecordService;
@DubboReference
private ProductService productService;
@Override
public List<ShopCouponDTO> getList(Long shopId, Integer type, Integer status) {
return queryChain().select().eq(ShopCoupon::getShopId, shopId)
List<ShopCouponDTO> coupons = queryChain().select().eq(ShopCoupon::getShopId, shopId)
.eq(ShopCoupon::getType, type)
.eq(ShopCoupon::getStatus, status)
.orderBy(ShopCoupon::getCreateTime).desc().listAs(ShopCouponDTO.class);
coupons.forEach(coupon -> {
if (coupon.getProId() != null) {
Product product = productService.getById(coupon.getProId());
coupon.setProName(product.getName());
}
});
return coupons;
}
@Override
@@ -51,13 +63,14 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
@Override
public List<ShopActivateCouponRecord> find(Long shopUserId, Integer status) {
return couponRecordService.queryChain()
List<ShopActivateCouponRecord> list = couponRecordService.queryChain()
.eq(ShopActivateCouponRecord::getShopId, StpKit.USER.getShopId())
.eq(ShopActivateCouponRecord::getShopUserId, shopUserId)
.eq(ShopActivateCouponRecord::getStatus, status)
.orderBy(ShopActivateCouponRecord::getStatus).asc()
.orderBy(ShopActivateCouponRecord::getCreateTime).desc()
.select().list();
return list;
}
@Override