1. 新增初始化
This commit is contained in:
2026-03-14 12:29:54 +08:00
parent 1ca7528c45
commit e9c5b2a95b
2 changed files with 29 additions and 17 deletions

View File

@@ -4,14 +4,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
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.MarketUserCommissionEntity;
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.IMarketUserCommissionService;
import org.springblade.modules.market.pojo.entity.*;
import org.springblade.modules.market.service.*;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Component;
@@ -37,6 +31,9 @@ public class InitUserAssetsProcessor implements BasicProcessor {
private final IMarketUserCommissionService commissionService;
private final IMarketWelfarePerformanceService welfarePerformanceService;
private final IMarketCashPerformanceService cashPerformanceService;
@Override
public ProcessResult process(TaskContext taskContext) throws Exception {
@@ -72,6 +69,18 @@ public class InitUserAssetsProcessor implements BasicProcessor {
commission.setId(user.getId());
commissionService.save(commission);
}
MarketWelfarePerformanceEntity welfarePerformance = welfarePerformanceService.getById(user.getId());
if (welfarePerformance == null) {
welfarePerformance = new MarketWelfarePerformanceEntity();
welfarePerformance.setId(user.getId());
welfarePerformanceService.save(welfarePerformance);
}
MarketCashPerformanceEntity cashPerformance = cashPerformanceService.getById(user.getId());
if (cashPerformance == null) {
cashPerformance = new MarketCashPerformanceEntity();
cashPerformance.setId(user.getId());
cashPerformanceService.save(cashPerformance);
}
});
return new ProcessResult(true, "result is success");
}

View File

@@ -37,16 +37,10 @@ import org.springblade.core.tool.utils.Func;
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.MarketUserCommissionEntity;
import org.springblade.modules.market.pojo.entity.*;
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
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.IMarketUserCommissionService;
import org.springblade.modules.market.service.*;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Service;
@@ -80,6 +74,11 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
private final IMarketUserCommissionService commissionService;
private final IMarketWelfarePerformanceService welfarePerformanceService;
private final IMarketCashPerformanceService cashPerformanceService;
@Override
public IPage<MarketInfoVO> selectMarketInfoPage(IPage<MarketInfoVO> page, MarketInfoVO marketInfo) {
@@ -100,7 +99,11 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
benefitPoint.setId(user.getId());
MarketUserCommissionEntity commission = new MarketUserCommissionEntity();
commission.setId(user.getId());
if (save(info) && userPointService.save(userPoint) && cashCouponService.save(cashCoupon) && benefitPointService.save(benefitPoint) && commissionService.save(commission)) {
MarketWelfarePerformanceEntity welfarePerformance = new MarketWelfarePerformanceEntity();
welfarePerformance.setId(user.getId());
MarketCashPerformanceEntity cashPerformance = new MarketCashPerformanceEntity();
cashPerformance.setId(user.getId());
if (save(info) && userPointService.save(userPoint) && cashCouponService.save(cashCoupon) && benefitPointService.save(benefitPoint) && commissionService.save(commission) && welfarePerformanceService.save(welfarePerformance) && cashPerformanceService.save(cashPerformance)) {
return true;
}
log.error("用户资产初始化失败,id: {}", user.getId());