update:
1. fix bugs
This commit is contained in:
@@ -27,21 +27,29 @@ package org.springblade.modules.market.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.common.cache.ParamCache;
|
import org.springblade.common.cache.ParamCache;
|
||||||
import org.springblade.common.constant.CommonConstant;
|
import org.springblade.common.constant.CommonConstant;
|
||||||
import org.springblade.core.tool.utils.DateUtil;
|
import org.springblade.core.tool.utils.DateUtil;
|
||||||
import org.springblade.core.tool.utils.DigestUtil;
|
import org.springblade.core.tool.utils.DigestUtil;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springblade.modules.auth.provider.UserType;
|
import org.springblade.modules.auth.provider.UserType;
|
||||||
|
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
|
||||||
|
import org.springblade.modules.common.service.ICommonUserPointService;
|
||||||
|
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
|
||||||
|
import org.springblade.modules.market.pojo.entity.MarketCashCouponEntity;
|
||||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||||
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
||||||
import org.springblade.modules.market.mapper.MarketInfoMapper;
|
import org.springblade.modules.market.mapper.MarketInfoMapper;
|
||||||
|
import org.springblade.modules.market.service.IMarketBenefitPointService;
|
||||||
|
import org.springblade.modules.market.service.IMarketCashCouponService;
|
||||||
import org.springblade.modules.market.service.IMarketInfoService;
|
import org.springblade.modules.market.service.IMarketInfoService;
|
||||||
import org.springblade.modules.system.pojo.entity.User;
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
import org.springblade.modules.system.service.IUserService;
|
import org.springblade.modules.system.service.IUserService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -53,11 +61,19 @@ import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSW
|
|||||||
* @author RayLiu
|
* @author RayLiu
|
||||||
* @since 2026-02-05
|
* @since 2026-02-05
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, MarketInfoEntity> implements IMarketInfoService {
|
public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, MarketInfoEntity> implements IMarketInfoService {
|
||||||
|
|
||||||
private IUserService userService;
|
private final IUserService userService;
|
||||||
|
|
||||||
|
private final ICommonUserPointService userPointService;
|
||||||
|
|
||||||
|
private final IMarketCashCouponService cashCouponService;
|
||||||
|
|
||||||
|
private final IMarketBenefitPointService benefitPointService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<MarketInfoVO> selectMarketInfoPage(IPage<MarketInfoVO> page, MarketInfoVO marketInfo) {
|
public IPage<MarketInfoVO> selectMarketInfoPage(IPage<MarketInfoVO> page, MarketInfoVO marketInfo) {
|
||||||
@@ -65,11 +81,22 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean initInfo(User user, User invitor) {
|
public boolean initInfo(User user, User invitor) {
|
||||||
MarketInfoEntity info = new MarketInfoEntity();
|
MarketInfoEntity info = new MarketInfoEntity();
|
||||||
info.setId(user.getId());
|
info.setId(user.getId());
|
||||||
Optional.ofNullable(invitor).map(User::getId).ifPresent(info::setPid);
|
Optional.ofNullable(invitor).map(User::getId).ifPresent(info::setPid);
|
||||||
return save(info);
|
CommonUserPointEntity userPoint = new CommonUserPointEntity();
|
||||||
|
userPoint.setId(user.getId());
|
||||||
|
MarketCashCouponEntity cashCoupon = new MarketCashCouponEntity();
|
||||||
|
cashCoupon.setId(user.getId());
|
||||||
|
MarketBenefitPointEntity benefitPoint = new MarketBenefitPointEntity();
|
||||||
|
benefitPoint.setId(user.getId());
|
||||||
|
if (save(info) && userPointService.save(userPoint) && cashCouponService.save(cashCoupon) && benefitPointService.save(benefitPoint)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
log.error("用户信息初始化失败,id: {}", user.getId());
|
||||||
|
throw new RuntimeException("初始化失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user