会员购买完善
This commit is contained in:
@@ -37,6 +37,13 @@ public class UserAuthorizationController {
|
|||||||
return CzgResult.success(userAuthorizationService.login(userAuthorizationLoginDTO));
|
return CzgResult.success(userAuthorizationService.login(userAuthorizationLoginDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/test")
|
||||||
|
public CzgResult<String> test() {
|
||||||
|
StpKit.USER.login(15114L, "or1l867go4WD5DYBT1iejr1DqGIw", null, null, null, MyStpLogic.LoginType.USER, false, "userMini");
|
||||||
|
|
||||||
|
return CzgResult.success(StpKit.USER.getTokenValue());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取手机号
|
* 获取手机号
|
||||||
* @param getPhoneDTO 获取手机号信息
|
* @param getPhoneDTO 获取手机号信息
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ public class UserOrderController {
|
|||||||
public CzgResult<MemberOrder> createMemberOrder(@Validated @RequestBody MemberOrderDTO orderDTO) {
|
public CzgResult<MemberOrder> createMemberOrder(@Validated @RequestBody MemberOrderDTO orderDTO) {
|
||||||
orderDTO.setPlatformType(ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"));
|
orderDTO.setPlatformType(ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"));
|
||||||
orderDTO.setUserId(StpKit.USER.getLoginIdAsLong());
|
orderDTO.setUserId(StpKit.USER.getLoginIdAsLong());
|
||||||
orderDTO.setShopId(StpKit.USER.getShopId());
|
|
||||||
orderDTO.setOrderType("miniapp");
|
orderDTO.setOrderType("miniapp");
|
||||||
return CzgResult.success(memberOrderService.createMemberOrder(orderDTO));
|
return CzgResult.success(memberOrderService.createMemberOrder(orderDTO));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,17 @@ package com.czg.account.dto.shopuser;
|
|||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ShopUserAddDTO {
|
@Accessors(chain = true)
|
||||||
|
public class ShopUserAddDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户头像
|
* 用户头像
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.mybatisflex.annotation.Table;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -24,6 +25,7 @@ import java.time.LocalDateTime;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Table("tb_shop_user")
|
@Table("tb_shop_user")
|
||||||
|
@Accessors(chain = true)
|
||||||
public class ShopUser implements Serializable {
|
public class ShopUser implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public interface UserInfoService extends IService<UserInfo> {
|
|||||||
|
|
||||||
UserInfoDTO getInfo(long userInfoId);
|
UserInfoDTO getInfo(long userInfoId);
|
||||||
|
|
||||||
|
|
||||||
Boolean updateInfo(long shopId, long userId, UserInfoEditDTO userInfoEditDTO);
|
Boolean updateInfo(long shopId, long userId, UserInfoEditDTO userInfoEditDTO);
|
||||||
|
|
||||||
Boolean updatePwd(long userId, UserInfoPwdEditDTO userInfoPwdEditDTO);
|
Boolean updatePwd(long userId, UserInfoPwdEditDTO userInfoPwdEditDTO);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.czg.market.dto;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -33,17 +34,20 @@ public class MemberOrderDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "方案名称不为空")
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数量
|
* 数量
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "数量不为空")
|
@Min(1)
|
||||||
private Integer num;
|
private Integer num;
|
||||||
private String platformType;
|
private String platformType;
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private String orderType;
|
private String orderType;
|
||||||
|
private Integer sex;
|
||||||
|
private String birthDay;
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.mybatisflex.core.paginate.Page;
|
|||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ import java.math.BigDecimal;
|
|||||||
* @author Administrator
|
* @author Administrator
|
||||||
* @since 2025-02-08
|
* @since 2025-02-08
|
||||||
*/
|
*/
|
||||||
@Service
|
@DubboService
|
||||||
public class AShopUserServiceImpl implements AShopUserService {
|
public class AShopUserServiceImpl implements AShopUserService {
|
||||||
@Resource
|
@Resource
|
||||||
private ShopUserService shopUserService;
|
private ShopUserService shopUserService;
|
||||||
|
|||||||
@@ -29,9 +29,11 @@ import com.mybatisflex.core.paginate.Page;
|
|||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ import java.util.List;
|
|||||||
* @author Administrator
|
* @author Administrator
|
||||||
* @since 2025-02-08
|
* @since 2025-02-08
|
||||||
*/
|
*/
|
||||||
@Service
|
@DubboService
|
||||||
public class UShopUserServiceImpl implements UShopUserService {
|
public class UShopUserServiceImpl implements UShopUserService {
|
||||||
@Resource
|
@Resource
|
||||||
private ShopUserService shopUserService;
|
private ShopUserService shopUserService;
|
||||||
@@ -180,19 +182,18 @@ public class UShopUserServiceImpl implements UShopUserService {
|
|||||||
BeanUtil.copyProperties(shopUserAddDTO, shopUser, "accountPoints", "amount");
|
BeanUtil.copyProperties(shopUserAddDTO, shopUser, "accountPoints", "amount");
|
||||||
BeanUtil.copyProperties(shopUserAddDTO, userInfo);
|
BeanUtil.copyProperties(shopUserAddDTO, userInfo);
|
||||||
userInfoService.updateById(userInfo);
|
userInfoService.updateById(userInfo);
|
||||||
|
if (StrUtil.isBlank(shopUser.getCode())) {
|
||||||
if ((shopUser.getIsVip() == null || shopUser.getIsVip() != 1) && shopUser.getId() != null) {
|
shopUser.setCode(generateCode(shopId));
|
||||||
|
}
|
||||||
|
if (shopUser.getId() != null) {
|
||||||
shopUser.setIsVip(1);
|
shopUser.setIsVip(1);
|
||||||
if (StrUtil.isBlank(shopUser.getCode())) {
|
|
||||||
shopUser.setCode(generateCode(shopId));
|
|
||||||
}
|
|
||||||
shopUser.setJoinTime(DateUtil.date().toLocalDateTime());
|
|
||||||
shopUser.setUserId(null);
|
shopUser.setUserId(null);
|
||||||
shopUser.setSourceShopId(shopId);
|
shopUser.setSourceShopId(shopId);
|
||||||
shopUser.setMainShopId(mainId);
|
shopUser.setMainShopId(mainId);
|
||||||
}
|
}
|
||||||
|
shopUser.setJoinTime(shopUser.getJoinTime() == null ? DateUtil.date().toLocalDateTime() : shopUser.getJoinTime());
|
||||||
|
|
||||||
|
|
||||||
memberConfigService.joinMember(shopId, userId, null);
|
|
||||||
return shopUserService.saveOrUpdate(shopUser);
|
return shopUserService.saveOrUpdate(shopUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import jakarta.annotation.Resource;
|
|||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务层实现。
|
* 服务层实现。
|
||||||
*
|
*
|
||||||
@@ -51,7 +53,6 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
|
|||||||
userInfoDTO.setAssetsSummary(assetsSummaryDTO);
|
userInfoDTO.setAssetsSummary(assetsSummaryDTO);
|
||||||
return userInfoDTO;
|
return userInfoDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateInfo(long shopId, long userId, UserInfoEditDTO userInfoEditDTO) {
|
public Boolean updateInfo(long shopId, long userId, UserInfoEditDTO userInfoEditDTO) {
|
||||||
UserInfo userInfo = getById(userId);
|
UserInfo userInfo = getById(userId);
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ package com.czg.service.market.service.impl;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.account.dto.shopuser.ShopUserAddDTO;
|
||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
|
import com.czg.account.service.*;
|
||||||
import com.czg.market.dto.MemberConfigDTO;
|
import com.czg.market.dto.MemberConfigDTO;
|
||||||
import com.czg.account.entity.ShopInfo;
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.account.entity.UserInfo;
|
import com.czg.account.entity.UserInfo;
|
||||||
import com.czg.account.service.ShopInfoService;
|
|
||||||
import com.czg.account.service.ShopUserService;
|
|
||||||
import com.czg.market.service.TbMemberConfigService;
|
import com.czg.market.service.TbMemberConfigService;
|
||||||
import com.czg.account.service.UserInfoService;
|
|
||||||
import com.czg.market.vo.MemberConfigVO;
|
import com.czg.market.vo.MemberConfigVO;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.market.dto.MemberOrderDTO;
|
import com.czg.market.dto.MemberOrderDTO;
|
||||||
@@ -45,6 +44,8 @@ public class MemberOrderServiceImpl extends ServiceImpl<MemberOrderMapper, Membe
|
|||||||
@DubboReference
|
@DubboReference
|
||||||
private UserInfoService userInfoService;
|
private UserInfoService userInfoService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
|
private UShopUserService uShopUserService;
|
||||||
|
@DubboReference
|
||||||
private ShopUserService shopUserService;
|
private ShopUserService shopUserService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private TbMemberConfigService memberConfigService;
|
private TbMemberConfigService memberConfigService;
|
||||||
@@ -58,30 +59,53 @@ public class MemberOrderServiceImpl extends ServiceImpl<MemberOrderMapper, Membe
|
|||||||
ShopInfo shopInfo = shopInfoService.getById(orderDTO.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(orderDTO.getShopId());
|
||||||
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
||||||
|
|
||||||
if (orderDTO.getUserId() != null) {
|
UserInfo userInfo = userInfoService.getById(orderDTO.getUserId());
|
||||||
UserInfo userInfo = userInfoService.getById(orderDTO.getUserId());
|
AssertUtil.isNull(userInfo, "生成订单失败,用户信息不存在");
|
||||||
AssertUtil.isNull(userInfo, "生成订单失败,用户信息不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getSourceShopId, orderDTO.getShopId()).eq(ShopUser::getUserId, orderDTO.getUserId()));
|
|
||||||
AssertUtil.isNull(shopUser, "生成订单失败,用户信息不存在");
|
|
||||||
|
|
||||||
|
|
||||||
MemberConfigVO memberConfigVO = memberConfigService.detail(shopInfo.getId());
|
MemberConfigVO memberConfigVO = memberConfigService.detail(shopInfo.getId());
|
||||||
if(memberConfigVO.getConfigList() == null || memberConfigVO.getConfigList().isEmpty()) {
|
|
||||||
throw new CzgException("会员开通方案未配置,请联系店铺");
|
if (memberConfigVO.getIsSubmitInfo() == 1) {
|
||||||
|
AssertUtil.isBlank(orderDTO.getBirthDay(), "生日不能为空");
|
||||||
|
AssertUtil.isBlank(orderDTO.getNickName(), "名称不能为空");
|
||||||
|
AssertUtil.isNull(orderDTO.getSex(), "性别不能为空");
|
||||||
|
|
||||||
|
userInfo.setSex(orderDTO.getSex());
|
||||||
|
userInfo.setNickName(orderDTO.getNickName());
|
||||||
|
userInfo.setBirthDay(orderDTO.getBirthDay());
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getUserId, orderDTO.getUserId()).eq(ShopUser::getSourceShopId, orderDTO.getShopId()));
|
||||||
|
if (shopUser == null) {
|
||||||
|
uShopUserService.join(orderDTO.getShopId(), orderDTO.getUserId(), new ShopUserAddDTO()
|
||||||
|
.setPhone(userInfo.getPhone())
|
||||||
|
.setSex(userInfo.getSex())
|
||||||
|
.setHeadImg(userInfo.getHeadImg())
|
||||||
|
.setAmount(BigDecimal.ZERO)
|
||||||
|
.setBirthDay(userInfo.getBirthDay())
|
||||||
|
.setIsVip(0)
|
||||||
|
.setAccountPoints(0)
|
||||||
|
.setNickName(userInfo.getNickName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemberConfigDTO.ConfigList configItem = memberConfigVO.getConfigList().stream()
|
|
||||||
.filter(item -> item.getName().equals(orderDTO.getName()))
|
|
||||||
.findFirst()
|
|
||||||
.orElseThrow(() -> new CzgException("会员开通方案未配置,请联系店铺"));
|
|
||||||
|
|
||||||
if ("PAY".equals(memberConfigVO.getOpenType())){
|
if ("PAY".equals(memberConfigVO.getOpenType())){
|
||||||
|
if(memberConfigVO.getConfigList() == null || memberConfigVO.getConfigList().isEmpty()) {
|
||||||
|
throw new CzgException("会员开通方案未配置,请联系店铺");
|
||||||
|
}
|
||||||
|
AssertUtil.isBlank(orderDTO.getName(), "方案名称不能为空");
|
||||||
|
AssertUtil.isNull(orderDTO.getNum(), "开通周期数不为空");
|
||||||
|
|
||||||
|
MemberConfigDTO.ConfigList configItem = memberConfigVO.getConfigList().stream()
|
||||||
|
.filter(item -> item.getName().equals(orderDTO.getName()))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow(() -> new CzgException("会员开通方案未配置,请联系店铺"));
|
||||||
|
|
||||||
//生成订单
|
//生成订单
|
||||||
MemberOrder orderInfo = new MemberOrder();
|
MemberOrder orderInfo = new MemberOrder();
|
||||||
|
|
||||||
orderInfo.setOrderNo(orderDTO.getPlatformType() + IdUtil.getSnowflakeNextId());
|
orderInfo.setOrderNo(orderDTO.getPlatformType() + "ME" + IdUtil.getSnowflakeNextId());
|
||||||
orderInfo.setShopId(orderDTO.getShopId());
|
orderInfo.setShopId(orderDTO.getShopId());
|
||||||
orderInfo.setPayAmount(BigDecimal.ZERO);
|
orderInfo.setPayAmount(BigDecimal.ZERO);
|
||||||
orderInfo.setStatus(OrderStatusEnums.UNPAID.getCode());
|
orderInfo.setStatus(OrderStatusEnums.UNPAID.getCode());
|
||||||
|
|||||||
@@ -317,10 +317,6 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
|||||||
|
|
||||||
// 条件开通
|
// 条件开通
|
||||||
if (memberOrderId == null) {
|
if (memberOrderId == null) {
|
||||||
if (memberConfigVO.getConfigList() == null || memberConfigVO.getConfigList().isEmpty()) {
|
|
||||||
throw new CzgException("会员开通方案未配置,请联系店铺");
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertUtil.isTrue(!"CONDITION".equals(memberConfigVO.getOpenType()), "开通方式未开启");
|
AssertUtil.isTrue(!"CONDITION".equals(memberConfigVO.getOpenType()), "开通方式未开启");
|
||||||
|
|
||||||
for (MemberConfigDTO.condition item : memberConfigVO.getConditionList()) {
|
for (MemberConfigDTO.condition item : memberConfigVO.getConditionList()) {
|
||||||
@@ -328,15 +324,15 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
|||||||
case "BIND_PHONE" -> StrUtil.isNotBlank(shopUser.getPhone());
|
case "BIND_PHONE" -> StrUtil.isNotBlank(shopUser.getPhone());
|
||||||
case "ORDER" ->
|
case "ORDER" ->
|
||||||
orderInfoService.count(new QueryWrapper().eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getUserId, shopUser.getUserId())
|
orderInfoService.count(new QueryWrapper().eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||||
.notIn(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode(), OrderStatusEnums.CANCELLED.getCode())) > Integer.parseInt(item.getValue());
|
.notIn(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode(), OrderStatusEnums.CANCELLED.getCode())) >= Integer.parseInt(item.getValue());
|
||||||
case "COST_AMOUNT" ->
|
case "COST_AMOUNT" ->
|
||||||
orderInfoService.list(new QueryWrapper().eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getUserId, shopUser.getUserId())
|
orderInfoService.list(new QueryWrapper().eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||||
.notIn(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode(), OrderStatusEnums.CANCELLED.getCode()))
|
.notIn(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode(), OrderStatusEnums.CANCELLED.getCode()))
|
||||||
.stream().map(OrderInfo::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add).compareTo(new BigDecimal(item.getValue())) > 0;
|
.stream().map(OrderInfo::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add).compareTo(new BigDecimal(item.getValue())) >= 0;
|
||||||
case "RECHARGE_AMOUNT" ->
|
case "RECHARGE_AMOUNT" ->
|
||||||
paymentService.list(new QueryWrapper().eq(OrderPayment::getShopId, shopUser.getSourceShopId())
|
paymentService.list(new QueryWrapper().eq(OrderPayment::getShopId, shopUser.getSourceShopId())
|
||||||
.eq(OrderPayment::getSourceId, shopUser.getId()).isNotNull(OrderPayment::getTradeNumber))
|
.eq(OrderPayment::getSourceId, shopUser.getId()).isNotNull(OrderPayment::getTradeNumber))
|
||||||
.stream().map(OrderPayment::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).compareTo(new BigDecimal(item.getValue())) > 0;
|
.stream().map(OrderPayment::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add).compareTo(new BigDecimal(item.getValue())) >= 0;
|
||||||
default -> throw new CzgException("会员开通条件类型错误");
|
default -> throw new CzgException("会员开通条件类型错误");
|
||||||
};
|
};
|
||||||
if (!canOpen) {
|
if (!canOpen) {
|
||||||
@@ -344,15 +340,18 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DateUtil.isIn(DateUtil.date(), DateUtil.date(shopUser.getStartTime()), DateUtil.date(shopUser.getEndTime()))) {
|
if (shopUser.getStartTime() != null && shopUser.getEndTime() != null && DateUtil.isIn(DateUtil.date(), DateUtil.date(shopUser.getStartTime()), DateUtil.date(shopUser.getEndTime()))) {
|
||||||
throw new ApiNotPrintException("您已经是会员");
|
throw new ApiNotPrintException("您已经是会员");
|
||||||
}
|
}
|
||||||
shopUser.setMemberLevelId(levelConfig.getId());
|
shopUser.setMemberLevelId(levelConfig.getId());
|
||||||
shopUser.setStartTime(DateUtil.date().toLocalDateTime());
|
shopUser.setStartTime(DateUtil.date().toLocalDateTime());
|
||||||
|
|
||||||
// shopUser.setEndTime(shopUser.getStartTime().plusDays(30));
|
shopUser.setEndTime(shopUser.getStartTime().plusDays(20000));
|
||||||
// 购买开通
|
// 购买开通
|
||||||
} else {
|
} else {
|
||||||
|
if (memberConfigVO.getConfigList() == null || memberConfigVO.getConfigList().isEmpty()) {
|
||||||
|
throw new CzgException("会员开通方案未配置,请联系店铺");
|
||||||
|
}
|
||||||
|
|
||||||
if (shopUser.getStartTime() == null || shopUser.getEndTime().isBefore(DateUtil.date().toLocalDateTime())) {
|
if (shopUser.getStartTime() == null || shopUser.getEndTime().isBefore(DateUtil.date().toLocalDateTime())) {
|
||||||
shopUser.setStartTime(DateUtil.date().toLocalDateTime());
|
shopUser.setStartTime(DateUtil.date().toLocalDateTime());
|
||||||
|
|||||||
Reference in New Issue
Block a user