lenovo008\lenovo 4 months ago
commit 4a1fca0ffd

@ -93,6 +93,31 @@ public class AppBrokerageUserController {
// 统计分销用户数量(一级)
Long firstBrokerageUserCount = brokerageUserService.getBrokerageUserCountByBindUserId(brokerageUser.getId(), 1);
// 统计分销用户数量(二级)
Long secondBrokerageUserCount = brokerageUserService.getBrokerageUserCountByBindUserId(brokerageUser.getId(), null);
// 拼接返回
return success(BrokerageUserConvert.INSTANCE.convert(yesterdayPrice, withdrawPrice, firstBrokerageUserCount, secondBrokerageUserCount, brokerageUser));
}
@GetMapping("/get-zdscsummary")
@Operation(summary = "郑大商城获得个人分销统计")
@PreAuthenticated
public CommonResult<AppBrokerageUserMySummaryRespVO> getZdscBrokerageUserSummary() {
// 查询当前登录用户信息
BrokerageUserDO brokerageUser = brokerageUserService.getBrokerageUser(getLoginUserId());
// 统计用户昨日的佣金
LocalDateTime yesterday = LocalDateTime.now().minusDays(1);
LocalDateTime beginTime = LocalDateTimeUtil.beginOfDay(yesterday);
LocalDateTime endTime = LocalDateTimeUtil.endOfDay(yesterday);
Integer yesterdayPrice = brokerageRecordService.getSummaryPriceByUserId(brokerageUser.getId(),
BrokerageRecordBizTypeEnum.ORDER, BrokerageRecordStatusEnum.SETTLEMENT, beginTime, endTime);
// 统计用户提现的佣金
Integer withdrawPrice = brokerageWithdrawService.getWithdrawSummaryListByUserId(Collections.singleton(brokerageUser.getId()),
BrokerageWithdrawStatusEnum.AUDIT_SUCCESS).stream()
.findFirst().map(BrokerageWithdrawSummaryRespBO::getPrice).orElse(0);
// 统计直销用户数量(一级)
Long firstBrokerageUserCount = brokerageUserService.getBrokerageUserCountByBindUserId(brokerageUser.getId(), 1);
// 统计分销用户数量(二级)
Long secondBrokerageUserCount = brokerageUserService.getBrokerageUserCountByBindUserId(brokerageUser.getId(), 2);
// 拼接返回

@ -64,7 +64,7 @@ public interface BrokerageRecordMapper extends BaseMapperX<BrokerageRecordDO> {
.selectCount(BrokerageRecordDO::getId, UserBrokerageSummaryRespBO::getCount)
.selectSum(BrokerageRecordDO::getPrice)
.in(BrokerageRecordDO::getUserId, userIds)
.eq(BrokerageRecordDO::getBizId, bizType)
.eq(BrokerageRecordDO::getBizType, bizType)
.eq(BrokerageRecordDO::getStatus, status)
.groupBy(BrokerageRecordDO::getUserId)); // 按照 userId 聚合
return BeanUtil.copyToList(list, UserBrokerageSummaryRespBO.class);

@ -63,7 +63,7 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> {
Assert.isTrue(incrCount > 0);
LambdaUpdateWrapper<BrokerageUserDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<BrokerageUserDO>()
.setSql(" brokerage_price = brokerage_price + " + incrCount)
.eq(BrokerageUserDO::getBindUserId, id);
.eq(BrokerageUserDO::getId, id);
update(null, lambdaUpdateWrapper);
}
@ -95,7 +95,7 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> {
Assert.isTrue(incrCount < 0);
LambdaUpdateWrapper<BrokerageUserDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<BrokerageUserDO>()
.setSql(" brokerage_price = brokerage_price + " + incrCount) // 负数,所以使用 + 号
.eq(BrokerageUserDO::getBindUserId, id);
.eq(BrokerageUserDO::getId, id);
return update(null, lambdaUpdateWrapper);
}

@ -250,7 +250,7 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
if (CollUtil.isEmpty(userMap)) {
return PageResult.empty();
}
Integer status = BrokerageRecordStatusEnum.SETTLEMENT.getStatus();
// 2. 分页查询
IPage<AppBrokerageUserChildSummaryRespVO> pageResult = brokerageUserMapper.selectSummaryPageByUserId(
MyBatisUtils.buildPage(pageReqVO), BrokerageRecordBizTypeEnum.ORDER.getType(),
@ -340,6 +340,64 @@ if(ObjectUtil.isNotEmpty(bindUser)){
* @return
*/
private List<Long> getChildUserIdsByLevel(Long bindUserId, Integer level) {
if (bindUserId == null) {
return Collections.emptyList();
}
// 情况一level 为空,查询所有级别---郑大商城无限级别需递归查询
if (level == null) {
// 大商城无限级别需递归查询
List<Long> bindUserIds = recursionChildUserIds(new ArrayList<Long>(), bindUserId);
return bindUserIds;
}
// 先查第 1 级
List<Long> bindUserIds = brokerageUserMapper.selectIdListByBindUserIdIn(Collections.singleton(bindUserId));
if (CollUtil.isEmpty(bindUserIds)) {
return Collections.emptyList();
}
// 情况二level 为 1只查询第 1 级
if (level == 1) {
return bindUserIds;
}
// 情况三level 为 1只查询第 2 级
if (level == 2) {
return brokerageUserMapper.selectIdListByBindUserIdIn(bindUserIds);
}
throw exception(BROKERAGE_USER_LEVEL_NOT_SUPPORT);
}
/**
*
*
* @param bindUserIds
* @param bindUserId
* level 1+2
* @return
*/
private List<Long> recursionChildUserIds(List<Long> bindUserIds,Long bindUserId){
if (bindUserId == null) {
return Collections.emptyList();
}
//查询下级
List<Long> childbindUserIds = brokerageUserMapper.selectIdListByBindUserIdIn(Collections.singleton(bindUserId));
if (CollUtil.isNotEmpty(childbindUserIds)) {
bindUserIds.addAll(childbindUserIds);
for (Long userId:childbindUserIds) {
recursionChildUserIds(bindUserIds,userId);
}
}
return bindUserIds;
}
/**
* ------
*
* @param bindUserId
* @param level
* level 1+2
* @return
*/
private List<Long> getChildUserIdsByLevelCopy(Long bindUserId, Integer level) {
if (bindUserId == null) {
return Collections.emptyList();
}

@ -6,6 +6,7 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO;
@ -93,13 +94,13 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
}
// 4. 通知用户
Map<String, Object> templateParams = MapUtil.<String, Object>builder()
.put("createTime", LocalDateTimeUtil.formatNormal(withdraw.getCreateTime()))
.put("price", MoneyUtils.fenToYuanStr(withdraw.getPrice()))
.put("reason", withdraw.getAuditReason())
.build();
notifyMessageSendApi.sendSingleMessageToMember(new NotifySendSingleToUserReqDTO()
.setUserId(withdraw.getUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
// Map<String, Object> templateParams = MapUtil.<String, Object>builder()
// .put("createTime", LocalDateTimeUtil.formatNormal(withdraw.getCreateTime()))
// .put("price", MoneyUtils.fenToYuanStr(withdraw.getPrice()))
// .put("reason", withdraw.getAuditReason())
// .build();
// notifyMessageSendApi.sendSingleMessageToMember(new NotifySendSingleToUserReqDTO()
// .setUserId(withdraw.getUserId()).setTemplateCode(templateCode).setTemplateParams(templateParams));
}
private BrokerageWithdrawDO validateBrokerageWithdrawExists(Integer id) {

@ -27,14 +27,19 @@ import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreate
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO;
import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageRecordConvert;
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageRecordDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.cart.CartDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageRecordMapper;
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
import cn.iocoder.yudao.module.trade.dal.redis.no.TradeNoRedisDAO;
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
import cn.iocoder.yudao.module.trade.enums.order.*;
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
@ -111,6 +116,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
@Resource
private BrokerageUserService brokerageUserService;
@Resource
private BrokerageRecordMapper brokerageRecordMapper;
// =================== Order ===================
@ -685,7 +693,12 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
@Override
@TradeOrderLog(operateType = TradeOrderOperateTypeEnum.ADMIN_PICK_UP_RECEIVE)
public void pickUpOrderByAdmin(Long id, String pickUpVerifyCode) {
boolean b = brokerageUserService.updateUserPriceByBindUserId(id, 30);
boolean b = brokerageUserService.updateUserPriceByBindUserId(id, 3000);
// 3. 新增记录
BrokerageUserDO user = brokerageUserService.getBrokerageUser(id);
BrokerageRecordDO record = BrokerageRecordConvert.INSTANCE.convert(user, BrokerageRecordBizTypeEnum.ORDER, "", 0, 3000,
null, "门店核销佣金", null, null);
brokerageRecordMapper.insert(record);
getSelf().pickUpOrder(tradeOrderMapper.selectOneByPickUpVerifyCode(pickUpVerifyCode));
}

@ -5,22 +5,18 @@
<select id="selectSummaryPageByUserId"
resultType="cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryRespVO">
SELECT bu.id, bu.bind_user_time AS brokerageTime,
select * from (SELECT bu.id, bu.bind_user_time AS brokerageTime,
(SELECT SUM(price) FROM trade_brokerage_record r
WHERE r.user_id = bu.id AND biz_type = #{bizType} AND r.status = #{status} AND r.deleted = FALSE) AS brokeragePrice,
WHERE r.user_id = bu.id AND biz_type = #{bizType} AND r.status = #{status} AND r.deleted = FALSE) AS
brokeragePrice,
(SELECT COUNT(1) FROM trade_brokerage_record r
WHERE r.user_id = bu.id AND biz_type = #{bizType} AND r.status = #{status} AND r.deleted = FALSE) AS brokerageOrderCount,
WHERE r.user_id = bu.id AND biz_type = #{bizType} AND r.status = #{status} AND r.deleted = FALSE) AS
brokerageOrderCount,
(SELECT COUNT(1) FROM trade_brokerage_user c
WHERE c.bind_user_id = bu.id AND c.deleted = FALSE) AS brokerageUserCount
FROM trade_brokerage_user AS bu
<where>
bu.deleted = false
<if test="ids != null and ids.size() > 0">
and bu.id in
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</where>
<choose>
<when test="sortingField.field == 'userCount'">
@ -35,7 +31,15 @@
<otherwise>
ORDER BY bu.bind_user_time DESC
</otherwise>
</choose>
</choose>) r
<where>
<if test="ids != null and ids.size() > 0">
and r.id in
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
</mapper>

@ -43,4 +43,11 @@ public class DistributionLogPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
/**
* 线
*/
@Schema(description = "出线时间")
private LocalDateTime outTime;
}

@ -64,4 +64,12 @@ public class DistributionLogRespVO {
@ExcelProperty("手机号")
private String phone;
/**
* 线
*/
@Schema(description = "出线时间")
private LocalDateTime outTime;
}

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.member.controller.admin.distributionlog.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import java.util.*;
import javax.validation.constraints.*;
@ -36,4 +38,10 @@ public class DistributionLogSaveReqVO {
@Schema(description = "推荐人会员等级id", example = "10242")
private Long levelId;
}
/**
* 线
*/
@Schema(description = "出线时间")
private LocalDateTime outTime;
}

@ -0,0 +1,103 @@
package cn.iocoder.yudao.module.member.controller.app.distributionlog;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.member.controller.admin.distributionlog.vo.DistributionLogPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.distributionlog.vo.DistributionLogRespVO;
import cn.iocoder.yudao.module.member.controller.app.distributionlog.vo.AppDistributionLogPageReqVO;
import cn.iocoder.yudao.module.member.controller.app.distributionlog.vo.AppDistributionLogRespVO;
import cn.iocoder.yudao.module.member.controller.app.distributionlog.vo.AppDistributionLogSaveReqVO;
import cn.iocoder.yudao.module.member.convert.distributionlog.DistributionLogConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.distributionlog.DistributionLogDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.service.distributionlog.DistributionLogService;
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
@Tag(name = "app五占一接口 - 分销记录")
@RestController
@RequestMapping("/member/distribution-log")
@Validated
public class AppDistributionLogController {
@Resource
private DistributionLogService distributionLogService;
@Resource
private MemberUserService memberUserService;
@GetMapping("/getUserId")
@Operation(summary = "获取登录用户排名")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<?> getDistributionLog() {
//获取用户id
JSONObject obj = new JSONObject();
String rankNum = "请先购买1188产品";
Integer totalNum = 0;
Long loginUserId = getLoginUserId();
DistributionLogDO distributionLogDO1 = new DistributionLogDO();
distributionLogDO1.setGameStatus("1");
//查询所有未出线用户记录
List<DistributionLogDO> list1 = distributionLogService.getDistributionLogList(distributionLogDO1);
if(ObjectUtil.isNotEmpty(list1)){
totalNum = list1.size();
}
//先查询是否购买
DistributionLogDO distributionLogDO = new DistributionLogDO();
distributionLogDO.setMebId(loginUserId);
//查询用户记录
List<DistributionLogDO> list = distributionLogService.getDistributionLogList(distributionLogDO);
if(ObjectUtil.isNotEmpty(list)){
DistributionLogDO dto = list.get(0);
if(ObjectUtil.equal(dto.getGameStatus(),"0")){
rankNum = "已出线";
}else{
if(ObjectUtil.isNotEmpty(list1)){
for (int i = 0; i<list.size(); i++) {
DistributionLogDO dto1 = list.get(i);
if(ObjectUtil.equal(dto.getMebId(),loginUserId)){
rankNum = (i+1)+"名";
}
}
}
}
}
obj.put("rankNum",rankNum);
obj.put("totalNum",totalNum);
return success(obj);
}
@GetMapping("/outTodaypage")
@Operation(summary = "已出线记录")
public CommonResult<PageResult<DistributionLogRespVO>> getDistributionLogPage(@Valid DistributionLogPageReqVO pageReqVO) {
pageReqVO.setGameStatus("0");
PageResult<DistributionLogDO> pageResult = distributionLogService.getDistributionLogPage(pageReqVO);
// 拼接结果返回
List<MemberUserDO> users = memberUserService.getUserList(
convertSet(pageResult.getList(), DistributionLogDO::getMebId));
return success(DistributionLogConvert.INSTANCE.convertPage(pageResult, users));
}
}

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.member.controller.app.distributionlog.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 分销记录分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class AppDistributionLogPageReqVO extends PageParam {
@Schema(description = "推荐人id", example = "5267")
private Long referrerId;
@Schema(description = "推荐人id(便于回溯)", example = "23906")
private Long oldReferrerId;
@Schema(description = "购买人id", example = "6637")
private Long mebId;
@Schema(description = "佣金")
private Integer brokerage;
@Schema(description = "分佣结算核销状态", example = "2")
private String status;
@Schema(description = "游戏状态", example = "2")
private String gameStatus;
@Schema(description = "游戏兑换状态", example = "1")
private String convertStatus;
@Schema(description = "推荐人会员等级id", example = "10242")
private Long levelId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
/**
* 线
*/
@Schema(description = "出线时间")
private LocalDateTime outTime;
}

@ -0,0 +1,75 @@
package cn.iocoder.yudao.module.member.controller.app.distributionlog.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 分销记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class AppDistributionLogRespVO {
@Schema(description = "id主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4693")
@ExcelProperty("id主键")
private Long id;
@Schema(description = "推荐人id", example = "5267")
@ExcelProperty("推荐人id")
private Long referrerId;
@Schema(description = "推荐人id(便于回溯)", example = "23906")
@ExcelProperty("推荐人id(便于回溯)")
private Long oldReferrerId;
@Schema(description = "购买人id", example = "6637")
@ExcelProperty("购买人id")
private Long mebId;
@Schema(description = "佣金")
@ExcelProperty("佣金")
private Integer brokerage;
@Schema(description = "分佣结算核销状态", example = "2")
@ExcelProperty("分佣结算核销状态")
private String status;
@Schema(description = "游戏状态", example = "2")
@ExcelProperty("游戏状态")
private String gameStatus;
@Schema(description = "游戏兑换状态", example = "1")
@ExcelProperty("游戏兑换状态")
private String convertStatus;
@Schema(description = "推荐人会员等级id", example = "10242")
@ExcelProperty("推荐人会员等级id")
private Long levelId;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "用户昵称", example = "2")
@ExcelProperty("用户昵称")
private String nickname;
@Schema(description = "用户名称", example = "2")
@ExcelProperty("用户名称")
private String userName;
@Schema(description = "手机号", example = "2")
@ExcelProperty("手机号")
private String phone;
/**
* 线
*/
@Schema(description = "出线时间")
@ExcelProperty("出线时间")
private LocalDateTime outTime;
}

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.member.controller.app.distributionlog.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 分销记录新增/修改 Request VO")
@Data
public class AppDistributionLogSaveReqVO {
@Schema(description = "id主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4693")
private Long id;
@Schema(description = "推荐人id", example = "5267")
private Long referrerId;
@Schema(description = "推荐人id(便于回溯)", example = "23906")
private Long oldReferrerId;
@Schema(description = "购买人id", example = "6637")
private Long mebId;
@Schema(description = "佣金")
private Integer brokerage;
@Schema(description = "分佣结算核销状态", example = "2")
private String status;
@Schema(description = "游戏状态", example = "2")
private String gameStatus;
@Schema(description = "游戏兑换状态", example = "1")
private String convertStatus;
@Schema(description = "推荐人会员等级id", example = "10242")
private Long levelId;
/**
* 线
*/
@Schema(description = "出线时间")
private LocalDateTime outTime;
}

@ -60,4 +60,9 @@ public class DistributionLogDO extends BaseDO {
*/
private Long levelId;
}
/**
* 线
*/
private LocalDateTime outTime;
}

@ -28,7 +28,7 @@ public interface DistributionLogMapper extends BaseMapperX<DistributionLogDO> {
.eqIfPresent(DistributionLogDO::getConvertStatus, reqVO.getConvertStatus())
.eqIfPresent(DistributionLogDO::getLevelId, reqVO.getLevelId())
.betweenIfPresent(DistributionLogDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DistributionLogDO::getId));
.orderByAsc(DistributionLogDO::getId));
}
}
}

@ -51,5 +51,12 @@ public interface DistributionLogService {
* @return
*/
PageResult<DistributionLogDO> getDistributionLogPage(DistributionLogPageReqVO pageReqVO);
/**
*
*
* @param pageReqVO
* @return
*/
List<DistributionLogDO> getDistributionLogList(DistributionLogDO pageReqVO);
}
}

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.member.service.distributionlog;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -71,4 +73,29 @@ public class DistributionLogServiceImpl implements DistributionLogService {
return distributionLogMapper.selectPage(pageReqVO);
}
}
@Override
public List<DistributionLogDO> getDistributionLogList(DistributionLogDO pageReqVO) {
LambdaQueryWrapperX<DistributionLogDO> queryWrapperX = new LambdaQueryWrapperX<>();
if(ObjectUtil.isNotEmpty(pageReqVO.getMebId())){
queryWrapperX.eq(DistributionLogDO::getMebId,pageReqVO.getMebId());
}
if(ObjectUtil.isNotEmpty(pageReqVO.getStatus())){
queryWrapperX.eq(DistributionLogDO::getStatus,pageReqVO.getStatus());
}
if(ObjectUtil.isNotEmpty(pageReqVO.getConvertStatus())){
queryWrapperX.eq(DistributionLogDO::getConvertStatus,pageReqVO.getConvertStatus());
}
if(ObjectUtil.isNotEmpty(pageReqVO.getGameStatus())){
queryWrapperX.eq(DistributionLogDO::getGameStatus,pageReqVO.getGameStatus());
}
if(ObjectUtil.isNotEmpty(pageReqVO.getLevelId())){
queryWrapperX.eq(DistributionLogDO::getLevelId,pageReqVO.getLevelId());
}
if(ObjectUtil.isNotEmpty(pageReqVO.getReferrerId())){
queryWrapperX.eq(DistributionLogDO::getReferrerId,pageReqVO.getReferrerId());
}
queryWrapperX.orderByAsc(DistributionLogDO::getId);
return distributionLogMapper.selectList(queryWrapperX);
}
}

