Merge remote-tracking branch 'origin/prod' into prod
This commit is contained in:
commit
d9669f7dfa
|
|
@ -24,4 +24,5 @@ public class ShopUserDTO extends ShopUser {
|
|||
* 充值金额
|
||||
*/
|
||||
private BigDecimal rechargeAmount;
|
||||
private String memberLevelName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ import com.czg.account.service.ShopInfoService;
|
|||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.market.entity.MemberLevelConfig;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.service.MemberLevelConfigService;
|
||||
import com.czg.market.service.MkShopCouponRecordService;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
|
|
@ -56,6 +58,8 @@ public class AShopUserServiceImpl implements AShopUserService {
|
|||
private MkShopCouponRecordService couponRecordService;
|
||||
@Resource
|
||||
private ShopInfoService shopInfoService;
|
||||
@DubboReference
|
||||
private MemberLevelConfigService memberLevelConfigService;
|
||||
|
||||
private ShopUser getUserInfo(Long shopUserId) {
|
||||
ShopUser shopUser = shopUserService.queryChain().eq(ShopUser::getId, shopUserId).one();
|
||||
|
|
@ -115,8 +119,8 @@ public class AShopUserServiceImpl implements AShopUserService {
|
|||
ShopUser shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);
|
||||
shopUser.setCode(generateCode(shopId));
|
||||
shopUser.setSourceShopId(shopId);
|
||||
shopUser.setSourceShopId(shopId);
|
||||
shopUser.setUserId(userInfo.getId());
|
||||
shopUser.setMainShopId(shopInfoService.getMainIdByShopId(shopId));
|
||||
shopUser.setJoinTime(shopUser.getIsVip() != null && shopUser.getIsVip() == 1 ? DateUtil.date().toLocalDateTime() : null);
|
||||
return shopUserService.save(shopUser);
|
||||
}
|
||||
|
|
@ -133,6 +137,10 @@ public class AShopUserServiceImpl implements AShopUserService {
|
|||
ShopUserDTO shopUserDTO = BeanUtil.copyProperties(shopUser, ShopUserDTO.class);
|
||||
shopUserDTO.setCouponNum(count);
|
||||
shopUserDTO.setOrderNumber(orderInfoService.count(new QueryWrapper().eq(OrderInfo::getUserId, userId).eq(OrderInfo::getShopId, StpKit.USER.getShopId(0L)).eq(OrderInfo::getStatus, "done")));
|
||||
if (shopUser.getMemberLevelId() != null) {
|
||||
MemberLevelConfig memberLevelConfig = memberLevelConfigService.getById(shopUser.getMemberLevelId());
|
||||
shopUserDTO.setMemberLevelName(memberLevelConfig == null ? null : memberLevelConfig.getName());
|
||||
}
|
||||
return shopUserDTO;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,9 +59,11 @@
|
|||
a.*,
|
||||
IFNULL(c.couponNum, 0) AS couponNum,
|
||||
IFNULL(d.orderNumber, 0) AS orderNumber,
|
||||
IFNULL(f.rechargeAmount, 0) AS rechargeAmount
|
||||
IFNULL(f.rechargeAmount, 0) AS rechargeAmount,
|
||||
c.name as memberLevelName
|
||||
FROM tb_shop_user a
|
||||
LEFT JOIN tb_user_info b ON b.id = a.user_id
|
||||
LEFT JOIN tb_member_level_config c on c.id=a.member_level_id
|
||||
|
||||
-- 预计算优惠券数量
|
||||
LEFT JOIN (
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.czg.market.vo.UserCouponVO;
|
|||
import com.czg.service.market.mapper.MkShopCouponRecordMapper;
|
||||
import com.czg.service.market.mapper.ShopCouponMapper;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.utils.CzgStrUtils;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
|
|
@ -102,6 +103,7 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
|||
recordQueryWrapper.eq(MkShopCouponRecord::getShopId, mkShopCouponRecordDTO.getShopId())
|
||||
.eq(MkShopCouponRecord::getIsDel, 0)
|
||||
.eq(MkShopCouponRecord::getStatus, mkShopCouponRecordDTO.getStatus())
|
||||
.eq(MkShopCouponRecord::getSource, CzgStrUtils.getStrOrNull(mkShopCouponRecordDTO.getSource()))
|
||||
.orderBy(MkShopCouponRecord::getCreateTime).desc();
|
||||
if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)) {
|
||||
recordQueryWrapper.between(MkShopCouponRecord::getCreateTime, startTime, endTime);
|
||||
|
|
|
|||
|
|
@ -327,23 +327,23 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
JSONObject couponJson = coupons.get(tbUserCouponVo.getCouponId());
|
||||
tbUserCouponVo.setUseRestrictions(couponJson.getString("useRestrictions"));
|
||||
tbUserCouponVo.setUse(couponJson.getBoolean("isUse"));
|
||||
if (tbUserCouponVo.getType() == 1 || tbUserCouponVo.getType() == 2 || tbUserCouponVo.getType() == 4 || tbUserCouponVo.getType() == 6) {
|
||||
if (tbUserCouponVo.getType() == 1 || tbUserCouponVo.getType() == 2 || tbUserCouponVo.getType() == 3
|
||||
|| tbUserCouponVo.getType() == 4 || tbUserCouponVo.getType() == 6) {
|
||||
if (StrUtil.isNotBlank(tbUserCouponVo.getFoods()) && !",".equals(tbUserCouponVo.getFoods())) {
|
||||
List<Long> couponFoodIds = Arrays.stream(tbUserCouponVo.getFoods().split(",")).map(Long::parseLong).toList();
|
||||
if (CollUtil.isNotEmpty(couponFoodIds)) {
|
||||
List<Product> list = productService.list(new QueryWrapper()
|
||||
.in(Product::getId, couponFoodIds).eq(Product::getIsDel, 0));
|
||||
log.info("优惠券商品列表:{}", list);
|
||||
// log.info("优惠券商品列表:{}", list);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
if (tbUserCouponVo.getType() == 2) {
|
||||
tbUserCouponVo.setUseFoods(JSON.parseObject(JSON.toJSONString(list), new TypeReference<>() {
|
||||
}));
|
||||
|
||||
} else {
|
||||
if (tbUserCouponVo.getType() == 1 || tbUserCouponVo.getType() == 3) {
|
||||
tbUserCouponVo.setThresholdFoods(JSON.parseObject(JSON.toJSONString(list), new TypeReference<>() {
|
||||
}));
|
||||
} else {
|
||||
tbUserCouponVo.setUseFoods(JSON.parseObject(JSON.toJSONString(list), new TypeReference<>() {
|
||||
}));
|
||||
}
|
||||
String foods = list.stream().map(Product::getName).collect(Collectors.joining(","));
|
||||
tbUserCouponVo.setFoods(foods);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||
import com.czg.market.entity.MemberLevelConfig;
|
||||
import com.czg.market.service.MemberLevelConfigService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -23,7 +25,7 @@ import java.util.List;
|
|||
* @author zs
|
||||
* @since 2025-09-10
|
||||
*/
|
||||
@Service
|
||||
@DubboService
|
||||
public class TbMemberLevelConfigServiceImpl extends ServiceImpl<TbMemberLevelConfigMapper, MemberLevelConfig> implements MemberLevelConfigService{
|
||||
@Resource
|
||||
private ShopCouponService shopCouponService;
|
||||
|
|
|
|||
|
|
@ -405,6 +405,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
List<Long> couponFoodIds = new ArrayList<>();
|
||||
if (StrUtil.isNotBlank(coupon.getFoods()) && !",".equals(coupon.getFoods())) {
|
||||
couponFoodIds = Arrays.stream(coupon.getFoods().split(",")).map(Long::parseLong).toList();
|
||||
if (CollUtil.isNotEmpty(couponFoodIds)) {
|
||||
isAllFoods = false;
|
||||
}
|
||||
}
|
||||
foodsCalculate(orderDetails, isAllFoods, couponFoodIds, coupon.getDiscountNum(), "price_asc".equals(coupon.getUseRule()), prodCouponAmount);
|
||||
} else if (type == 4 || type == 6) {//4-第二件半价券, 6-买一送一券
|
||||
|
|
@ -416,6 +419,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
List<Long> couponFoodIds = new ArrayList<>();
|
||||
if (StrUtil.isNotBlank(coupon.getFoods()) && !",".equals(coupon.getFoods())) {
|
||||
couponFoodIds = Arrays.stream(coupon.getFoods().split(",")).map(Long::parseLong).toList();
|
||||
if (CollUtil.isNotEmpty(couponFoodIds)) {
|
||||
isAllFoods = false;
|
||||
}
|
||||
}
|
||||
if (type == 6) {
|
||||
oneGiftCalculate(orderDetails, isAllFoods, couponFoodIds, "price_asc".equals(coupon.getUseRule()), oneGiftAmount);
|
||||
|
|
@ -432,6 +438,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
List<Long> couponFoodIds = new ArrayList<>();
|
||||
if (StrUtil.isNotBlank(coupon.getFoods()) && !",".equals(coupon.getFoods())) {
|
||||
couponFoodIds = Arrays.stream(coupon.getFoods().split(",")).map(Long::parseLong).toList();
|
||||
if (CollUtil.isNotEmpty(couponFoodIds)) {
|
||||
isAllFoods = false;
|
||||
}
|
||||
}
|
||||
thresholdCalculate(orderDetails, isAllFoods, couponFoodIds, coupon.getFullAmount());
|
||||
if (type == 3) {
|
||||
|
|
@ -476,7 +485,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
}
|
||||
//折扣金额
|
||||
if (param.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
newTotalAmount = totalAmount.getPrice().subtract(param.getDiscountAmount());
|
||||
newTotalAmount = newTotalAmount.subtract(param.getDiscountAmount());
|
||||
}
|
||||
//积分抵扣 金额范围校验 抵扣金额校验
|
||||
if (param.getPointsNum() > 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue