Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -11,12 +11,16 @@ import org.springblade.core.mp.support.Condition;
|
|||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
|
import org.springblade.modules.market.manager.MarketUserManager;
|
||||||
import org.springblade.modules.api.vo.MarketBenefitPackageVO;
|
import org.springblade.modules.api.vo.MarketBenefitPackageVO;
|
||||||
|
import org.springblade.modules.api.vo.MarketDirectInfoVO;
|
||||||
import org.springblade.modules.userPackage.service.IUserMarketBenefitPackageService;
|
import org.springblade.modules.userPackage.service.IUserMarketBenefitPackageService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Hidden
|
@Hidden
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -25,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class MarketUserController {
|
public class MarketUserController {
|
||||||
|
|
||||||
private final IUserMarketBenefitPackageService userMarketBenefitPackageService;
|
private final IUserMarketBenefitPackageService userMarketBenefitPackageService;
|
||||||
|
private final MarketUserManager marketUserManager;
|
||||||
|
|
||||||
@GetMapping("/find-user-benefit-pack-list")
|
@GetMapping("/find-user-benefit-pack-list")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
@@ -35,4 +40,24 @@ public class MarketUserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/find-user-market-direct-list")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@Operation(summary = "查直推")
|
||||||
|
public R<List<MarketDirectInfoVO>> findMarketDirectList() {
|
||||||
|
return R.data(marketUserManager.findUserPackList( AuthUtil.getUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/find-user-market-parent")
|
||||||
|
@ApiOperationSupport(order = 2)
|
||||||
|
@Operation(summary = "查推荐人信息")
|
||||||
|
public R<MarketDirectInfoVO> findMarketParent() {
|
||||||
|
return R.data(marketUserManager.findMarketParent( AuthUtil.getUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* BladeX Commercial License Agreement
|
||||||
|
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||||
|
* <p>
|
||||||
|
* Use of this software is governed by the Commercial License Agreement
|
||||||
|
* obtained after purchasing a license from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 1. This software is for development use only under a valid license
|
||||||
|
* from BladeX.
|
||||||
|
* <p>
|
||||||
|
* 2. Redistribution of this software's source code to any third party
|
||||||
|
* without a commercial license is strictly prohibited.
|
||||||
|
* <p>
|
||||||
|
* 3. Licensees may copyright their own code but cannot use segments
|
||||||
|
* from this software for such purposes. Copyright of this software
|
||||||
|
* remains with BladeX.
|
||||||
|
* <p>
|
||||||
|
* Using this software signifies agreement to this License, and the software
|
||||||
|
* must not be used for illegal purposes.
|
||||||
|
* <p>
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||||
|
* not liable for any claims arising from secondary or illegal development.
|
||||||
|
* <p>
|
||||||
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
|
*/
|
||||||
|
package org.springblade.modules.api.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户拓展信息表 视图实体类
|
||||||
|
*
|
||||||
|
* @author RayLiu
|
||||||
|
* @since 2026-02-05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MarketDirectInfoVO implements Serializable {
|
||||||
|
private String phone;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date registerTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package org.springblade.modules.market.convert;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import org.springblade.modules.api.vo.MarketDirectInfoVO;
|
||||||
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MarketUserMarketInfoConvert {
|
||||||
|
|
||||||
|
MarketUserMarketInfoConvert INSTANCE = Mappers.getMapper(MarketUserMarketInfoConvert.class);
|
||||||
|
|
||||||
|
@Mapping(target = "phone", expression = "java(org.springblade.core.tool.sensitive.SensitiveUtil.process(entity.getAccount()))")
|
||||||
|
@Mapping(target = "name", source = "name")
|
||||||
|
@Mapping(target = "registerTime", source = "createTime")
|
||||||
|
MarketDirectInfoVO convertMarketUserMarketInfoVO(User entity);
|
||||||
|
|
||||||
|
List<MarketDirectInfoVO> convertMarketUserMarketInfoVOList(List<User> list);
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package org.springblade.modules.market.manager;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springblade.modules.market.convert.MarketUserMarketInfoConvert;
|
||||||
|
import org.springblade.modules.api.vo.MarketDirectInfoVO;
|
||||||
|
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||||
|
import org.springblade.modules.market.service.IMarketInfoService;
|
||||||
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
|
import org.springblade.modules.system.service.IUserService;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MarketUserManager {
|
||||||
|
|
||||||
|
private final IMarketInfoService marketInfoService;
|
||||||
|
private final IUserService userService;
|
||||||
|
|
||||||
|
public List<MarketDirectInfoVO> findUserPackList(Long userId) {
|
||||||
|
|
||||||
|
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||||
|
Assert.notNull(marketInfoEntity, "用户不存在");
|
||||||
|
|
||||||
|
|
||||||
|
List<Long> marketInfoIdList = marketInfoService.list(
|
||||||
|
Wrappers.lambdaQuery(MarketInfoEntity.class)
|
||||||
|
.eq(MarketInfoEntity::getPid, marketInfoEntity.getId())
|
||||||
|
).stream().map(MarketInfoEntity::getId).toList();
|
||||||
|
|
||||||
|
List<User> userList = userService.list(
|
||||||
|
Wrappers.lambdaQuery(User.class)
|
||||||
|
.in(User::getId, marketInfoIdList)
|
||||||
|
);
|
||||||
|
|
||||||
|
return MarketUserMarketInfoConvert.INSTANCE.convertMarketUserMarketInfoVOList(userList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarketDirectInfoVO findMarketParent(Long userId) {
|
||||||
|
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||||
|
Assert.notNull(marketInfoEntity, "用户不存在");
|
||||||
|
if (marketInfoEntity.getPid() == null || marketInfoEntity.getPid() <= 0){
|
||||||
|
return new MarketDirectInfoVO();
|
||||||
|
}
|
||||||
|
User user = userService.getById(marketInfoEntity.getPid());
|
||||||
|
if (user == null){
|
||||||
|
return new MarketDirectInfoVO();
|
||||||
|
}
|
||||||
|
return MarketUserMarketInfoConvert.INSTANCE.convertMarketUserMarketInfoVO(user);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user