@ -444,28 +444,33 @@ public class MemberUserServiceImpl implements MemberUserService {
.orderByAsc(DistributionMebConfigDO::getLevelId));
//添加5占一
if(ObjectUtil.isNotEmpty(distributionMebConfigDOS)){
//添加5占一游戏
DistributionLogDO distributionLogDO = new DistributionLogDO();
distributionLogDO.setMebId(userId);
distributionLogDO.setStatus("1");
// distributionLogDO.setBrokerage();
distributionLogDO.setGameStatus("1");
distributionLogDO.setConvertStatus("1");
distributionLogMapper.insert(distributionLogDO);
//查询5占一总数
List<DistributionLogDO> distributionLogDOS = distributionLogMapper.selectList(new LambdaQueryWrapperX<DistributionLogDO>()
Long l = distributionLogMapper.selectCount(new LambdaQueryWrapperX<DistributionLogDO>().eq(DistributionLogDO::getMebId, userId)
.orderByAsc(DistributionLogDO::getCreateTime));
int i1 = distributionLogDOS.size() % 5;
if(i1 == 0){
// DistributionLogDO vo = distributionLogDOS.get((distributionLogDOS.size()/5)-1);
// vo.setGameStatus("0");
// distributionLogMapper.updateById(vo);
List<DistributionLogDO> distributionLogDOS1 = distributionLogDOS.subList(0, (distributionLogDOS.size() / 5));
for (DistributionLogDO dt:distributionLogDOS1) {
dt.setGameStatus("0");
}
distributionLogMapper.updateBatch(distributionLogDOS1);
if(l == 0){
//添加5占一游戏
DistributionLogDO distributionLogDO = new DistributionLogDO();
distributionLogDO.setMebId(userId);
distributionLogDO.setStatus("1");
// distributionLogDO.setBrokerage();
distributionLogDO.setGameStatus("1");
distributionLogDO.setConvertStatus("1");
distributionLogDO.setOutTime(LocalDateTime.now());
distributionLogMapper.insert(distributionLogDO);
//查询5占一总数
List<DistributionLogDO> distributionLogDOS = distributionLogMapper.selectList(new LambdaQueryWrapperX<DistributionLogDO>()
.orderByAsc(DistributionLogDO::getCreateTime));
int i1 = distributionLogDOS.size() % 5;
if(i1 == 0){
DistributionLogDO vo = distributionLogDOS.get((distributionLogDOS.size()/5)-1);
vo.setGameStatus("0");
distributionLogMapper.updateById(vo);
// List<DistributionLogDO> distributionLogDOS1 = distributionLogDOS.subList(0, (distributionLogDOS.size() / 5));
// for (DistributionLogDO dt:distributionLogDOS1) {
// dt.setGameStatus("0");
// }
// distributionLogMapper.updateBatch(distributionLogDOS1);
// distributionLogMapper.up
}
}
}
@ -482,6 +487,8 @@ public class MemberUserServiceImpl implements MemberUserService {
if(eg.getLevelId() == memberUserDO.getLevelId()){
//添加佣金记录
BrokerageRecordDO brokerageRecordDO = new BrokerageRecordDO();
// brokerageRecordDO.setId(Math.toIntExact(brokerageUserDO.getBindUserId()));
brokerageRecordDO.setBizId(orderId+"");
brokerageRecordDO.setUserId(memberUserDO.getId());
brokerageRecordDO.setBizType(1);
brokerageRecordDO.setTitle("分销直推佣金");
@ -500,11 +507,15 @@ public class MemberUserServiceImpl implements MemberUserService {
brokerageRecordDO.setSourceUserLevel(configLevelDO.getLevel());
brokerageRecordDO.setSourceUserId(userId);
brokerageRecordMapper.insert(brokerageRecordDO);
//修改推广员佣金
BrokerageUserDO brokerageUserDO1 = brokerageUserMapper.selectById(brokerageUserDO.getBindUserId());
brokerageUserDO1.setBrokeragePrice(eg.getBrokerage()*100+brokerageUserDO1.getBrokeragePrice());
brokerageUserMapper.updateById(brokerageUserDO1);
break;
}
}
}
recursionMemberLevel(brokerageUserDO.getId(),orderId);
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
}
}
}
@ -514,80 +525,82 @@ public class MemberUserServiceImpl implements MemberUserService {
private void recursionMemberLevel(Long userId,Long orderId){
//查询会员信息
MemberUserDO memberUserDO = memberUserMapper.selectById(userId);
DistributionStatisticsDO distributionStatisticsDO = new DistributionStatisticsDO();
distributionStatisticsDO.setLevelId(memberUserDO.getLevelId());
distributionStatisticsDO.setMebId(memberUserDO.getId());
distributionStatisticsDO.setLogId(orderId);
distributionStatisticsDO.setStatus("1");
distributionStatisticsMapper.insert(distributionStatisticsDO);
//查询会员当前等级
MemberLevelDO memberLevelDO = memberLevelMapper.selectById(memberUserDO.getLevelId());
if(ObjectUtil.isNotEmpty(memberLevelDO)){
//查询上一级会员等级
MemberLevelDO upLevelDO = memberLevelMapper.selectOne(new LambdaQueryWrapperX<MemberLevelDO>()
.eq(MemberLevelDO::getStatus, 0)
.eq(MemberLevelDO::getDeleted, 0)
.eq(MemberLevelDO::getLevel, (memberLevelDO.getLevel()+1))
.orderByAsc(MemberLevelDO::getLevel));
if(ObjectUtil.isNotEmpty(upLevelDO)){
if(ObjectUtil.equal(memberLevelDO.getLevel(),1)){//帮扶人不升级
//添加推荐统计
}
if(ObjectUtil.equal(memberLevelDO.getLevel(),2)){//帮扶员升级帮扶驿站
//查询会员邀请记录下级会员
List<BrokerageUserDO> brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
.eq(BrokerageUserDO::getBindUserId, userId)
.ge(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
.eq(BrokerageUserDO::getDeleted, 0)
);
if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
if(brokerageUserDOS.size()>=3){
//升级会员
memberUserMapper.updateById(new MemberUserDO()
.setId(userId)
.setLevelId(upLevelDO.getId())
);
brokerageUserMapper.updateById(new BrokerageUserDO()
.setId(userId)
.setLevel(upLevelDO.getLevel())
);
if(ObjectUtil.isNotEmpty(memberUserDO)){
DistributionStatisticsDO distributionStatisticsDO = new DistributionStatisticsDO();
distributionStatisticsDO.setLevelId(memberUserDO.getLevelId());
distributionStatisticsDO.setMebId(memberUserDO.getId());
distributionStatisticsDO.setLogId(orderId);
distributionStatisticsDO.setStatus("1");
distributionStatisticsMapper.insert(distributionStatisticsDO);
//查询会员当前等级
MemberLevelDO memberLevelDO = memberLevelMapper.selectById(memberUserDO.getLevelId());
if(ObjectUtil.isNotEmpty(memberLevelDO)){
//查询上一级会员等级
MemberLevelDO upLevelDO = memberLevelMapper.selectOne(new LambdaQueryWrapperX<MemberLevelDO>()
.eq(MemberLevelDO::getStatus, 0)
.eq(MemberLevelDO::getDeleted, 0)
.eq(MemberLevelDO::getLevel, (memberLevelDO.getLevel()+1))
.orderByAsc(MemberLevelDO::getLevel));
if(ObjectUtil.isNotEmpty(upLevelDO)){
if(ObjectUtil.equal(memberLevelDO.getLevel(),1)){//帮扶人不升级
//添加推荐统计
}
if(ObjectUtil.equal(memberLevelDO.getLevel(),2)){//帮扶员升级帮扶驿站
//查询会员邀请记录下级会员
List<BrokerageUserDO> brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
.eq(BrokerageUserDO::getBindUserId, userId)
.ge(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
.eq(BrokerageUserDO::getDeleted, 0)
);
if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
if(brokerageUserDOS.size()>=3){
//升级会员
memberUserMapper.updateById(new MemberUserDO()
.setId(userId)
.setLevelId(upLevelDO.getId())
);
brokerageUserMapper.updateById(new BrokerageUserDO()
.setId(userId)
.setLevel(upLevelDO.getLevel())
);
}
}
//判断上级会员是否升级
BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
}
//判断上级会员是否升级
BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
}
if(ObjectUtil.equal(memberLevelDO.getLevel(),3)){//帮扶驿站升级帮扶中心
//查询会员邀请记录下级会员
List<BrokerageUserDO> brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
.eq(BrokerageUserDO::getBindUserId, userId)
.ge(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
.eq(BrokerageUserDO::getDeleted, 0)
);
//查询会员邀请记录下级会员
List<BrokerageUserDO> brokerageUserDOS1 = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
.eq(BrokerageUserDO::getBindUserId, userId)
.ge(BrokerageUserDO::getLevel, 2)
.eq(BrokerageUserDO::getDeleted, 0)
);
if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
if(brokerageUserDOS.size()>=10 || brokerageUserDOS1.size()>=300){
//升级会员
memberUserMapper.updateById(new MemberUserDO()
.setId(userId)
.setLevelId(upLevelDO.getId())
);
brokerageUserMapper.updateById(new BrokerageUserDO()
.setId(userId)
.setLevel(upLevelDO.getLevel())
);
if(ObjectUtil.equal(memberLevelDO.getLevel(),3)){//帮扶驿站升级帮扶中心
//查询会员邀请记录下级会员
List<BrokerageUserDO> brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
.eq(BrokerageUserDO::getBindUserId, userId)
.ge(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
.eq(BrokerageUserDO::getDeleted, 0)
);
//查询会员邀请记录下级会员
List<BrokerageUserDO> brokerageUserDOS1 = brokerageUserMapper.selectList(new LambdaQueryWrapperX<BrokerageUserDO>()
.eq(BrokerageUserDO::getBindUserId, userId)
.ge(BrokerageUserDO::getLevel, 2)
.eq(BrokerageUserDO::getDeleted, 0)
);
if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
if(brokerageUserDOS.size()>=10 || brokerageUserDOS1.size()>=300){
//升级会员
memberUserMapper.updateById(new MemberUserDO()
.setId(userId)
.setLevelId(upLevelDO.getId())
);
brokerageUserMapper.updateById(new BrokerageUserDO()
.setId(userId)
.setLevel(upLevelDO.getLevel())
);
}
}
//判断上级会员是否升级
BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
}
if(ObjectUtil.equal(memberLevelDO.getLevel(),4)){//帮扶中心不做升级
}
//判断上级会员是否升级
BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
recursionMemberLevel(brokerageUserDO.getBindUserId(),orderId);
}
if(ObjectUtil.equal(memberLevelDO.getLevel(),4)){//帮扶中心不做升级
}
}
}

@ -21,5 +21,5 @@ VITE_APP_BAIDU_CODE = a1ff8825baa73c3a78eb96aa40325abc
# 默认账户密码
VITE_APP_DEFAULT_LOGIN_TENANT = 郑大钒水
VITE_APP_DEFAULT_LOGIN_USERNAME = admin
VITE_APP_DEFAULT_LOGIN_PASSWORD = admin123
VITE_APP_DEFAULT_LOGIN_USERNAME = zhengdafanshui
VITE_APP_DEFAULT_LOGIN_PASSWORD = 123456

@ -4,12 +4,12 @@ NODE_ENV=production
VITE_DEV=true
# 请求路径
VITE_BASE_URL='http://zda.huamar.com'
VITE_BASE_URL='http://zd.huamar.com'
# 文件上传类型server - 后端上传, client - 前端直连上传仅支持S3服务
VITE_UPLOAD_TYPE=server
# 上传路径
VITE_UPLOAD_URL='http://zda.huamar.com/admin-api/infra/file/upload'
VITE_UPLOAD_URL='http://zd.huamar.com/admin-api/infra/file/upload'
# 接口地址
VITE_API_URL=/admin-api

@ -197,8 +197,8 @@ const loginData = reactive({
tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE !== 'false',
loginForm: {
tenantName: '郑大钒水',
username: 'admin',
password: 'admin123',
username: 'zhengdafanshui',
password: '123456',
captchaVerification: '',
rememberMe: false
}

Loading…
Cancel
Save