Compare commits
4 Commits
097bbb9b55
...
3b8f62cc7f
Author | SHA1 | Date | |
---|---|---|---|
3b8f62cc7f | |||
bd0a481b94 | |||
8e578a9542 | |||
bca95d683d |
@ -0,0 +1,17 @@
|
||||
package com.greenorange.promotion.constant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MqConstant {
|
||||
|
||||
List<Long> DELAY_MILLIS = List.of(10000L, 10000L, 10000L, 15000L, 15000L, 30000L, 30000L, 60000L, 60000L, 120000L, 120000L, 120000L, 300000L);
|
||||
|
||||
// List<Long> DELAY_MILLIS = List.of(10000L, 10000L, 10000L, 15000L, 15000L);
|
||||
|
||||
String DELAY_EXCHANGE = "delay.topic";
|
||||
|
||||
String DELAY_ORDER_QUEUE = "order.delay.queue";
|
||||
|
||||
String DELAY_ORDER_ROUTING_KEY = "order.key";
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.greenorange.promotion.constant;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public interface SystemConstant {
|
||||
|
||||
/**
|
||||
@ -11,6 +13,18 @@ public interface SystemConstant {
|
||||
/**
|
||||
* 文件公共前缀
|
||||
*/
|
||||
String FILE_COMMON_PREFIX = "http://27.30.77.229:9091/file/download/";
|
||||
String FILE_COMMON_PREFIX = "http://160.202.242.36:9091/file/download/";
|
||||
|
||||
|
||||
/**
|
||||
* 一级抽成比例
|
||||
*/
|
||||
BigDecimal FIRST_LEVEL_COMMISSION_RATE = new BigDecimal("0.02");
|
||||
|
||||
|
||||
/**
|
||||
* 二级抽成比例
|
||||
*/
|
||||
BigDecimal SECOND_LEVEL_COMMISSION_RATE = new BigDecimal("0.03");
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import com.greenorange.promotion.model.dto.courseOrder.CourseOrderUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.Course;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.model.vo.course.CourseCardVO;
|
||||
import com.greenorange.promotion.model.vo.course.CourseVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderCardVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
@ -73,11 +74,16 @@ public class CourseOrderController {
|
||||
Long courseId = courseOrderAddRequest.getCourseId();
|
||||
Course course = courseService.getById(courseId);
|
||||
ThrowUtils.throwIf(course == null, ErrorCode.OPERATION_ERROR, "该课程不存在");
|
||||
CourseOrder courseOrder = commonService.copyProperties(course, CourseOrder.class);
|
||||
CourseVO courseVO = commonService.copyProperties(course, CourseVO.class);
|
||||
CourseOrder courseOrder = commonService.copyProperties(courseVO, CourseOrder.class);
|
||||
courseOrder.setId(null);
|
||||
courseOrder.setCourseId(courseId);
|
||||
courseOrder.setOrderNumber(OrderNumberUtils.generateOrderId());
|
||||
courseOrder.setTotalAmount(course.getDiscountPrice());
|
||||
courseOrder.setUserId(userId);
|
||||
courseOrderService.save(courseOrder);
|
||||
// 向消息队列中发送订单创建的消息
|
||||
courseOrderService.sendCreateOrderMessage(courseOrder.getId());
|
||||
return ResultUtils.success(courseOrder.getId());
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.greenorange.promotion.controller.course;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.refundRecord.RefundRecordAddRequest;
|
||||
import com.greenorange.promotion.model.dto.refundRecord.RefundRecordQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.refundRecord.RefundRecordUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.RefundRecord;
|
||||
import com.greenorange.promotion.model.vo.refundRecord.RefundRecordVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.refund.RefundRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
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 java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 退款记录 控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("refundRecord")
|
||||
@Slf4j
|
||||
@Tag(name = "退款记录模块")
|
||||
public class RefundRecordController {
|
||||
|
||||
@Resource
|
||||
private RefundRecordService refundRecordService;
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询退款记录
|
||||
* @param refundRecordQueryRequest 退款记录查询请求体
|
||||
* @return 退款记录列表
|
||||
*/
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询退款记录", description = "参数:退款记录查询请求体,权限:管理员,方法名:listRefundRecordByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "退款记录管理", content = "Web端管理员分页查询退款记录")
|
||||
public BaseResponse<Page<RefundRecordVO>> listRefundRecordByPage(@Valid @RequestBody RefundRecordQueryRequest refundRecordQueryRequest) {
|
||||
long current = refundRecordQueryRequest.getCurrent();
|
||||
long pageSize = refundRecordQueryRequest.getPageSize();
|
||||
QueryWrapper<RefundRecord> queryWrapper = refundRecordService.getQueryWrapper(refundRecordQueryRequest);
|
||||
Page<RefundRecord> page = refundRecordService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<RefundRecord> refundRecordList = page.getRecords();
|
||||
List<RefundRecordVO> refundRecordVOList = commonService.convertList(refundRecordList, RefundRecordVO.class);
|
||||
Page<RefundRecordVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(refundRecordVOList);
|
||||
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.entity.UserInfo;
|
||||
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.SupervisorUserVO;
|
||||
import com.greenorange.promotion.model.vo.userInfo.UserInfoVO;
|
||||
import com.greenorange.promotion.model.vo.userMainInfo.UserMainInfoVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
@ -30,10 +33,14 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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 上级用户信息
|
||||
@ -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 java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -59,6 +58,8 @@ public class WechatPayController {
|
||||
private WxOpenConfig wxOpenConfig;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* JSAPI 下单
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ import java.util.*;
|
||||
public class Generator {
|
||||
|
||||
// 数据源配置
|
||||
private static final String DATASOURCE_URL = "jdbc:mysql://27.30.77.229:3306/qingcheng_dev?serverTimezone=Asia/Shanghai";
|
||||
private static final String DATASOURCE_URL = "jdbc:mysql://160.202.242.36:3306/qingcheng_dev?serverTimezone=Asia/Shanghai";
|
||||
private static final String USERNAME = "qingcheng";
|
||||
private static final String PASSWORD = "Qc@8ls2jf";
|
||||
|
||||
@ -27,13 +27,13 @@ public class Generator {
|
||||
// 作者
|
||||
private static final String AUTHOR = "chenxinzhi";
|
||||
// 表注释
|
||||
private static final String TABLE_COMMENT = "晋升申请";
|
||||
private static final String TABLE_COMMENT = "课程推广待提成记录";
|
||||
// 实体类名
|
||||
private static final String ENTITY_NAME = "AdvancementApply";
|
||||
private static final String ENTITY_NAME = "CoursePromotionCommissionPending";
|
||||
// 表名
|
||||
private static final String TABLE_NAME = "advancement_apply";
|
||||
private static final String TABLE_NAME = "course_promotion_commission_pending";
|
||||
// 实体类属性名
|
||||
private static final String ENTITY_NAME_LOWER = "advancementApply";
|
||||
private static final String ENTITY_NAME_LOWER = "coursePromotionCommissionPending";
|
||||
|
||||
// 父包名
|
||||
private static final String PARENT_PATH = "com.greenorange.promotion";
|
||||
|
@ -0,0 +1,66 @@
|
||||
package com.greenorange.promotion.listener;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.greenorange.promotion.constant.MqConstant;
|
||||
import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.utils.MultiDelayMessage;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OrderStatusListener {
|
||||
|
||||
|
||||
@Resource
|
||||
private CourseOrderService courseOrderService;
|
||||
|
||||
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(MqConstant.DELAY_ORDER_QUEUE),
|
||||
exchange = @Exchange(name = MqConstant.DELAY_EXCHANGE, delayed = "true"),
|
||||
key = MqConstant.DELAY_ORDER_ROUTING_KEY
|
||||
))
|
||||
public void listenDelayMessage(MultiDelayMessage<Long> msg) {
|
||||
System.out.println("\n\n\n\n\nOrderStatusListener.listenerDelayMessage msg-------------------------------->:" + msg);
|
||||
// 1.获取消息中的订单id
|
||||
Long orderId = msg.getData();
|
||||
// 2.查询订单,判断状态是否为待支付
|
||||
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
// 订单不存在或者订单已经支付
|
||||
if (courseOrder == null || !courseOrder.getOrderStatus().equals(OrderStatusConstant.PENDING)) {
|
||||
return ;
|
||||
}
|
||||
// 3.订单未支付,判断是否还有剩余延时时间
|
||||
if (msg.hasNextDelay()) {
|
||||
// 有延迟时间,需要重发延迟消息,先获取延迟时间的int值
|
||||
// 发送延时消息
|
||||
Long delayValue = msg.removeNextDelay();
|
||||
rabbitTemplate.convertAndSend(MqConstant.DELAY_EXCHANGE,
|
||||
MqConstant.DELAY_ORDER_ROUTING_KEY, msg, message -> {
|
||||
// 添加延迟消息属性
|
||||
message.getMessageProperties().setDelayLong(delayValue);
|
||||
return message;
|
||||
});
|
||||
return ;
|
||||
}
|
||||
// 没有剩余延时时间,说明订单超时未支付,需取消订单
|
||||
LambdaUpdateWrapper<CourseOrder> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(CourseOrder::getId, orderId)
|
||||
.set(CourseOrder::getOrderStatus, OrderStatusConstant.CLOSED);
|
||||
courseOrderService.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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,18 @@
|
||||
package com.greenorange.promotion.mapper;
|
||||
|
||||
import com.greenorange.promotion.model.entity.RefundRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【refund_record(退款记录表)】的数据库操作Mapper
|
||||
* @createDate 2025-07-01 08:18:44
|
||||
* @Entity com.greenorange.promotion.model.entity.RefundRecord
|
||||
*/
|
||||
public interface RefundRecordMapper extends BaseMapper<RefundRecord> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class CourseAddRequest implements Serializable {
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||
@Schema(description = "课程类别[考公,财经]", example = "财经")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
|
@ -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,86 @@
|
||||
package com.greenorange.promotion.model.dto.refundRecord;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 退款记录添加请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "退款记录添加请求体", requiredProperties = {
|
||||
"outTradeNo",
|
||||
"outRefundNo",
|
||||
"name",
|
||||
"type",
|
||||
"image",
|
||||
"totalAmount",
|
||||
"refundAmount",
|
||||
"userId",
|
||||
})
|
||||
public class RefundRecordAddRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@NotBlank(message = "订单号不能为空")
|
||||
@Schema(description = "订单号", example = "")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
@NotBlank(message = "退款单号不能为空")
|
||||
@Schema(description = "退款单号", example = "")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@NotBlank(message = "课程名称不能为空")
|
||||
@Schema(description = "课程名称", example = "")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@Schema(description = "课程类别", example = "")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@NotBlank(message = "课程图片不能为空")
|
||||
@Schema(description = "课程图片", example = "")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
@Schema(description = "退款金额", example = "")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Min(value = 1L, message = "用户id ID不能小于1")
|
||||
@Schema(description = "用户id", example = "")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.greenorange.promotion.model.dto.refundRecord;
|
||||
|
||||
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 com.greenorange.promotion.common.PageRequest;
|
||||
|
||||
/**
|
||||
* 退款记录查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "退款记录查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class RefundRecordQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
@Schema(description = "退款单号", example = "42250701082233444328323233")
|
||||
private String outRefundNo;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
package com.greenorange.promotion.model.dto.refundRecord;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 退款记录更新请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "退款记录更新请求体", requiredProperties = {
|
||||
"id",
|
||||
"orderNumber",
|
||||
"outRefundNo",
|
||||
"name",
|
||||
"type",
|
||||
"image",
|
||||
"totalAmount",
|
||||
"refundAmount",
|
||||
"userId",
|
||||
})
|
||||
public class RefundRecordUpdateRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 退款记录id
|
||||
*/
|
||||
@Min(value = 1L, message = "退款记录id ID不能小于1")
|
||||
@Schema(description = "退款记录id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@NotBlank(message = "订单号不能为空")
|
||||
@Schema(description = "订单号", example = "")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
@NotBlank(message = "退款单号不能为空")
|
||||
@Schema(description = "退款单号", example = "")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@NotBlank(message = "课程名称不能为空")
|
||||
@Schema(description = "课程名称", example = "")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@Schema(description = "课程类别", example = "")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@NotBlank(message = "课程图片不能为空")
|
||||
@Schema(description = "课程图片", example = "")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
@Schema(description = "退款金额", example = "")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Min(value = 1L, message = "用户id ID不能小于1")
|
||||
@Schema(description = "用户id", example = "")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@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,87 @@
|
||||
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 jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 退款记录表
|
||||
* @TableName refund_record
|
||||
*/
|
||||
@TableName(value ="refund_record")
|
||||
@Data
|
||||
public class RefundRecord implements Serializable {
|
||||
/**
|
||||
* 退款记录id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
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,80 @@
|
||||
package com.greenorange.promotion.model.vo.refundRecord;
|
||||
|
||||
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.util.Date;
|
||||
|
||||
/**
|
||||
* 退款记录 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "退款记录 视图对象")
|
||||
public class RefundRecordVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 退款记录ID
|
||||
*/
|
||||
@Schema(description = "退款记录ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202507011522234822953432323")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
@Schema(description = "退款单号", example = "402507011522234822953432323")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Schema(description = "课程名称", example = "数据分析工程师训练营")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@Schema(description = "课程类别", example = "财经")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@Schema(description = "课程图片", example = "32DE33ND")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "50.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
@Schema(description = "退款金额", example = "40.00")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2025-07-01 15:22:23")
|
||||
private Date createTime;
|
||||
|
||||
@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;
|
||||
}
|
@ -17,4 +17,10 @@ public interface CourseOrderService extends IService<CourseOrder> {
|
||||
* 获取查询条件
|
||||
*/
|
||||
QueryWrapper<CourseOrder> getQueryWrapper(CourseOrderQueryRequest courseOrderQueryRequest);
|
||||
|
||||
|
||||
/**
|
||||
* 向消息队列中发送订单创建的消息
|
||||
*/
|
||||
void sendCreateOrderMessage(Long orderId);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -3,14 +3,21 @@ 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.constant.CommonConstant;
|
||||
import com.greenorange.promotion.constant.MqConstant;
|
||||
import com.greenorange.promotion.model.dto.courseOrder.CourseOrderQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.mapper.CourseOrderMapper;
|
||||
import com.greenorange.promotion.utils.MultiDelayMessage;
|
||||
import com.greenorange.promotion.utils.SqlUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【course_order(课程订单表)】的数据库操作Service实现
|
||||
@ -21,6 +28,10 @@ public class CourseOrderServiceImpl extends ServiceImpl<CourseOrderMapper, Cours
|
||||
implements CourseOrderService{
|
||||
|
||||
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
@ -36,6 +47,25 @@ public class CourseOrderServiceImpl extends ServiceImpl<CourseOrderMapper, Cours
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向消息队列中发送订单创建的消息
|
||||
*/
|
||||
@Override
|
||||
public void sendCreateOrderMessage(Long orderId) {
|
||||
// 复制 DELAY_MILLIS 到一个新的 ArrayList
|
||||
List<Long> newDelayMillis = new ArrayList<>(MqConstant.DELAY_MILLIS);
|
||||
// 延迟检查订单状态信息
|
||||
MultiDelayMessage<Long> msg = new MultiDelayMessage<>(orderId, newDelayMillis);
|
||||
long delayValue = msg.removeNextDelay();
|
||||
rabbitTemplate.convertAndSend(MqConstant.DELAY_EXCHANGE,
|
||||
MqConstant.DELAY_ORDER_ROUTING_KEY, msg, message -> {
|
||||
// 添加延迟消息属性
|
||||
message.getMessageProperties().setDelayLong(delayValue);
|
||||
return message;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.greenorange.promotion.service.refund;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.model.dto.refundRecord.RefundRecordQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.RefundRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【refund_record(退款记录表)】的数据库操作Service
|
||||
* @createDate 2025-07-01 08:18:44
|
||||
*/
|
||||
public interface RefundRecordService extends IService<RefundRecord> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
QueryWrapper<RefundRecord> getQueryWrapper(RefundRecordQueryRequest refundRecordQueryRequest);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.greenorange.promotion.service.refund.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.greenorange.promotion.constant.CommonConstant;
|
||||
import com.greenorange.promotion.model.dto.refundRecord.RefundRecordQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.RefundRecord;
|
||||
import com.greenorange.promotion.service.refund.RefundRecordService;
|
||||
import com.greenorange.promotion.mapper.RefundRecordMapper;
|
||||
import com.greenorange.promotion.utils.SqlUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【refund_record(退款记录表)】的数据库操作Service实现
|
||||
* @createDate 2025-07-01 08:18:44
|
||||
*/
|
||||
@Service
|
||||
public class RefundRecordServiceImpl extends ServiceImpl<RefundRecordMapper, RefundRecord>
|
||||
implements RefundRecordService{
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<RefundRecord> getQueryWrapper(RefundRecordQueryRequest refundRecordQueryRequest) {
|
||||
String outRefundNo = refundRecordQueryRequest.getOutRefundNo();
|
||||
String sortField = refundRecordQueryRequest.getSortField();
|
||||
String sortOrder = refundRecordQueryRequest.getSortOrder();
|
||||
QueryWrapper<RefundRecord> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(outRefundNo), "outRefundNo", outRefundNo);
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_DESC), sortField);
|
||||
return queryWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -10,8 +10,15 @@ import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.entity.Course;
|
||||
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.enums.CommissionStatusEnum;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
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.refund.RefundRecordService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.wechat.WechatPayService;
|
||||
import com.greenorange.promotion.utils.RefundUtils;
|
||||
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||
@ -33,6 +40,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 陈新知
|
||||
@ -53,6 +61,22 @@ public class WechatPayServiceImpl implements WechatPayService {
|
||||
private CourseService courseService;
|
||||
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
|
||||
@Resource
|
||||
private RefundRecordService refundRecordService;
|
||||
|
||||
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
|
||||
@Resource
|
||||
private CoursePromotionCommissionPendingService coursePromotionCommissionPendingService;
|
||||
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
@ -118,6 +142,28 @@ public class WechatPayServiceImpl implements WechatPayService {
|
||||
course.setOrderCount(course.getOrderCount() + 1);
|
||||
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("---------------------------微信支付回调(结束)-------------------------------");
|
||||
return true;
|
||||
}
|
||||
@ -152,7 +198,18 @@ public class WechatPayServiceImpl implements WechatPayService {
|
||||
amountReq.setCurrency("CNY");
|
||||
createRequest.setAmount(amountReq);
|
||||
|
||||
//TODO 生成退款记录
|
||||
// 生成退款记录
|
||||
Course course = courseService.getById(courseOrder.getCourseId());
|
||||
RefundRecord refundRecord = commonService.copyProperties(course, RefundRecord.class);
|
||||
refundRecord.setId(null);
|
||||
refundRecord.setOutTradeNo(orderNumber);
|
||||
refundRecord.setOutRefundNo(outRefundNo);
|
||||
refundRecord.setTotalAmount(courseOrder.getTotalAmount().movePointRight(2));
|
||||
refundRecord.setRefundAmount(refundAmount.movePointRight(2));
|
||||
refundRecord.setUserId(courseOrder.getUserId());
|
||||
refundRecord.setCreateTime(null);
|
||||
refundRecord.setUpdateTime(null);
|
||||
refundRecordService.save(refundRecord);
|
||||
|
||||
// 申请退款
|
||||
System.out.println("退款请求:" + createRequest);
|
||||
@ -189,6 +246,12 @@ public class WechatPayServiceImpl implements WechatPayService {
|
||||
courseService.updateById(course);
|
||||
}
|
||||
|
||||
// 修改课程推广待提成状态为"已失效"
|
||||
LambdaUpdateWrapper<CoursePromotionCommissionPending> coursePromotionUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
coursePromotionUpdateWrapper.eq(CoursePromotionCommissionPending::getOrderId, courseOrder.getId())
|
||||
.set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.EXPIRED.getValue());
|
||||
coursePromotionCommissionPendingService.update(coursePromotionUpdateWrapper);
|
||||
|
||||
System.out.println("---------------------------微信退款回调(结束)-------------------------------");
|
||||
return true;
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ wx:
|
||||
appId: wx61b63e27bddf4ea2
|
||||
#商户号
|
||||
merchantId: 1700326544
|
||||
# #商户API私钥
|
||||
# privateKeyPath: apiclient_key.pem
|
||||
#商户API私钥
|
||||
privateKeyPath: apiclient_key.pem
|
||||
#商户证书序列号
|
||||
merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
||||
# #商户APIv3密钥
|
||||
# apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||
#商户APIv3密钥
|
||||
apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||
#通知地址
|
||||
notifyUrl: https://winning-mouse-internally.ngrok-free.app
|
||||
#微信服务器地址
|
||||
|
@ -1,4 +1,4 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: test
|
||||
active: dev
|
||||
|
||||
|
@ -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>
|
28
src/main/resources/mapper/RefundRecordMapper.xml
Normal file
28
src/main/resources/mapper/RefundRecordMapper.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?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.RefundRecordMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.greenorange.promotion.model.entity.RefundRecord">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="orderNumber" column="orderNumber" jdbcType="VARCHAR"/>
|
||||
<result property="outRefundNo" column="outRefundNo" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||
<result property="image" column="image" jdbcType="VARCHAR"/>
|
||||
<result property="totalAmount" column="totalAmount" jdbcType="DECIMAL"/>
|
||||
<result property="refundAmount" column="refundAmount" jdbcType="DECIMAL"/>
|
||||
<result property="userId" column="userId" jdbcType="BIGINT"/>
|
||||
<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,orderNumber,outRefundNo,
|
||||
name,type,image,
|
||||
totalAmount,refundAmount,userId,
|
||||
isDelete,createTime,updateTime
|
||||
</sql>
|
||||
</mapper>
|
Reference in New Issue
Block a user