Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -5,6 +5,7 @@ import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@@ -17,6 +18,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_shop_config")
|
||||
@Accessors(chain = true)
|
||||
public class ShopConfig implements Serializable {
|
||||
|
||||
@Serial
|
||||
@@ -84,7 +86,7 @@ public class ShopConfig implements Serializable {
|
||||
*/
|
||||
private Integer isTableFee;
|
||||
/**
|
||||
* 是否启用会员价 1-是 0-否
|
||||
* 是否启用会员价 1-是 0-否
|
||||
*/
|
||||
private Integer isMemberPrice;
|
||||
/**
|
||||
@@ -104,4 +106,4 @@ public class ShopConfig implements Serializable {
|
||||
* '自动清台 支付几分钟后 默认10分钟后'
|
||||
*/
|
||||
private Integer tableClearTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,12 @@ public class ShopUser implements Serializable {
|
||||
private LocalDateTime deliverTime;
|
||||
private LocalDateTime nextDeliverTime;
|
||||
|
||||
@Column(ignore = true)
|
||||
private String memberName;
|
||||
private String openType;
|
||||
@Column(ignore = true)
|
||||
private Integer discount;
|
||||
@Column(ignore = true)
|
||||
private Integer isMemberPrice;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.czg.account.service;
|
||||
|
||||
import com.czg.account.entity.ShopConfig;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.mybatisflex.core.util.LambdaGetter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺配置扩展
|
||||
@@ -11,4 +14,5 @@ import com.mybatisflex.core.service.IService;
|
||||
*/
|
||||
public interface ShopConfigService extends IService<ShopConfig> {
|
||||
|
||||
}
|
||||
void editStatusByShopIdList(Long mainShopId, Integer isEnable, boolean onyUpValid, String name, String useShopType, List<Long> shopIdList);
|
||||
}
|
||||
|
||||
@@ -190,9 +190,11 @@ public class AShopUserServiceImpl implements AShopUserService {
|
||||
}
|
||||
MemberLevelConfig config = memberLevelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getShopId, mainId)
|
||||
.ge(MemberLevelConfig::getExperienceValue, memberLevelConfig == null ? null : memberLevelConfig.getExperienceValue())
|
||||
.ne(MemberLevelConfig::getId, shopUserDTO.getMemberLevelId())
|
||||
.limit(1).orderBy(MemberLevelConfig::getExperienceValue, true));
|
||||
if (config != null) {
|
||||
shopUserDTO.setNextExperience(config.getExperienceValue() - (shopUser.getExperience() == null ? 0 : shopUser.getExperience()));
|
||||
shopUserDTO.setNextExperience(shopUserDTO.getNextExperience() < 0 ? 0: shopUserDTO.getNextExperience());
|
||||
shopUserDTO.setNextMemberLevelName(config.getName());
|
||||
}
|
||||
return shopUserDTO;
|
||||
|
||||
@@ -6,12 +6,16 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czg.account.dto.freeding.FreeDineConfigEditDTO;
|
||||
import com.czg.account.entity.FreeDineConfig;
|
||||
import com.czg.account.entity.ShopConfig;
|
||||
import com.czg.account.service.FreeDineConfigService;
|
||||
import com.czg.account.service.ShopConfigService;
|
||||
import com.czg.account.vo.FreeDineConfigVO;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.service.account.mapper.FreeDineConfigMapper;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -22,6 +26,10 @@ import org.apache.dubbo.config.annotation.DubboService;
|
||||
*/
|
||||
@DubboService
|
||||
public class FreeDineConfigServiceImpl extends ServiceImpl<FreeDineConfigMapper, FreeDineConfig> implements FreeDineConfigService{
|
||||
|
||||
@DubboReference
|
||||
private ShopConfigService shopConfigService;
|
||||
|
||||
@Override
|
||||
public FreeDineConfigVO getConfig(long shopId) {
|
||||
FreeDineConfig freeDineConfig = getOne(new QueryWrapper().eq(FreeDineConfig::getShopId, shopId));
|
||||
@@ -52,6 +60,8 @@ public class FreeDineConfigServiceImpl extends ServiceImpl<FreeDineConfigMapper,
|
||||
if ("part".equals(freeDineConfigEditDTO.getUseShopType()) && freeDineConfigEditDTO.getShopIdList() != null) {
|
||||
config.setShopIdList(JSONArray.toJSONString(freeDineConfigEditDTO.getShopIdList()));
|
||||
}
|
||||
|
||||
shopConfigService.editStatusByShopIdList(config.getShopId(), freeDineConfigEditDTO.getEnable() ? 1 : 0,true, "is_account_ay", freeDineConfigEditDTO.getUseShopType(), freeDineConfigEditDTO.getShopIdList());
|
||||
if (freeDineConfigEditDTO.getUseType() != null) {
|
||||
config.setUseType(JSONObject.toJSONString(freeDineConfigEditDTO.getUseType()));
|
||||
}
|
||||
|
||||
@@ -8,11 +8,14 @@ import com.czg.service.account.mapper.ShopConfigMapper;
|
||||
import com.czg.service.account.mapper.ShopInfoMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.util.LambdaGetter;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺配置扩展
|
||||
*
|
||||
@@ -37,4 +40,47 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void editStatusByShopIdList(Long mainShopId, Integer isEnable, boolean onyUpValid, String property, String useShopType, List<Long> shopIdList) {
|
||||
ShopConfig shopConfig = getOne(new QueryWrapper().eq(ShopConfig::getId, mainShopId));
|
||||
if (shopConfig == null) {
|
||||
shopConfig = new ShopConfig();
|
||||
shopConfig.setId(mainShopId);
|
||||
save(shopConfig);
|
||||
}
|
||||
|
||||
if (!shopIdList.isEmpty()) {
|
||||
List<Long> extistList = list(new QueryWrapper().in(ShopConfig::getId, shopIdList).select(ShopConfig::getId)).stream().map(ShopConfig::getId).toList();
|
||||
shopIdList.stream().filter(id -> !extistList.contains(id)).forEach(id -> {
|
||||
save(new ShopConfig().setId(id).setMainId(mainShopId));
|
||||
});
|
||||
}
|
||||
|
||||
if (isEnable == 0 && !onyUpValid) {
|
||||
updateChain().or(or -> {
|
||||
or.eq(ShopConfig::getMainId, mainShopId);
|
||||
}).or(or -> {
|
||||
or.in(ShopConfig::getId, shopIdList);
|
||||
}).set(property, 0).update();
|
||||
}else {
|
||||
if ("all".equals(useShopType)) {
|
||||
updateChain().or(or -> {
|
||||
or.eq(ShopConfig::getMainId, mainShopId);
|
||||
}).or(or -> {
|
||||
or.in(ShopConfig::getId, shopIdList);
|
||||
}).set(property, 1).update();
|
||||
}else {
|
||||
if (shopIdList.isEmpty()) {
|
||||
updateChain().eq(ShopConfig::getMainId, mainShopId).set(property, 1).update();
|
||||
}else {
|
||||
if (!onyUpValid) {
|
||||
updateChain().notIn(ShopConfig::getId, shopIdList).set(property, 0).update();
|
||||
}
|
||||
updateChain().in(ShopConfig::getId, shopIdList).set(property, 1).update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,11 +12,16 @@ import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.market.entity.MemberLevelConfig;
|
||||
import com.czg.market.service.MemberLevelConfigService;
|
||||
import com.czg.market.service.TbMemberConfigService;
|
||||
import com.czg.market.vo.MemberConfigVO;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.czg.utils.MyQueryWrapper;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
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 org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -40,6 +45,10 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
private UserInfoService userInfoService;
|
||||
@Resource
|
||||
private ShopInfoService shopInfoService;
|
||||
@DubboReference
|
||||
private MemberLevelConfigService memberLevelConfigService;
|
||||
@DubboReference
|
||||
private TbMemberConfigService memberConfigService;
|
||||
|
||||
private ShopUser getUserInfo(Long shopUserId) {
|
||||
ShopUser shopUser = queryChain().eq(ShopUser::getId, shopUserId).one();
|
||||
@@ -73,6 +82,15 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
shopUser.setId(null);
|
||||
save(shopUser);
|
||||
}
|
||||
if (shopUser.getMemberLevelId() != null) {
|
||||
MemberLevelConfig memberLevelConfig = memberLevelConfigService.getById(shopUser.getMemberLevelId());
|
||||
if (memberLevelConfig != null) {
|
||||
shopUser.setMemberName(memberLevelConfig.getName());
|
||||
shopUser.setDiscount(memberLevelConfig.getDiscount());
|
||||
MemberConfigVO configVO = memberConfigService.detail(memberLevelConfig.getShopId());
|
||||
shopUser.setIsMemberPrice(configVO.getIsMemberPrice());
|
||||
}
|
||||
}
|
||||
return shopUser;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ import com.czg.service.market.mapper.MkBirthdayGiftMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -52,6 +55,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "birthdayGift")
|
||||
public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper, MkBirthdayGift> implements MkBirthdayGiftService {
|
||||
@Resource
|
||||
private MkBirthdayGiftRecordService birthdayGiftRecordService;
|
||||
@@ -72,6 +76,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||
private ShopUserService shopUserService;
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "#shopId")
|
||||
public MkBirthdayGiftVO detail(Long shopId) {
|
||||
MkBirthdayGift gift = getOne(new QueryWrapper().eq(MkBirthdayGift::getMainShopId, shopId));
|
||||
if (gift == null) {
|
||||
@@ -88,6 +93,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(key = "#shopId")
|
||||
public Boolean edit(Long shopId, MkBirthdayGiftDTO giftDTO) {
|
||||
MkBirthdayGift birthdayGift = getOne(new QueryWrapper().eq(MkBirthdayGift::getMainShopId, shopId));
|
||||
BeanUtil.copyProperties(giftDTO, birthdayGift);
|
||||
|
||||
@@ -5,8 +5,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||
import com.czg.account.entity.ShopConfig;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopConfigService;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
@@ -29,6 +31,9 @@ import com.czg.service.market.mapper.MkConsumeCashbackMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -46,6 +51,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "consumeCashback")
|
||||
public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackMapper, MkConsumeCashback> implements MkConsumeCashbackService {
|
||||
@DubboReference
|
||||
private ShopInfoService shopInfoService;
|
||||
@@ -53,10 +59,13 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
private ShopUserService shopUserService;
|
||||
@DubboReference
|
||||
private OrderInfoService orderInfoService;
|
||||
@DubboReference
|
||||
private ShopConfigService shopConfigService;
|
||||
@Resource
|
||||
private MkConsumeCashbackRecordService consumeCashbackRecordService;
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "#shopId")
|
||||
public MkConsumeCashbackVO detail(Long shopId) {
|
||||
MkConsumeCashback consumeCashback = getOne(new QueryWrapper().eq(MkConsumeCashback::getMainShopId, shopId));
|
||||
if (consumeCashback == null) {
|
||||
@@ -78,6 +87,7 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(key = "#shopId")
|
||||
public Boolean edit(Long shopId, MkConsumeCashbackDTO consumeDiscountDTO) {
|
||||
MkConsumeCashback consumeCashback = getOne(new QueryWrapper().eq(MkConsumeCashback::getMainShopId, shopId));
|
||||
BeanUtil.copyProperties(consumeDiscountDTO, consumeCashback);
|
||||
@@ -91,6 +101,9 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
}
|
||||
}
|
||||
|
||||
shopConfigService.editStatusByShopIdList(shopId, consumeDiscountDTO.getIsEnable(), true, "is_account_ay",
|
||||
consumeDiscountDTO.getUseType(), consumeDiscountDTO.getShopIdList());
|
||||
|
||||
if (consumeDiscountDTO.getCashbackStepList() != null && !consumeDiscountDTO.getCashbackStepList().isEmpty()) {
|
||||
consumeCashback.setCashbackStepList(JSONArray.toJSONString(consumeDiscountDTO.getCashbackStepList()));
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.entity.MkConsumeDiscount;
|
||||
import com.czg.market.service.MkConsumeDiscountService;
|
||||
import com.czg.service.market.mapper.MkConsumeDiscountMapper;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -24,8 +27,10 @@ import java.math.BigDecimal;
|
||||
* @since 2025-09-16
|
||||
*/
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "consumeDiscount")
|
||||
public class MkConsumeDiscountServiceImpl extends ServiceImpl<MkConsumeDiscountMapper, MkConsumeDiscount> implements MkConsumeDiscountService {
|
||||
@Override
|
||||
@Cacheable(key = "#shopId")
|
||||
public MkConsumeDiscountVO detail(Long shopId) {
|
||||
MkConsumeDiscount consumeDiscount = getOne(new QueryWrapper().eq(MkConsumeDiscount::getShopId, shopId));
|
||||
if (consumeDiscount == null) {
|
||||
@@ -47,6 +52,7 @@ public class MkConsumeDiscountServiceImpl extends ServiceImpl<MkConsumeDiscountM
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(key = "#shopId")
|
||||
public Boolean edit(Long shopId, MkConsumeDiscountDTO consumeDiscountDTO) {
|
||||
if (consumeDiscountDTO.getRandomDiscountList() == null && consumeDiscountDTO.getDiscountAmount() == null) {
|
||||
throw new ApiNotPrintException("优惠金额和随机优惠金额不能同时为空");
|
||||
|
||||
@@ -13,6 +13,9 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.entity.MkEnableConfig;
|
||||
import com.czg.market.service.MkEnableConfigService;
|
||||
import com.czg.service.market.mapper.MkEnableConfigMapper;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -22,9 +25,11 @@ import org.springframework.stereotype.Service;
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "enableConfig")
|
||||
public class MkEnableConfigServiceImpl extends ServiceImpl<MkEnableConfigMapper, MkEnableConfig> implements MkEnableConfigService{
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "#mainShopId + ':' + #shopId")
|
||||
public MkEnableConfigVO detail(Long mainShopId, Long shopId, TableValueConstant.EnableConfig.Type type) {
|
||||
MkEnableConfig one = getOne(new QueryWrapper().eq(MkEnableConfig::getMainShopId, mainShopId).eq(MkEnableConfig::getType, type.getCode()));
|
||||
if (one == null) {
|
||||
@@ -43,6 +48,7 @@ public class MkEnableConfigServiceImpl extends ServiceImpl<MkEnableConfigMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(key = "#mainShopId + ':' + #shopId")
|
||||
public Boolean upEnable(Long mainShopId, Long shopId, MkEnableConfigDTO dto, TableValueConstant.EnableConfig.Type type) {
|
||||
MkEnableConfig one = getOne(new QueryWrapper().eq(MkEnableConfig::getMainShopId, mainShopId).eq(MkEnableConfig::getType, type.getCode()));
|
||||
if (one == null) {
|
||||
|
||||
@@ -4,9 +4,11 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
|
||||
import com.czg.account.entity.ShopConfig;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.MemberPointsService;
|
||||
import com.czg.account.service.ShopConfigService;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
@@ -32,6 +34,7 @@ import com.czg.service.market.mapper.MkShopRechargeMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -60,6 +63,8 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
||||
private MkShopCouponRecordService shopCouponRecordService;
|
||||
@DubboReference
|
||||
private ShopInfoService shopInfoService;
|
||||
@DubboReference
|
||||
private ShopConfigService shopConfigService;
|
||||
|
||||
@Override
|
||||
public MkShopRechargeVO detailApp(Long shopId) {
|
||||
@@ -134,6 +139,10 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
||||
shopRechargeDetailService.save(mkShopRechargeDetail);
|
||||
});
|
||||
}
|
||||
shopConfigService.editStatusByShopIdList(shopId, shopRechargeDTO.getIsEnable(), false, "is_account_ay",
|
||||
shopRechargeDTO.getUseType(), shopRechargeDTO.getShopIdList());
|
||||
|
||||
|
||||
return updateById(shopRecharge);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user