Merge remote-tracking branch 'origin/master'

This commit is contained in:
GYJ 2025-03-10 15:11:54 +08:00
commit 1b0b99d99c
6 changed files with 22 additions and 17 deletions

View File

@ -8,6 +8,7 @@ import com.czg.account.service.ShopPushOpenIdService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
@ -54,7 +55,7 @@ public class ShopMsgPushController {
*/
@SaAdminCheckPermission("shopMsgPush:list")
@GetMapping
public CzgResult<List<ShopPushOpenId>> allInfo() {
public CzgResult<Page<ShopPushOpenId>> allInfo() {
return CzgResult.success(shopPushOpenIdService.pageInfo(StpKit.USER.getShopId()));
}

View File

@ -1,11 +1,10 @@
package com.czg.account.service;
import com.czg.account.dto.msg.ShopPushOpenIdEditDTO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.ShopPushOpenId;
import java.util.List;
/**
* 用户推送信息表 服务层
*
@ -14,7 +13,7 @@ import java.util.List;
*/
public interface ShopPushOpenIdService extends IService<ShopPushOpenId> {
List<ShopPushOpenId> pageInfo(Long shopId);
Page<ShopPushOpenId> pageInfo(Long shopId);
Boolean edit(Long shopId, ShopPushOpenIdEditDTO shopPushOpenIdEditDTO);

View File

@ -81,12 +81,10 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
@Override
public void giveActivate(ShopUser shopUser, BigDecimal memAmount, Long relationId) {
log.info("充钱4 会员充值奖励5");
ShopActivate activate = queryChain().select().eq(ShopActivate::getShopId, shopUser.getShopId())
.le(ShopActivate::getAmount, memAmount)
.orderBy(ShopActivate::getGiftAmount, false)
.one();
log.info("赠送活动:{}", activate);
if (ObjectUtil.isNull(activate)) {
return;
}

View File

@ -3,6 +3,7 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
@ -20,6 +21,7 @@ import com.czg.account.vo.UserCouponVo;
import com.czg.product.entity.Product;
import com.czg.product.service.ProductService;
import com.czg.service.account.mapper.ShopCouponMapper;
import com.czg.utils.AssertUtil;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -74,6 +76,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
public Boolean add(ShopCouponDTO couponDTO) {
ShopCoupon shopCoupon = new ShopCoupon();
BeanUtil.copyProperties(couponDTO, shopCoupon);
shopCoupon.setLeftNumber(shopCoupon.getNumber());
return save(shopCoupon);
}
@ -81,6 +84,14 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
public Boolean edit(ShopCouponDTO couponDTO) {
ShopCoupon shopCoupon = new ShopCoupon();
BeanUtil.copyProperties(couponDTO, shopCoupon);
if (couponDTO.getNumber() != null) {
ShopCoupon tbShopCoupon = getById(couponDTO.getId());
if (shopCoupon.getNumber() < tbShopCoupon.getNumber()) {
throw new ValidateException("修改失败 发放数量不可减少");
} else {
shopCoupon.setLeftNumber(shopCoupon.getLeftNumber() + shopCoupon.getNumber() - tbShopCoupon.getNumber());
}
}
return updateById(shopCoupon);
}
@ -108,7 +119,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
@Override
public List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type) {
List<UserCouponVo> tbUserCouponVos = couponRecordService.queryByVipIdAndShopId(shopId, shopUserId,type);
List<UserCouponVo> tbUserCouponVos = couponRecordService.queryByVipIdAndShopId(shopId, shopUserId, type);
if (CollectionUtil.isNotEmpty(tbUserCouponVos)) {
String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("");
LocalTime now = LocalTime.now();

View File

@ -4,6 +4,8 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.msg.ShopPushOpenIdEditDTO;
import com.czg.exception.ApiNotPrintException;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopPushOpenId;
@ -11,8 +13,6 @@ import com.czg.account.service.ShopPushOpenIdService;
import com.czg.service.account.mapper.ShopPushOpenIdMapper;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 用户推送信息表 服务层实现
*
@ -23,12 +23,12 @@ import java.util.List;
public class ShopPushOpenIdServiceImpl extends ServiceImpl<ShopPushOpenIdMapper, ShopPushOpenId> implements ShopPushOpenIdService{
@Override
public List<ShopPushOpenId> pageInfo(Long shopId) {
public Page<ShopPushOpenId> pageInfo(Long shopId) {
// PageHelper.startPage(PageUtil.buildPageHelp());
// return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId)));
List<ShopPushOpenId> list = list(new QueryWrapper().eq(ShopPushOpenId::getShopId, shopId));
list.forEach(item -> item.setTypeInfo(JSONArray.parseArray((String) item.getTypeInfo())));
return list;
Page<ShopPushOpenId> page = page(PageUtil.buildPage(), new QueryWrapper().eq(ShopPushOpenId::getShopId, shopId));
page.getRecords().forEach(item -> item.setTypeInfo(JSONArray.parseArray((String) item.getTypeInfo())));
return page;
}
@Override

View File

@ -531,7 +531,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
} else {
shopUserMoneyEditDTO.setBizEnum(ShopUserFlowBizEnum.CASH_IN);
}
log.info("充钱1 是否是霸王餐:{}", isFree);
if (isFree) {
if (StrUtil.isBlank(czgCallBackDto.getExtParam())) {
throw new ValidateException("霸王餐支付,订单号处理失败");
@ -543,12 +542,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
.set(OrderInfo::getPayAmount, 0)
.update();
}
log.info("充钱2");
//更新会员余额 并生成流水
Long flowId = shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
log.info("充钱3 更新钱:{}", flowId);
if (!isFree) {
log.info("充钱4 会员充值奖励");
//会员活动
activateService.giveActivate(shopUser,
new BigDecimal(czgCallBackDto.getAmount()).divide(new BigDecimal(100), 2, RoundingMode.DOWN), flowId);