完成的功能:
1.web端查询主管列表和员工列表 2.小程序端用户支付后生成课程推广待提成记录 3.小程序端用户退款后更新课程推广待提成记录状态
This commit is contained in:
@ -0,0 +1,154 @@
|
|||||||
|
package com.greenorange.promotion.controller.course;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||||
|
import com.greenorange.promotion.annotation.SysLog;
|
||||||
|
import com.greenorange.promotion.common.BaseResponse;
|
||||||
|
import com.greenorange.promotion.common.ErrorCode;
|
||||||
|
import com.greenorange.promotion.common.ResultUtils;
|
||||||
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
|
import com.greenorange.promotion.exception.BusinessException;
|
||||||
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
|
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||||
|
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingAddRequest;
|
||||||
|
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingQueryRequest;
|
||||||
|
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingUpdateRequest;
|
||||||
|
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||||
|
import com.greenorange.promotion.model.entity.UserInfo;
|
||||||
|
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||||
|
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||||
|
import com.greenorange.promotion.model.vo.coursePromotionCommissionPending.CoursePromotionCommissionPendingVO;
|
||||||
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
|
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||||
|
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程推广待提成记录 控制器
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("coursePromo")
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "课程推广待提成记录模块")
|
||||||
|
public class CoursePromotionCommissionPendingController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CoursePromotionCommissionPendingService coursePromotionCommissionPendingService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CommonService commonService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserInfoService userInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序端根据(一级)(二级)用户id查询课程推广待提成记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@PostMapping("query/userId")
|
||||||
|
@Operation(summary = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录", description = "参数:无,权限:管理员,方法名:queryCoursePromotionCommissionPendingByUserId")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
|
@SysLog(title = "课程推广待提成记录管理", content = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录")
|
||||||
|
public BaseResponse<List<CoursePromotionCommissionPendingVO>> queryCoursePromotionCommissionPendingByUserId(HttpServletRequest request) {
|
||||||
|
Long userId = (Long) request.getAttribute("userId");
|
||||||
|
UserInfo userInfo = userInfoService.getById(userId);
|
||||||
|
String userRole = userInfo.getUserRole();
|
||||||
|
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||||
|
LambdaQueryWrapper<CoursePromotionCommissionPending> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (UserRoleEnum.SUPERVISOR.equals(userRoleEnum)) {
|
||||||
|
lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getFirstUserId, userId);
|
||||||
|
}else if (UserRoleEnum.STAFF.equals(userRoleEnum)) {
|
||||||
|
lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getSecondUserId, userId);
|
||||||
|
} else {
|
||||||
|
throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
|
||||||
|
}
|
||||||
|
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = coursePromotionCommissionPendingService.list(lambdaQueryWrapper);
|
||||||
|
List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOS = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||||
|
return ResultUtils.success(coursePromotionCommissionPendingVOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web端管理员根据id查询课程推广待提成记录
|
||||||
|
* @param commonRequest 课程推广待提成记录id
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@PostMapping("query/id")
|
||||||
|
@Operation(summary = "web端管理员根据id查询课程推广待提成记录", description = "参数:课程推广待提成记录id,权限:管理员,方法名:queryCoursePromotionCommissionPendingById")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
|
@SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id查询课程推广待提成记录")
|
||||||
|
public BaseResponse<CoursePromotionCommissionPendingVO> queryCoursePromotionCommissionPendingById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||||
|
Long id = commonRequest.getId();
|
||||||
|
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||||
|
CoursePromotionCommissionPendingVO coursePromotionCommissionPendingVO = commonService.copyProperties(coursePromotionCommissionPending, CoursePromotionCommissionPendingVO.class);
|
||||||
|
return ResultUtils.success(coursePromotionCommissionPendingVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web端管理员根据id修改课程推广待提成记录状态
|
||||||
|
* @param commonRequest 课程推广待提成记录id
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@PostMapping("update")
|
||||||
|
@Operation(summary = "web端管理员根据id修改课程推广待提成记录状态", description = "参数:课程推广待提成记录id,权限:管理员,方法名:modifyCoursePromotionCommissionPendingStatus")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
|
@SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id修改课程推广待提成记录状态")
|
||||||
|
public BaseResponse<Boolean> modifyCoursePromotionCommissionPendingStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
||||||
|
Long id = commonRequest.getId();
|
||||||
|
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||||
|
String commissionStatus = coursePromotionCommissionPending.getCommissionStatus();
|
||||||
|
ThrowUtils.throwIf(!commissionStatus.equals(CommissionStatusEnum.PENDING.getValue()), ErrorCode.OPERATION_ERROR, "课程推广待提成记录状态错误");
|
||||||
|
LambdaUpdateWrapper<CoursePromotionCommissionPending> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(CoursePromotionCommissionPending::getId, id).set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.COMPLETED.getValue());
|
||||||
|
coursePromotionCommissionPendingService.update(updateWrapper);
|
||||||
|
return ResultUtils.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Web端管理员分页查询课程推广待提成记录
|
||||||
|
* @param coursePromotionCommissionPendingQueryRequest 课程推广待提成记录查询请求体
|
||||||
|
* @return 课程推广待提成记录列表
|
||||||
|
*/
|
||||||
|
@PostMapping("page")
|
||||||
|
@Operation(summary = "Web端管理员分页查询课程推广待提成记录", description = "参数:课程推广待提成记录查询请求体,权限:管理员,方法名:listCoursePromotionCommissionPendingByPage")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
|
@SysLog(title = "课程推广待提成记录管理", content = "Web端管理员分页查询课程推广待提成记录")
|
||||||
|
public BaseResponse<Page<CoursePromotionCommissionPendingVO>> listCoursePromotionCommissionPendingByPage(@Valid @RequestBody CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest) {
|
||||||
|
long current = coursePromotionCommissionPendingQueryRequest.getCurrent();
|
||||||
|
long pageSize = coursePromotionCommissionPendingQueryRequest.getPageSize();
|
||||||
|
QueryWrapper<CoursePromotionCommissionPending> queryWrapper = coursePromotionCommissionPendingService.getQueryWrapper(coursePromotionCommissionPendingQueryRequest);
|
||||||
|
Page<CoursePromotionCommissionPending> page = coursePromotionCommissionPendingService.page(new Page<>(current, pageSize), queryWrapper);
|
||||||
|
List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = page.getRecords();
|
||||||
|
List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOList = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||||
|
Page<CoursePromotionCommissionPendingVO> voPage = new Page<>(current, pageSize);
|
||||||
|
voPage.setRecords(coursePromotionCommissionPendingVOList);
|
||||||
|
voPage.setPages(page.getPages());
|
||||||
|
voPage.setTotal(page.getTotal());
|
||||||
|
return ResultUtils.success(voPage);
|
||||||
|
}
|
||||||
|
}
|
@ -17,7 +17,10 @@ import com.greenorange.promotion.model.dto.CommonStringRequest;
|
|||||||
import com.greenorange.promotion.model.dto.userInfo.*;
|
import com.greenorange.promotion.model.dto.userInfo.*;
|
||||||
import com.greenorange.promotion.model.entity.UserInfo;
|
import com.greenorange.promotion.model.entity.UserInfo;
|
||||||
import com.greenorange.promotion.model.entity.UserMainInfo;
|
import com.greenorange.promotion.model.entity.UserMainInfo;
|
||||||
|
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||||
|
import com.greenorange.promotion.model.vo.userInfo.StaffUserVO;
|
||||||
import com.greenorange.promotion.model.vo.userInfo.SuperUserInfoVO;
|
import com.greenorange.promotion.model.vo.userInfo.SuperUserInfoVO;
|
||||||
|
import com.greenorange.promotion.model.vo.userInfo.SupervisorUserVO;
|
||||||
import com.greenorange.promotion.model.vo.userInfo.UserInfoVO;
|
import com.greenorange.promotion.model.vo.userInfo.UserInfoVO;
|
||||||
import com.greenorange.promotion.model.vo.userMainInfo.UserMainInfoVO;
|
import com.greenorange.promotion.model.vo.userMainInfo.UserMainInfoVO;
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
@ -30,10 +33,14 @@ import jakarta.annotation.Resource;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -408,24 +415,6 @@ public class UserInfoController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * (小程序端)查询当前用户到根节点的userId路径
|
|
||||||
// * @param commonRequest 用户id
|
|
||||||
// * @return 用户表列表
|
|
||||||
// */
|
|
||||||
// @PostMapping("query/path")
|
|
||||||
// @Operation(summary = "查询当前用户到根节点的userId路径", description = "参数:用户id,权限:管理员(boss, admin),方法名:findPathToRootUserIdList")
|
|
||||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
|
||||||
// @SysLog(title = "用户管理", content = "查询当前用户到根节点的userId路径")
|
|
||||||
// public BaseResponse<List<Long>> findPathToRootUserIdList(@Valid @RequestBody CommonRequest commonRequest) {
|
|
||||||
// Long userId = commonRequest.getId();
|
|
||||||
// List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
|
||||||
// return ResultUtils.success(pathToRoot);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序端用户获取上级用户信息
|
* 小程序端用户获取上级用户信息
|
||||||
* @return 上级用户信息
|
* @return 上级用户信息
|
||||||
@ -446,4 +435,65 @@ public class UserInfoController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web端管理员查询主管列表
|
||||||
|
* @return 主管列表
|
||||||
|
*/
|
||||||
|
@PostMapping("query/supervisor")
|
||||||
|
@Operation(summary = "web端管理员查询主管列表", description = "参数:无,权限:管理员(boss, admin),方法名:querySupervisorList")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
|
public BaseResponse<List<SupervisorUserVO>> querySupervisorList() {
|
||||||
|
// 获取用户基本信息和主要信息表
|
||||||
|
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserRoleEnum.SUPERVISOR.getValue(), userInfoService);
|
||||||
|
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
|
||||||
|
// 封装Map, 键: 用户id,值:用户信息
|
||||||
|
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||||
|
for (UserInfo userInfo : userInfoList) {
|
||||||
|
userInfoMap.put(userInfo.getId(), userInfo);
|
||||||
|
}
|
||||||
|
List<SupervisorUserVO> supervisorUserVOS = new ArrayList<>();
|
||||||
|
for (UserMainInfo userMainInfo : userMainInfoList) {
|
||||||
|
SupervisorUserVO supervisorUserVO = commonService.copyProperties(userMainInfo, SupervisorUserVO.class);
|
||||||
|
UserInfo userInfo = userInfoMap.get(userMainInfo.getUserId());
|
||||||
|
BeanUtils.copyProperties(userInfo, supervisorUserVO);
|
||||||
|
supervisorUserVOS.add(supervisorUserVO);
|
||||||
|
}
|
||||||
|
return ResultUtils.success(supervisorUserVOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web端管理员根据主管id查询员工列表
|
||||||
|
* @param commonRequest 主管id
|
||||||
|
* @return 员工列表
|
||||||
|
*/
|
||||||
|
@PostMapping("query/staff")
|
||||||
|
@Operation(summary = "web端管理员根据主管id查询员工列表", description = "参数:主管id,权限:管理员(boss, admin),方法名:queryStaffListBySupervisorId")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
|
public BaseResponse<List<StaffUserVO>> queryStaffListBySupervisorId(@Valid @RequestBody CommonRequest commonRequest) {
|
||||||
|
Long id = commonRequest.getId();
|
||||||
|
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getParentUserId, id, userInfoService);
|
||||||
|
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
|
||||||
|
// 封装Map, 键: 用户id,值:用户信息
|
||||||
|
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||||
|
for (UserInfo userInfo : userInfoList) {
|
||||||
|
userInfoMap.put(userInfo.getId(), userInfo);
|
||||||
|
}
|
||||||
|
List<StaffUserVO> staffUserVOS = new ArrayList<>();
|
||||||
|
for (UserMainInfo userMainInfo : userMainInfoList) {
|
||||||
|
StaffUserVO staffUserVO = commonService.copyProperties(userMainInfo, StaffUserVO.class);
|
||||||
|
UserInfo userInfo = userInfoMap.get(userMainInfo.getUserId());
|
||||||
|
BeanUtils.copyProperties(userInfo, staffUserVO);
|
||||||
|
staffUserVOS.add(staffUserVO);
|
||||||
|
}
|
||||||
|
return ResultUtils.success(staffUserVOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@ -59,6 +58,8 @@ public class WechatPayController {
|
|||||||
private WxOpenConfig wxOpenConfig;
|
private WxOpenConfig wxOpenConfig;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSAPI 下单
|
* JSAPI 下单
|
||||||
*/
|
*/
|
||||||
|
@ -27,13 +27,13 @@ public class Generator {
|
|||||||
// 作者
|
// 作者
|
||||||
private static final String AUTHOR = "chenxinzhi";
|
private static final String AUTHOR = "chenxinzhi";
|
||||||
// 表注释
|
// 表注释
|
||||||
private static final String TABLE_COMMENT = "退款记录";
|
private static final String TABLE_COMMENT = "课程推广待提成记录";
|
||||||
// 实体类名
|
// 实体类名
|
||||||
private static final String ENTITY_NAME = "RefundRecord";
|
private static final String ENTITY_NAME = "CoursePromotionCommissionPending";
|
||||||
// 表名
|
// 表名
|
||||||
private static final String TABLE_NAME = "refund_record";
|
private static final String TABLE_NAME = "course_promotion_commission_pending";
|
||||||
// 实体类属性名
|
// 实体类属性名
|
||||||
private static final String ENTITY_NAME_LOWER = "refundRecord";
|
private static final String ENTITY_NAME_LOWER = "coursePromotionCommissionPending";
|
||||||
|
|
||||||
// 父包名
|
// 父包名
|
||||||
private static final String PARENT_PATH = "com.greenorange.promotion";
|
private static final String PARENT_PATH = "com.greenorange.promotion";
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.greenorange.promotion.mapper;
|
||||||
|
|
||||||
|
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 35880
|
||||||
|
* @description 针对表【course_promotion_commission_pending(课程推广待提成记录)】的数据库操作Mapper
|
||||||
|
* @createDate 2025-07-01 09:22:57
|
||||||
|
* @Entity com.greenorange.promotion.model.entity.CoursePromotionCommissionPending
|
||||||
|
*/
|
||||||
|
public interface CoursePromotionCommissionPendingMapper extends BaseMapper<CoursePromotionCommissionPending> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,114 @@
|
|||||||
|
package com.greenorange.promotion.model.dto.coursePromotionCommissionPending;
|
||||||
|
|
||||||
|
import com.greenorange.promotion.annotation.EnumValue;
|
||||||
|
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程推广待提成记录添加请求体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "课程推广待提成记录添加请求体", requiredProperties = {
|
||||||
|
"firstUserId",
|
||||||
|
"secondUserId",
|
||||||
|
"courseId",
|
||||||
|
"name",
|
||||||
|
"type",
|
||||||
|
"image",
|
||||||
|
"orderId",
|
||||||
|
"userId",
|
||||||
|
"totalAmount",
|
||||||
|
"commissionStatus",
|
||||||
|
"orderCreateTime",
|
||||||
|
})
|
||||||
|
public class CoursePromotionCommissionPendingAddRequest implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级用户
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "一级用户 ID不能小于1")
|
||||||
|
@Schema(description = "一级用户", example = "1")
|
||||||
|
private Long firstUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级用户
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "二级用户 ID不能小于1")
|
||||||
|
@Schema(description = "二级用户", example = "2")
|
||||||
|
private Long secondUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程id
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "课程id ID不能小于1")
|
||||||
|
@Schema(description = "课程id", example = "1")
|
||||||
|
private Long courseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "课程名称不能为空")
|
||||||
|
@Schema(description = "课程名称", example = "财务管理")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程类别
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "课程类别不能为空")
|
||||||
|
@Schema(description = "课程类别", example = "财经")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程图片
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "课程图片不能为空")
|
||||||
|
@Schema(description = "课程图片", example = "3JD32NDS")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程订单id
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "课程订单id ID不能小于1")
|
||||||
|
@Schema(description = "课程订单id", example = "1")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单用户id
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "下单用户id ID不能小于1")
|
||||||
|
@Schema(description = "下单用户id", example = "1")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单价格
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单价格", example = "50.00")
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提成状态
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "提成状态不能为空")
|
||||||
|
@EnumValue(enumClass = CommissionStatusEnum.class)
|
||||||
|
@Schema(description = "提成状态", example = "待提成")
|
||||||
|
private String commissionStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单创建时间", example = "2025-05-02 12:23:00")
|
||||||
|
private LocalDate orderCreateTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.greenorange.promotion.model.dto.coursePromotionCommissionPending;
|
||||||
|
|
||||||
|
import com.greenorange.promotion.annotation.EnumValue;
|
||||||
|
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import com.greenorange.promotion.common.PageRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程推广待提成记录查询请求体,继承自分页请求 PageRequest
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "课程推广待提成记录查询请求体", requiredProperties = {"current", "pageSize"})
|
||||||
|
public class CoursePromotionCommissionPendingQueryRequest extends PageRequest implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "课程名称", example = "财务管理")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程类别
|
||||||
|
*/
|
||||||
|
@Schema(description = "课程类别", example = "财经")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提成状态
|
||||||
|
*/
|
||||||
|
@EnumValue(enumClass = CommissionStatusEnum.class)
|
||||||
|
@Schema(description = "提成状态", example = "待提成")
|
||||||
|
private String commissionStatus;
|
||||||
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,118 @@
|
|||||||
|
package com.greenorange.promotion.model.dto.coursePromotionCommissionPending;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程推广待提成记录更新请求体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "课程推广待提成记录更新请求体", requiredProperties = {
|
||||||
|
"id",
|
||||||
|
"firstUserId",
|
||||||
|
"secondUserId",
|
||||||
|
"courseId",
|
||||||
|
"name",
|
||||||
|
"type",
|
||||||
|
"image",
|
||||||
|
"orderId",
|
||||||
|
"userId",
|
||||||
|
"totalAmount",
|
||||||
|
"commissionStatus",
|
||||||
|
"orderCreateTime",
|
||||||
|
})
|
||||||
|
public class CoursePromotionCommissionPendingUpdateRequest implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "id ID不能小于1")
|
||||||
|
@Schema(description = "id", example = "")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级用户
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "一级用户 ID不能小于1")
|
||||||
|
@Schema(description = "一级用户", example = "")
|
||||||
|
private Long firstUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级用户
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "二级用户 ID不能小于1")
|
||||||
|
@Schema(description = "二级用户", example = "")
|
||||||
|
private Long secondUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程id
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "课程id ID不能小于1")
|
||||||
|
@Schema(description = "课程id", example = "")
|
||||||
|
private Long courseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "课程名称不能为空")
|
||||||
|
@Schema(description = "课程名称", example = "")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程类别
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "课程类别不能为空")
|
||||||
|
@Schema(description = "课程类别", example = "")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程图片
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "课程图片不能为空")
|
||||||
|
@Schema(description = "课程图片", example = "")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程订单id
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "课程订单id ID不能小于1")
|
||||||
|
@Schema(description = "课程订单id", example = "")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单用户id
|
||||||
|
*/
|
||||||
|
@Min(value = 1L, message = "下单用户id ID不能小于1")
|
||||||
|
@Schema(description = "下单用户id", example = "")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单价格
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单价格", example = "")
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提成状态
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "提成状态不能为空")
|
||||||
|
@Schema(description = "提成状态", example = "")
|
||||||
|
private String commissionStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单创建时间", example = "")
|
||||||
|
private LocalDate orderCreateTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
package com.greenorange.promotion.model.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程推广待提成记录
|
||||||
|
* @TableName course_promotion_commission_pending
|
||||||
|
*/
|
||||||
|
@TableName(value ="course_promotion_commission_pending")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CoursePromotionCommissionPending implements Serializable {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级用户
|
||||||
|
*/
|
||||||
|
private Long firstUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级用户
|
||||||
|
*/
|
||||||
|
private Long secondUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程id
|
||||||
|
*/
|
||||||
|
private Long courseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程类别
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程订单id
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单价格
|
||||||
|
*/
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提成状态
|
||||||
|
*/
|
||||||
|
private String commissionStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建时间
|
||||||
|
*/
|
||||||
|
private Date orderCreateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.greenorange.promotion.model.enums;
|
||||||
|
|
||||||
|
import com.greenorange.promotion.annotation.BaseEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提成状态枚举
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum CommissionStatusEnum implements BaseEnum {
|
||||||
|
|
||||||
|
PENDING("待提成"),
|
||||||
|
COMPLETED("已提成"),
|
||||||
|
EXPIRED("已失效");
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
CommissionStatusEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BaseEnum 要求的方法:返回枚举对应的校验值
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有枚举值列表
|
||||||
|
*/
|
||||||
|
public static List<String> getValues() {
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.map(CommissionStatusEnum::getValue)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据值获取对应的枚举对象
|
||||||
|
*/
|
||||||
|
public static CommissionStatusEnum getEnumByValue(String value) {
|
||||||
|
if (StringUtils.isBlank(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (CommissionStatusEnum status : CommissionStatusEnum.values()) {
|
||||||
|
if (status.value.equals(value)) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package com.greenorange.promotion.model.vo.coursePromotionCommissionPending;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程推广待提成记录 视图对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "课程推广待提成记录 视图对象")
|
||||||
|
public class CoursePromotionCommissionPendingVO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程推广待提成记录ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "课程推广待提成记录ID", example = "1")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级用户
|
||||||
|
*/
|
||||||
|
@Schema(description = "一级用户", example = "1")
|
||||||
|
private Long firstUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级用户
|
||||||
|
*/
|
||||||
|
@Schema(description = "二级用户", example = "2")
|
||||||
|
private Long secondUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程id
|
||||||
|
*/
|
||||||
|
@Schema(description = "课程id", example = "1")
|
||||||
|
private Long courseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "课程名称", example = "财务管理")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程类别
|
||||||
|
*/
|
||||||
|
@Schema(description = "课程类别", example = "财经")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程图片
|
||||||
|
*/
|
||||||
|
@Schema(description = "课程图片", example = "3DIKE323")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程订单id
|
||||||
|
*/
|
||||||
|
@Schema(description = "课程订单id", example = "1")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单用户id
|
||||||
|
*/
|
||||||
|
@Schema(description = "下单用户id", example = "3")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单价格
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单价格", example = "50.00")
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提成状态
|
||||||
|
*/
|
||||||
|
@Schema(description = "提成状态", example = "待提成")
|
||||||
|
private String commissionStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单创建时间", example = "2025-07-01 12:00:00")
|
||||||
|
private LocalDate orderCreateTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.greenorange.promotion.model.vo.userInfo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工用户 视图对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "员工用户 视图对象")
|
||||||
|
public class StaffUserVO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户表 ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户ID", example = "1")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像URL
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户头像URL", example = "http://xxx.png")
|
||||||
|
private String userAvatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
@Schema(description = "手机号", example = "15888610253")
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号
|
||||||
|
*/
|
||||||
|
@Schema(description = "账号", example = "qingcheng")
|
||||||
|
private String userAccount;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请码
|
||||||
|
*/
|
||||||
|
@Schema(description = "邀请码", example = "666999")
|
||||||
|
private String invitationCode;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队人数(不包括自己)
|
||||||
|
*/
|
||||||
|
@Schema(description = "团队人数(不包括自己)", example = "8")
|
||||||
|
private Integer teamSize;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队收益
|
||||||
|
*/
|
||||||
|
@Schema(description = "团队收益", example = "25.00")
|
||||||
|
private BigDecimal teamEarnings;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给上级带来的收益
|
||||||
|
*/
|
||||||
|
@Schema(description = "给上级带来的收益", example = "8.00")
|
||||||
|
private BigDecimal parentEarnings;
|
||||||
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.greenorange.promotion.model.vo.userInfo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主管用户 视图对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "主管用户 视图对象")
|
||||||
|
public class SupervisorUserVO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户表 ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户ID", example = "1")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像URL
|
||||||
|
*/
|
||||||
|
@Schema(description = "用户头像URL", example = "http://xxx.png")
|
||||||
|
private String userAvatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
@Schema(description = "手机号", example = "15888610253")
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号
|
||||||
|
*/
|
||||||
|
@Schema(description = "账号", example = "qingcheng")
|
||||||
|
private String userAccount;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请码
|
||||||
|
*/
|
||||||
|
@Schema(description = "邀请码", example = "666999")
|
||||||
|
private String invitationCode;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队人数(不包括自己)
|
||||||
|
*/
|
||||||
|
@Schema(description = "团队人数(不包括自己)", example = "8")
|
||||||
|
private Integer teamSize;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队收益
|
||||||
|
*/
|
||||||
|
@Schema(description = "团队收益", example = "25.00")
|
||||||
|
private BigDecimal teamEarnings;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给上级带来的收益
|
||||||
|
*/
|
||||||
|
@Schema(description = "给上级带来的收益", example = "8.00")
|
||||||
|
private BigDecimal parentEarnings;
|
||||||
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.greenorange.promotion.service.course;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingQueryRequest;
|
||||||
|
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 35880
|
||||||
|
* @description 针对表【course_promotion_commission_pending(课程推广待提成记录)】的数据库操作Service
|
||||||
|
* @createDate 2025-07-01 09:22:57
|
||||||
|
*/
|
||||||
|
public interface CoursePromotionCommissionPendingService extends IService<CoursePromotionCommissionPending> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取查询条件
|
||||||
|
*/
|
||||||
|
QueryWrapper<CoursePromotionCommissionPending> getQueryWrapper(CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest);
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.greenorange.promotion.service.course.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingQueryRequest;
|
||||||
|
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||||
|
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||||
|
import com.greenorange.promotion.mapper.CoursePromotionCommissionPendingMapper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 35880
|
||||||
|
* @description 针对表【course_promotion_commission_pending(课程推广待提成记录)】的数据库操作Service实现
|
||||||
|
* @createDate 2025-07-01 09:22:57
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CoursePromotionCommissionPendingServiceImpl extends ServiceImpl<CoursePromotionCommissionPendingMapper, CoursePromotionCommissionPending>
|
||||||
|
implements CoursePromotionCommissionPendingService{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取查询条件
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QueryWrapper<CoursePromotionCommissionPending> getQueryWrapper(CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest) {
|
||||||
|
String name = coursePromotionCommissionPendingQueryRequest.getName();
|
||||||
|
String type = coursePromotionCommissionPendingQueryRequest.getType();
|
||||||
|
String commissionStatus = coursePromotionCommissionPendingQueryRequest.getCommissionStatus();
|
||||||
|
QueryWrapper<CoursePromotionCommissionPending> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StringUtils.isNotBlank(name), "name", name);
|
||||||
|
queryWrapper.eq(StringUtils.isNotBlank(type), "type", type);
|
||||||
|
queryWrapper.eq(StringUtils.isNotBlank(commissionStatus), "commissionStatus", commissionStatus);
|
||||||
|
return queryWrapper;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -10,11 +10,15 @@ import com.greenorange.promotion.constant.OrderStatusConstant;
|
|||||||
import com.greenorange.promotion.exception.ThrowUtils;
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
import com.greenorange.promotion.model.entity.Course;
|
import com.greenorange.promotion.model.entity.Course;
|
||||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||||
|
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||||
import com.greenorange.promotion.model.entity.RefundRecord;
|
import com.greenorange.promotion.model.entity.RefundRecord;
|
||||||
|
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||||
|
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||||
import com.greenorange.promotion.service.course.CourseService;
|
import com.greenorange.promotion.service.course.CourseService;
|
||||||
import com.greenorange.promotion.service.refund.RefundRecordService;
|
import com.greenorange.promotion.service.refund.RefundRecordService;
|
||||||
|
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||||
import com.greenorange.promotion.service.wechat.WechatPayService;
|
import com.greenorange.promotion.service.wechat.WechatPayService;
|
||||||
import com.greenorange.promotion.utils.RefundUtils;
|
import com.greenorange.promotion.utils.RefundUtils;
|
||||||
import com.wechat.pay.java.core.notification.NotificationParser;
|
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||||
@ -36,6 +40,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 陈新知
|
* @author 陈新知
|
||||||
@ -64,6 +69,14 @@ public class WechatPayServiceImpl implements WechatPayService {
|
|||||||
private RefundRecordService refundRecordService;
|
private RefundRecordService refundRecordService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserInfoService userInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CoursePromotionCommissionPendingService coursePromotionCommissionPendingService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求参数
|
* 请求参数
|
||||||
*/
|
*/
|
||||||
@ -129,6 +142,28 @@ public class WechatPayServiceImpl implements WechatPayService {
|
|||||||
course.setOrderCount(course.getOrderCount() + 1);
|
course.setOrderCount(course.getOrderCount() + 1);
|
||||||
courseService.updateById(course);
|
courseService.updateById(course);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加课程推广待提成记录
|
||||||
|
Long userId = courseOrder.getUserId();
|
||||||
|
List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
||||||
|
Long firstUserId = pathToRoot.get(0);
|
||||||
|
Long secondUserId = pathToRoot.get(1);
|
||||||
|
CoursePromotionCommissionPending coursePromotionCommissionPending = CoursePromotionCommissionPending.builder()
|
||||||
|
.firstUserId(firstUserId)
|
||||||
|
.secondUserId(secondUserId)
|
||||||
|
.courseId(courseId)
|
||||||
|
.name(courseOrder.getName())
|
||||||
|
.type(courseOrder.getType())
|
||||||
|
.image(courseOrder.getImage())
|
||||||
|
.orderId(courseOrder.getId())
|
||||||
|
.userId(userId)
|
||||||
|
.totalAmount(courseOrder.getTotalAmount())
|
||||||
|
.commissionStatus(CommissionStatusEnum.PENDING.getValue())
|
||||||
|
.orderCreateTime(courseOrder.getCreateTime())
|
||||||
|
.build();
|
||||||
|
coursePromotionCommissionPendingService.save(coursePromotionCommissionPending);
|
||||||
|
|
||||||
|
|
||||||
System.out.println("---------------------------微信支付回调(结束)-------------------------------");
|
System.out.println("---------------------------微信支付回调(结束)-------------------------------");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -211,7 +246,12 @@ public class WechatPayServiceImpl implements WechatPayService {
|
|||||||
courseService.updateById(course);
|
courseService.updateById(course);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 修改课程推广待提成状态
|
// 修改课程推广待提成状态为"已失效"
|
||||||
|
LambdaUpdateWrapper<CoursePromotionCommissionPending> coursePromotionUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
coursePromotionUpdateWrapper.eq(CoursePromotionCommissionPending::getOrderId, courseOrder.getId())
|
||||||
|
.set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.EXPIRED.getValue());
|
||||||
|
coursePromotionCommissionPendingService.update(coursePromotionUpdateWrapper);
|
||||||
|
|
||||||
System.out.println("---------------------------微信退款回调(结束)-------------------------------");
|
System.out.println("---------------------------微信退款回调(结束)-------------------------------");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.greenorange.promotion.mapper.CoursePromotionCommissionPendingMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.greenorange.promotion.model.entity.CoursePromotionCommissionPending">
|
||||||
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||||
|
<result property="firstUserId" column="firstUserId" jdbcType="BIGINT"/>
|
||||||
|
<result property="secondUserId" column="secondUserId" jdbcType="BIGINT"/>
|
||||||
|
<result property="couseId" column="couseId" jdbcType="BIGINT"/>
|
||||||
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||||
|
<result property="image" column="image" jdbcType="VARCHAR"/>
|
||||||
|
<result property="orderId" column="orderId" jdbcType="BIGINT"/>
|
||||||
|
<result property="userId" column="userId" jdbcType="BIGINT"/>
|
||||||
|
<result property="totalAmount" column="totalAmount" jdbcType="DECIMAL"/>
|
||||||
|
<result property="cmmissionStatus" column="cmmissionStatus" jdbcType="OTHER"/>
|
||||||
|
<result property="orderCreateTime" column="orderCreateTime" jdbcType="DATE"/>
|
||||||
|
<result property="isDelete" column="isDelete" jdbcType="TINYINT"/>
|
||||||
|
<result property="createTime" column="createTime" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="updateTime" column="updateTime" jdbcType="TIMESTAMP"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,firstUserId,secondUserId,
|
||||||
|
couseId,name,type,
|
||||||
|
image,orderId,userId,
|
||||||
|
totalAmount,cmmissionStatus,orderCreateTime,
|
||||||
|
isDelete,createTime,updateTime
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
Reference in New Issue
Block a user