会员支付
现金充值 优惠券实体
This commit is contained in:
@@ -2,15 +2,19 @@ package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.CoordinateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.czg.account.dto.PageDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoAddDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoByCodeDTO;
|
||||
import com.czg.account.dto.shopinfo.ShopInfoEditDTO;
|
||||
import com.czg.account.entity.*;
|
||||
import com.czg.account.service.*;
|
||||
import com.czg.account.entity.MerchantRegister;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopTable;
|
||||
import com.czg.account.entity.SysUser;
|
||||
import com.czg.account.service.MerchantRegisterService;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopTableService;
|
||||
import com.czg.account.service.SysUserService;
|
||||
import com.czg.enums.StatusEnum;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.exception.CzgException;
|
||||
@@ -22,16 +26,15 @@ import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Service
|
||||
@DubboService
|
||||
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.config.RedisCst;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
@@ -23,6 +24,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@@ -73,6 +75,7 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Long updateMoney(Long shopId, ShopUserMoneyEditDTO shopUserEditDTO) {
|
||||
shopUserEditDTO.setMoney(shopUserEditDTO.getMoney().setScale(2, RoundingMode.DOWN));
|
||||
ShopUser userInfo = getUserInfo(shopId, shopUserEditDTO.getId());
|
||||
@@ -121,12 +124,13 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean add(Long shopId, ShopUserAddDTO shopUserAddDTO) {
|
||||
UserInfo userInfo = userInfoService.queryChain().eq(UserInfo::getPhone, shopUserAddDTO.getPhone()).one();
|
||||
if (userInfo == null) {
|
||||
userInfo = BeanUtil.copyProperties(shopUserAddDTO, UserInfo.class);
|
||||
userInfoService.save(userInfo);
|
||||
}else {
|
||||
} else {
|
||||
throw new ApiNotPrintException("此用户已存在");
|
||||
}
|
||||
|
||||
@@ -143,12 +147,15 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCode(long userInfoId, long shopId) {
|
||||
public CzgResult<String> getCode(long userInfoId, long shopId) {
|
||||
ShopUser shopUser = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userInfoId).one();
|
||||
AssertUtil.isNull(shopUser, "会员信息不存在");
|
||||
if (shopUser.getIsVip().equals(0)) {
|
||||
return CzgResult.failure("加入会员后使用");
|
||||
}
|
||||
String dynamicCode = generatePaymentCode(String.valueOf(shopId), String.valueOf(userInfoId));
|
||||
redisService.set(RedisCst.SHOP_USER_DYNAMIC_CODE + shopUser.getId() + ":" + dynamicCode, 1, 180);
|
||||
return dynamicCode;
|
||||
redisService.set(STR."\{RedisCst.SHOP_USER_DYNAMIC_CODE}\{shopUser.getShopId()}:\{dynamicCode}", shopUser.getId(), 180);
|
||||
return CzgResult.success(dynamicCode);
|
||||
}
|
||||
|
||||
public String generatePaymentCode(String shopId, String platformNumber) {
|
||||
|
||||
@@ -4,14 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoDTO;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.account.mapper.UserInfoMapper;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
/**
|
||||
* 服务层实现。
|
||||
@@ -19,7 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
* @author Administrator
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Service
|
||||
@DubboService
|
||||
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService{
|
||||
@Resource
|
||||
private ShopUserMapper shopUserMapper;
|
||||
|
||||
Reference in New Issue
Block a user