Compare commits
14 Commits
7ca23bc987
...
dev
Author | SHA1 | Date | |
---|---|---|---|
5f7c3b50ff | |||
869fd1a8b1 | |||
e880431e07 | |||
1513ea51dc | |||
bbd063c4cd | |||
42aff09dae | |||
77c73355e2 | |||
3d8fd5591e | |||
ad6eb74170 | |||
1f7e1211cf | |||
502f079194 | |||
a0e60bece6 | |||
f871d61650 | |||
95d30cc5f6 |
7
pom.xml
7
pom.xml
@ -214,6 +214,13 @@
|
||||
<version>2.6.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
<version>5.8.7</version> <!-- 换成你项目里使用的 Spring Security 版本 -->
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2,6 +2,8 @@ package com.greenorange.promotion.annotation;
|
||||
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@ -23,6 +25,6 @@ public class EnumValueValidator implements ConstraintValidator<EnumValue, String
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
return validValues.contains(value);
|
||||
return StringUtils.isBlank(value) || validValues.contains(value);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.greenorange.promotion.constant;
|
||||
|
||||
/**
|
||||
* 订单状态常量
|
||||
*/
|
||||
public interface OrderStatusConstant {
|
||||
|
||||
String CLOSED = "交易关闭";
|
||||
|
||||
String SUCCESS = "交易成功";
|
||||
|
||||
String PENDING = "待支付";
|
||||
|
||||
String REFUNDED = "已退款";
|
||||
|
||||
|
||||
}
|
@ -7,4 +7,10 @@ public interface SystemConstant {
|
||||
*/
|
||||
String VERIFICATION_CODE = "verificationCode";
|
||||
|
||||
|
||||
/**
|
||||
* 文件公共前缀
|
||||
*/
|
||||
String FILE_COMMON_PREFIX = "http://27.30.77.229:9091/file/download/";
|
||||
|
||||
}
|
||||
|
@ -43,4 +43,19 @@ public interface UserConstant {
|
||||
*/
|
||||
String BAN_ROLE = "ban";
|
||||
|
||||
/**
|
||||
* 经理
|
||||
*/
|
||||
String MANAGER_ROLE = "manager";
|
||||
|
||||
/**
|
||||
* 主管
|
||||
*/
|
||||
String SUPERVISOR_ROLE = "supervisor";
|
||||
|
||||
/**
|
||||
* 员工
|
||||
*/
|
||||
String STAFF_ROLE = "staff";
|
||||
|
||||
}
|
||||
|
@ -121,15 +121,15 @@ public class CourseChapterController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询课程章节
|
||||
* Web端管理员根据课程id分页查询课程章节
|
||||
* @param courseChapterQueryRequest 课程章节查询请求体
|
||||
* @return 课程章节列表
|
||||
*/
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询课程章节", description = "参数:课程章节查询请求体,权限:管理员,方法名:listCourseChapterByPage")
|
||||
@Operation(summary = "Web端管理员根据课程id分页查询课程章节", description = "参数:课程章节查询请求体,权限:管理员,方法名:listCourseChapterByPageByCourseId")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程章节管理", content = "Web端管理员分页查询课程章节")
|
||||
public BaseResponse<Page<CourseChapterVO>> listCourseChapterByPage(@Valid @RequestBody CourseChapterQueryRequest courseChapterQueryRequest) {
|
||||
@SysLog(title = "课程章节管理", content = "Web端管理员根据课程id分页查询课程章节")
|
||||
public BaseResponse<Page<CourseChapterVO>> listCourseChapterByPageByCourseId(@Valid @RequestBody CourseChapterQueryRequest courseChapterQueryRequest) {
|
||||
long current = courseChapterQueryRequest.getCurrent();
|
||||
long pageSize = courseChapterQueryRequest.getPageSize();
|
||||
QueryWrapper<CourseChapter> queryWrapper = courseChapterService.getQueryWrapper(courseChapterQueryRequest);
|
||||
|
@ -1,29 +1,40 @@
|
||||
package com.greenorange.promotion.controller.course;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
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.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
import com.greenorange.promotion.model.dto.course.CourseAddRequest;
|
||||
import com.greenorange.promotion.model.dto.course.CourseQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.course.CourseUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.Course;
|
||||
import com.greenorange.promotion.model.entity.CourseChapter;
|
||||
import com.greenorange.promotion.model.entity.CourseQrcodeApply;
|
||||
import com.greenorange.promotion.model.entity.ProjectCommission;
|
||||
import com.greenorange.promotion.model.vo.course.CourseCardVO;
|
||||
import com.greenorange.promotion.model.vo.course.CourseDetailVO;
|
||||
import com.greenorange.promotion.model.vo.course.CourseVO;
|
||||
import com.greenorange.promotion.model.vo.courseChapter.CourseChapterVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.course.CourseChapterService;
|
||||
import com.greenorange.promotion.service.course.CourseQrcodeApplyService;
|
||||
import com.greenorange.promotion.service.course.CourseService;
|
||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||
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 jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -31,7 +42,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@ -52,6 +66,130 @@ public class CourseController {
|
||||
@Resource
|
||||
private CourseChapterService courseChapterService;
|
||||
|
||||
@Resource
|
||||
private WechatGetQrcodeService wechatGetQrcodeService;
|
||||
|
||||
@Resource
|
||||
private CourseQrcodeApplyService courseQrcodeApplyService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查看热门课程列表
|
||||
* @return 课程信息列表
|
||||
*/
|
||||
@PostMapping("query/hot")
|
||||
@Operation(summary = "小程序端用户查看热门课程列表", description = "参数:无,权限:管理员,方法名:miniQueryHotCourseList")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户查看热门课程列表")
|
||||
public BaseResponse<List<CourseCardVO>> miniQueryHotCourseList() {
|
||||
List<Course> courseList = commonService.findByFieldEqTargetField(Course::getIsShelves, true, courseService);
|
||||
// 降序排序并取前四个元素
|
||||
courseList = courseList.stream()
|
||||
.sorted((course1, course2) -> Integer.compare(course2.getOrderCount(), course1.getOrderCount())) // 降序排序
|
||||
.limit(4) // 取前四个元素
|
||||
.collect(Collectors.toList());
|
||||
List<CourseCardVO> courseCardVOS = commonService.convertList(courseList, CourseCardVO.class);
|
||||
return ResultUtils.success(courseCardVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据类别查看课程列表
|
||||
* @param commonStringRequest 课程类别
|
||||
* @return 课程信息列表
|
||||
*/
|
||||
@PostMapping("query/type")
|
||||
@Operation(summary = "小程序端用户根据类别查看课程列表", description = "参数:课程添加请求体,权限:管理员,方法名:miniQueryCourseByType")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户根据类别查看课程列表")
|
||||
public BaseResponse<List<CourseCardVO>> miniQueryCourseByType(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String courseType = commonStringRequest.getTemplateString();
|
||||
Map<SFunction<Course, ?>, Object> fieldConditions = Map.of(Course::getType, courseType, Course::getIsShelves, true);
|
||||
List<Course> courseList = commonService.findByFieldEqTargetFields(fieldConditions, courseService);
|
||||
List<CourseCardVO> courseCardVOS = commonService.convertList(courseList, CourseCardVO.class);
|
||||
return ResultUtils.success(courseCardVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据id查询课程详情
|
||||
* @param commonRequest 课程id
|
||||
* @return 课程信息列表
|
||||
*/
|
||||
@PostMapping("query/id")
|
||||
@Operation(summary = "小程序端用户根据id查询课程详情", description = "参数:课程id,权限:管理员,方法名:miniQueryCourseById")
|
||||
@SysLog(title = "课程管理", content = "小程序端用户根据id查询课程详情")
|
||||
public BaseResponse<CourseDetailVO> miniQueryCourseById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
Course course = courseService.getById(id);
|
||||
CourseDetailVO courseDetailVO = commonService.copyProperties(course, CourseDetailVO.class);
|
||||
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CourseChapter::getCourseId, id);
|
||||
List<CourseChapter> courseChapterList = courseChapterService.list(lambdaQueryWrapper);
|
||||
List<CourseChapterVO> courseChapterVOS = commonService.convertList(courseChapterList, CourseChapterVO.class);
|
||||
courseDetailVO.setCourseChapters(courseChapterVOS);
|
||||
return ResultUtils.success(courseDetailVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户生成课程推广码
|
||||
* @param commonRequest 课程id
|
||||
* @return 课程信息列表
|
||||
*/
|
||||
@PostMapping("generate/qrcode")
|
||||
@Operation(summary = "小程序端用户生成课程推广码", description = "参数:课程id,权限:管理员,方法名:miniGenerateQrcode")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户生成课程推广码")
|
||||
public BaseResponse<String> miniGenerateQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||
String videoView = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
||||
return ResultUtils.success(videoView);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据id查看课程基本信息
|
||||
* @param commonRequest 课程id
|
||||
* @return 课程基本信息
|
||||
*/
|
||||
@PostMapping("detail/id")
|
||||
@Operation(summary = "小程序端用户根据id查看课程基本信息", description = "参数:课程id,权限:管理员,方法名:miniQueryCourseBaseInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户根据id查看课程基本信息")
|
||||
public BaseResponse<CourseCardVO> miniQueryCourseBaseInfo(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
Course course = courseService.getById(id);
|
||||
CourseCardVO courseCardVO = commonService.copyProperties(course, CourseCardVO.class);
|
||||
return ResultUtils.success(courseCardVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查看当前课程推广码
|
||||
* @param commonRequest 课程id
|
||||
* @return 课程推广码(view值)
|
||||
*/
|
||||
@PostMapping("verify")
|
||||
@Operation(summary = "小程序端用户查看当前课程推广码", description = "参数:课程id,权限:管理员,方法名:verifyIsApplyCourseQrcode")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户查看当前课程推广码")
|
||||
public BaseResponse<String> verifyIsApplyCourseQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
Long courseId = commonRequest.getId();
|
||||
LambdaQueryWrapper<CourseQrcodeApply> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CourseQrcodeApply::getUserId, userId).eq(CourseQrcodeApply::getCourseId, courseId);
|
||||
CourseQrcodeApply courseQrcodeApply = courseQrcodeApplyService.getOne(lambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(courseQrcodeApply == null, ErrorCode.OPERATION_ERROR, "当前用户尚未申请该课程的推广码");
|
||||
return ResultUtils.success(courseQrcodeApply.getCourseQrcode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员添加课程
|
||||
* @param courseAddRequest 课程添加请求体
|
||||
@ -62,6 +200,9 @@ public class CourseController {
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员添加课程")
|
||||
public BaseResponse<Long> addCourse(@Valid @RequestBody CourseAddRequest courseAddRequest) {
|
||||
BigDecimal firstLevelRate = courseAddRequest.getFirstLevelRate();
|
||||
BigDecimal secondLevelRate = courseAddRequest.getSecondLevelRate();
|
||||
ThrowUtils.throwIf(firstLevelRate.compareTo(secondLevelRate) < 0, ErrorCode.PARAMS_ERROR, "一级佣金比例不能小于二级佣金比例");
|
||||
Course course = commonService.copyProperties(courseAddRequest, Course.class);
|
||||
courseService.save(course);
|
||||
return ResultUtils.success(course.getId());
|
||||
@ -73,7 +214,7 @@ public class CourseController {
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员根据id修改课程", description = "参数:课程更新请求体,权限:管理员,方法名:updateCourse")
|
||||
@Operation(summary = "web端管理员根据id修改课程信息", description = "参数:课程更新请求体,权限:管理员,方法名:updateCourse")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员根据id修改课程信息")
|
||||
public BaseResponse<Boolean> updateCourse(@Valid @RequestBody CourseUpdateRequest courseUpdateRequest) {
|
||||
@ -135,6 +276,25 @@ public class CourseController {
|
||||
return ResultUtils.success(courseVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员上(下)架课程
|
||||
* @param commonRequest 课程id
|
||||
* @return 课程信息
|
||||
*/
|
||||
@PostMapping("isShelves")
|
||||
@Operation(summary = "web端管理员上(下)架课程", description = "参数:课程查询请求体,权限:管理员,方法名:updateCourseShelvesStatus")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程管理", content = "web端管理员上(下)架课程")
|
||||
public BaseResponse<Boolean> updateCourseShelvesStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
Course course = courseService.getById(id);
|
||||
course.setIsShelves(!course.getIsShelves());
|
||||
courseService.updateById(course);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询课程
|
||||
* @param courseQueryRequest 课程查询请求体
|
||||
|
@ -0,0 +1,218 @@
|
||||
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.OrderStatusConstant;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.courseOrder.CourseOrderAddRequest;
|
||||
import com.greenorange.promotion.model.dto.courseOrder.CourseOrderQueryRequest;
|
||||
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.courseOrder.CourseOrderCardVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.service.course.CourseService;
|
||||
import com.greenorange.promotion.utils.OrderNumberUtils;
|
||||
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 jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 课程订单 控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("courseOrder")
|
||||
@Slf4j
|
||||
@Tag(name = "课程订单模块")
|
||||
public class CourseOrderController {
|
||||
|
||||
@Resource
|
||||
private CourseService courseService;
|
||||
|
||||
@Resource
|
||||
private CourseOrderService courseOrderService;
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 小程序端用户生成课程订单
|
||||
* @param courseOrderAddRequest 课程id
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序端用户生成课程订单", description = "参数:课程id,权限:管理员,方法名:addCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户生成课程订单")
|
||||
public BaseResponse<Long> addCourseOrder(@Valid @RequestBody CourseOrderAddRequest courseOrderAddRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
Long courseId = courseOrderAddRequest.getCourseId();
|
||||
Course course = courseService.getById(courseId);
|
||||
ThrowUtils.throwIf(course == null, ErrorCode.OPERATION_ERROR, "该课程不存在");
|
||||
CourseOrder courseOrder = commonService.copyProperties(course, CourseOrder.class);
|
||||
courseOrder.setOrderNumber(OrderNumberUtils.generateOrderId());
|
||||
courseOrder.setTotalAmount(course.getDiscountPrice());
|
||||
courseOrder.setUserId(userId);
|
||||
courseOrderService.save(courseOrder);
|
||||
return ResultUtils.success(courseOrder.getId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户取消课程订单
|
||||
* @param courseOrderAddRequest 课程id
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("cancel")
|
||||
@Operation(summary = "小程序端用户取消课程订单", description = "参数:订单id,权限:管理员,方法名:cancelCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户取消课程订单")
|
||||
public BaseResponse<Long> cancelCourseOrder(@Valid @RequestBody CourseOrderAddRequest courseOrderAddRequest) {
|
||||
Long courseId = courseOrderAddRequest.getCourseId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(courseId);
|
||||
ThrowUtils.throwIf(courseOrder == null || !courseOrder.getOrderStatus().equals(OrderStatusConstant.PENDING),
|
||||
ErrorCode.OPERATION_ERROR, "该订单不存在或者订单状态错误");
|
||||
LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(CourseOrder::getId, courseId).set(CourseOrder::getOrderStatus, OrderStatusConstant.CLOSED);
|
||||
courseOrderService.update(updateWrapper);
|
||||
return ResultUtils.success(courseOrder.getId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询课程订单列表
|
||||
* @return 课程订单列表
|
||||
*/
|
||||
@PostMapping("query/list")
|
||||
@Operation(summary = "小程序端用户查询课程订单列表", description = "参数:无,权限:管理员,方法名:queryCourseOrderList")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户查询课程订单列表")
|
||||
public BaseResponse<List<CourseOrderCardVO>> queryCourseOrderList(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
List<CourseOrder> courseOrderList = commonService.findByFieldEqTargetField(CourseOrder::getUserId, userId, courseOrderService);
|
||||
List<CourseOrderCardVO> courseOrderCardVOS = commonService.convertList(courseOrderList, CourseOrderCardVO.class);
|
||||
Collections.reverse(courseOrderCardVOS);
|
||||
return ResultUtils.success(courseOrderCardVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据id查询订单详情
|
||||
* @return 课程订单列表
|
||||
*/
|
||||
@PostMapping("query/detail")
|
||||
@Operation(summary = "小程序端用户根据id查询订单详情", description = "参数:订单id,权限:管理员,方法名:queryCourseOrderDetailById")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户根据id查询订单详情")
|
||||
public BaseResponse<CourseOrderVO> queryCourseOrderDetailById(@RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
CourseOrderVO courseOrderVO = commonService.copyProperties(courseOrder, CourseOrderVO.class);
|
||||
return ResultUtils.success(courseOrderVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据id删除课程订单
|
||||
* @param commonRequest 课程订单删除请求体
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除课程订单", description = "参数:课程订单删除请求体,权限:管理员,方法名:delCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "web端管理员根据id删除课程订单")
|
||||
public BaseResponse<Boolean> delCourseOrder(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
ThrowUtils.throwIf(courseOrder == null || !courseOrder.getOrderStatus().equals(OrderStatusConstant.CLOSED),
|
||||
ErrorCode.OPERATION_ERROR, "该课程订单不存在或订单状态错误");
|
||||
courseOrderService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* web端管理员批量删除课程订单
|
||||
* @param commonBatchRequest 课程订单批量删除请求体
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@PostMapping("delBatch")
|
||||
@Operation(summary = "web端管理员批量删除课程订单", description = "参数:课程订单批量删除请求体,权限:管理员,方法名:delBatchCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "web端管理员批量删除课程订单")
|
||||
public BaseResponse<Boolean> delBatchCourseOrder(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
List<Long> ids = commonBatchRequest.getIds();
|
||||
LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(CourseOrder::getOrderStatus, OrderStatusConstant.CLOSED);
|
||||
long count = courseOrderService.count(queryWrapper);
|
||||
ThrowUtils.throwIf(count > 0, ErrorCode.OPERATION_ERROR, "存在未关闭的课程订单");
|
||||
courseOrderService.removeByIds(ids);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* web端管理员根据id查询课程订单
|
||||
* @param commonRequest 课程订单查询请求体
|
||||
* @return 课程订单信息
|
||||
*/
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询课程订单", description = "参数:课程订单查询请求体,权限:管理员,方法名:queryCourseOrderById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "web端管理员根据id查询课程订单")
|
||||
public BaseResponse<CourseOrderVO> queryCourseOrderById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
CourseOrderVO courseOrderVO = commonService.copyProperties(courseOrder, CourseOrderVO.class);
|
||||
return ResultUtils.success(courseOrderVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询课程订单
|
||||
* @param courseOrderQueryRequest 课程订单查询请求体
|
||||
* @return 课程订单列表
|
||||
*/
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询课程订单", description = "参数:课程订单查询请求体,权限:管理员,方法名:listCourseOrderByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "Web端管理员分页查询课程订单")
|
||||
public BaseResponse<Page<CourseOrderVO>> listCourseOrderByPage(@Valid @RequestBody CourseOrderQueryRequest courseOrderQueryRequest) {
|
||||
long current = courseOrderQueryRequest.getCurrent();
|
||||
long pageSize = courseOrderQueryRequest.getPageSize();
|
||||
QueryWrapper<CourseOrder> queryWrapper = courseOrderService.getQueryWrapper(courseOrderQueryRequest);
|
||||
Page<CourseOrder> page = courseOrderService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<CourseOrder> courseOrderList = page.getRecords();
|
||||
List<CourseOrderVO> courseOrderVOList = commonService.convertList(courseOrderList, CourseOrderVO.class);
|
||||
Page<CourseOrderVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(courseOrderVOList);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
}
|
@ -33,8 +33,11 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.GenericDeclaration;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
@ -138,6 +141,16 @@ public class ProjectCommissionController {
|
||||
return ResultUtils.success(projectCommissionVOList);
|
||||
}
|
||||
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
// String encode = passwordEncoder.encode("123456");
|
||||
// System.out.println(encode);
|
||||
// boolean matches = passwordEncoder.matches("123456", "$2a$10$/yBGQqsHK78vlEtuMGTVY.bU/TamHQbr4wQIzj1B1H1ud/ZKPGICC");
|
||||
// System.out.println(matches);
|
||||
// }
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 小程序用户修改项目的抽佣比例
|
||||
|
@ -0,0 +1,218 @@
|
||||
package com.greenorange.promotion.controller.userInfo;
|
||||
|
||||
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
import com.greenorange.promotion.model.dto.advancementApply.*;
|
||||
import com.greenorange.promotion.model.entity.AdvancementApply;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.enums.ReviewStatusEnum;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.model.vo.advancementApply.AdvancementApplyApproveVO;
|
||||
import com.greenorange.promotion.model.vo.advancementApply.AdvancementApplyVOPlus;
|
||||
import com.greenorange.promotion.model.vo.advancementApply.AdvancementApplyVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.userInfo.AdvancementApplyService;
|
||||
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.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
/**
|
||||
* 晋升申请 控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("advancementApply")
|
||||
@Slf4j
|
||||
@Tag(name = "晋升申请模块")
|
||||
public class AdvancementApplyController {
|
||||
|
||||
@Resource
|
||||
private AdvancementApplyService advancementApplyService;
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
/**
|
||||
* 小程序段用户添加晋升申请记录
|
||||
* @param advancementApplyAddRequest 晋升申请记录添加请求体
|
||||
* @return 申请记录查询凭据
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序段用户添加晋升申请记录", description = "参数:晋升申请添加请求体,权限:管理员,方法名:addAdvancementApply")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序段用户添加晋升申请记录")
|
||||
public BaseResponse<String> addAdvancementApply(@Valid @RequestBody AdvancementApplyAddRequest advancementApplyAddRequest) {
|
||||
String phone = advancementApplyAddRequest.getPhone();
|
||||
String verificationCode = advancementApplyAddRequest.getVerificationCode();
|
||||
// 校验用户手机号和验证码
|
||||
userInfoService.checkPhoneAndVerificationCode(phone, verificationCode, UserRoleEnum.STAFF);
|
||||
AdvancementApply advancementApply = commonService.copyProperties(advancementApplyAddRequest, AdvancementApply.class);
|
||||
advancementApply.setCredential(UUID.randomUUID().toString());
|
||||
advancementApplyService.save(advancementApply);
|
||||
return ResultUtils.success(advancementApply.getCredential());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户撤销晋升申请记录
|
||||
* @param commonRequest 晋升申请记录id
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@PostMapping("modify/status")
|
||||
@Operation(summary = "小程序端用户撤销晋升申请记录", description = "参数:晋升申请更新请求体,权限:管理员,方法名:revokeAdvancementApply")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序端用户撤销晋升申请记录")
|
||||
public BaseResponse<Boolean> revokeAdvancementApply(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
LambdaUpdateWrapper<AdvancementApply> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(AdvancementApply::getId, id).set(AdvancementApply::getReviewStatus, ReviewStatusEnum.WITHDRAWN.getValue());
|
||||
advancementApplyService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据id修改晋升申请记录信息
|
||||
* @param advancementApplyUpdateRequest 晋升申请更新请求体
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "小程序端用户根据id修改晋升申请记录信息", description = "参数:晋升申请更新请求体,权限:管理员,方法名:updateAdvancementApply")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序端用户根据id修改晋升申请记录信息")
|
||||
public BaseResponse<Boolean> updateAdvancementApply(@Valid @RequestBody AdvancementApplyUpdateRequest advancementApplyUpdateRequest) {
|
||||
String phone = advancementApplyUpdateRequest.getPhone();
|
||||
String verificationCode = advancementApplyUpdateRequest.getVerificationCode();
|
||||
// 校验用户手机号和验证码
|
||||
userInfoService.checkPhoneAndVerificationCode(phone, verificationCode, UserRoleEnum.STAFF);
|
||||
AdvancementApply advancementApply = commonService.copyProperties(advancementApplyUpdateRequest, AdvancementApply.class);
|
||||
advancementApplyService.updateById(advancementApply);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据凭证(credential)查询晋升申请记录
|
||||
* @param commonStringRequest 查询凭证
|
||||
* @return 晋升申请记录信息
|
||||
*/
|
||||
@PostMapping("query/credential")
|
||||
@Operation(summary = "小程序端用户根据凭证(credential)查询晋升申请记录", description = "参数:晋升申请更新请求体,权限:管理员,方法名:queryAdvancementApplyByCredential")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序端用户根据凭证(credential)查询晋升申请记录")
|
||||
public BaseResponse<AdvancementApplyApproveVO> queryAdvancementApplyByCredential(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String credential = commonStringRequest.getTemplateString();
|
||||
LambdaQueryWrapper<AdvancementApply> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(AdvancementApply::getCredential, credential);
|
||||
AdvancementApply advancementApply = advancementApplyService.getOne(lambdaQueryWrapper);
|
||||
AdvancementApplyApproveVO advancementApplyApproveVO = commonService.copyProperties(advancementApply, AdvancementApplyApproveVO.class);
|
||||
String reviewStatus = advancementApply.getReviewStatus();
|
||||
ReviewStatusEnum reviewStatusEnum = ReviewStatusEnum.getEnumByValue(reviewStatus);
|
||||
// 如果审核通过,填充账号密码
|
||||
if (ReviewStatusEnum.APPROVED.equals(reviewStatusEnum)) {
|
||||
Long userId = advancementApply.getUserId();
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
advancementApplyApproveVO.setUserAccount(userInfo.getUserAccount());
|
||||
advancementApplyApproveVO.setUserPassword(userInfo.getUserPassword());
|
||||
}
|
||||
// 如果审核拒绝,填充拒绝理由
|
||||
if (ReviewStatusEnum.REJECTED.equals(reviewStatusEnum)) {
|
||||
advancementApplyApproveVO.setRejectReason(advancementApply.getRejectReason());
|
||||
}
|
||||
return ResultUtils.success(advancementApplyApproveVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员批准用户的晋升申请
|
||||
* @param advancementApplyApproveRequest 晋升申请等信息
|
||||
* @return 晋升用户的账号密码
|
||||
*/
|
||||
@PostMapping("approve")
|
||||
@Operation(summary = "web端管理员批准用户的晋升申请", description = "参数:晋升申请id,权限:管理员,方法名:approveAdvancementApply")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "web端管理员批准用户的晋升申请")
|
||||
public BaseResponse<Boolean> approveAdvancementApply(@Valid @RequestBody AdvancementApplyApproveRequest advancementApplyApproveRequest) {
|
||||
userInfoService.staffUserInfoMiniRegister(advancementApplyApproveRequest);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员拒绝晋升申请
|
||||
* @param advancementApplyRejectRequest 晋升申请拒绝请求体
|
||||
* @return 晋升申请信息
|
||||
*/
|
||||
@PostMapping("reject")
|
||||
@Operation(summary = "web端管理员拒绝晋升申请", description = "参数:晋升申请拒绝请求体,权限:管理员,方法名:rejectAdvancementApply")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "web端管理员拒绝晋升申请")
|
||||
public BaseResponse<Boolean> rejectAdvancementApply(@Valid @RequestBody AdvancementApplyRejectRequest advancementApplyRejectRequest) {
|
||||
Long applyId = advancementApplyRejectRequest.getApplyId();
|
||||
String rejectReason = advancementApplyRejectRequest.getRejectReason();
|
||||
LambdaUpdateWrapper<AdvancementApply> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(AdvancementApply::getId, applyId)
|
||||
.set(AdvancementApply::getReviewStatus, ReviewStatusEnum.REJECTED.getValue())
|
||||
.set(AdvancementApply::getRejectReason, rejectReason);
|
||||
advancementApplyService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据id查询晋升申请
|
||||
* @param commonRequest 晋升申请id
|
||||
* @return 晋升申请信息
|
||||
*/
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询晋升申请", description = "参数:晋升申请id,权限:管理员,方法名:queryAdvancementApplyById")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "web端管理员根据id查询晋升申请")
|
||||
public BaseResponse<AdvancementApplyVOPlus> queryAdvancementApplyById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
AdvancementApply advancementApply = advancementApplyService.getById(id);
|
||||
AdvancementApplyVOPlus advancementApplyVOPlus = commonService.copyProperties(advancementApply, AdvancementApplyVOPlus.class);
|
||||
return ResultUtils.success(advancementApplyVOPlus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询晋升申请
|
||||
* @param advancementApplyQueryRequest 晋升申请查询请求体
|
||||
* @return 晋升申请列表
|
||||
*/
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询晋升申请", description = "参数:晋升申请查询请求体,权限:管理员,方法名:listAdvancementApplyByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "Web端管理员分页查询晋升申请")
|
||||
public BaseResponse<Page<AdvancementApplyVO>> listAdvancementApplyByPage(@Valid @RequestBody AdvancementApplyQueryRequest advancementApplyQueryRequest) {
|
||||
long current = advancementApplyQueryRequest.getCurrent();
|
||||
long pageSize = advancementApplyQueryRequest.getPageSize();
|
||||
QueryWrapper<AdvancementApply> queryWrapper = advancementApplyService.getQueryWrapper(advancementApplyQueryRequest);
|
||||
Page<AdvancementApply> page = advancementApplyService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<AdvancementApply> advancementApplyList = page.getRecords();
|
||||
List<AdvancementApplyVO> advancementApplyVOList = commonService.convertList(advancementApplyList, AdvancementApplyVO.class);
|
||||
Page<AdvancementApplyVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(advancementApplyVOList);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountAddRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.ProjectSettlement;
|
||||
import com.greenorange.promotion.model.entity.UserAccount;
|
||||
import com.greenorange.promotion.model.vo.userAccount.UserAccountVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
|
@ -1,19 +1,12 @@
|
||||
package com.greenorange.promotion.controller.wechat;
|
||||
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.freewayso.image.combiner.ImageCombiner;
|
||||
import com.freewayso.image.combiner.enums.OutputFormat;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.config.WxAccessToken;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||
import com.greenorange.promotion.utils.QRCodeUtil;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -21,21 +14,10 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@ -72,7 +54,7 @@ public class WechatGetQrcodeController {
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
// @Hidden
|
||||
@Hidden
|
||||
@PostMapping("/get/qrcode")
|
||||
@Operation(summary = "微信小程序获取二维码", description = "参数:无, 权限:所有人, 方法名:getQrcode")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@ -88,13 +70,12 @@ public class WechatGetQrcodeController {
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
// @Hidden
|
||||
@Hidden
|
||||
@PostMapping("/get/course/qrcode")
|
||||
@Operation(summary = "微信小程序获取课程码", description = "参数:无, 权限:所有人, 方法名:getCourseQrcode")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<String> getCourseQrcode(@Valid @RequestBody CommonStringRequest commonStringRequest) throws Exception {
|
||||
String inviteCode = commonStringRequest.getTemplateString();
|
||||
String view = wechatGetQrcodeService.getWxCourseQrCode(inviteCode);
|
||||
public BaseResponse<String> getCourseQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||
String view = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
||||
return ResultUtils.success(view);
|
||||
}
|
||||
|
||||
|
@ -61,17 +61,13 @@ public class GlobalExceptionHandler {
|
||||
// .append("; "));
|
||||
// return ResultUtils.error(ErrorCode.PARAMS_ERROR, errors.toString());
|
||||
|
||||
// 从所有 FieldError 里,排序后取第一个
|
||||
FieldError firstError = e.getBindingResult()
|
||||
.getFieldErrors().stream().min(Comparator.comparing(FieldError::getField))
|
||||
.orElse(null);
|
||||
|
||||
// 直接取它的 defaultMessage,即注解里配置的 message
|
||||
String msg = (firstError != null)
|
||||
? firstError.getDefaultMessage()
|
||||
: "参数校验失败";
|
||||
|
||||
// 返回时只带 msg,不再拼前缀或字段名
|
||||
// 按字段名排序,取第一个错误的 defaultMessage
|
||||
String msg = e.getBindingResult()
|
||||
.getFieldErrors().stream()
|
||||
.sorted(Comparator.comparing(FieldError::getField))
|
||||
.map(FieldError::getDefaultMessage)
|
||||
.findFirst()
|
||||
.orElse("参数校验失败");
|
||||
return ResultUtils.error(ErrorCode.PARAMS_ERROR, msg);
|
||||
}
|
||||
|
||||
|
@ -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 = "CourseChapter";
|
||||
private static final String ENTITY_NAME = "AdvancementApply";
|
||||
// 表名
|
||||
private static final String TABLE_NAME = "course_chapter";
|
||||
private static final String TABLE_NAME = "advancement_apply";
|
||||
// 实体类属性名
|
||||
private static final String ENTITY_NAME_LOWER = "courseChapter";
|
||||
private static final String ENTITY_NAME_LOWER = "advancementApply";
|
||||
|
||||
// 父包名
|
||||
private static final String PARENT_PATH = "com.greenorange.promotion";
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.greenorange.promotion.mapper;
|
||||
|
||||
import com.greenorange.promotion.model.entity.AdvancementApply;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【advancement_apply(晋升申请表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-29 12:39:54
|
||||
* @Entity com.greenorange.promotion.model.entity.AdvancementApply
|
||||
*/
|
||||
public interface AdvancementApplyMapper extends BaseMapper<AdvancementApply> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.greenorange.promotion.mapper;
|
||||
|
||||
import com.greenorange.promotion.model.entity.CourseQrcodeApply;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【course_qrcode_apply(课程推广码申请表)】的数据库操作Mapper
|
||||
* @createDate 2025-06-24 22:10:39
|
||||
* @Entity com.greenorange.promotion.model.entity.CourseQrcodeApply
|
||||
*/
|
||||
public interface CourseQrcodeApplyMapper extends BaseMapper<CourseQrcodeApply> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
package com.greenorange.promotion.model.dto.advancementApply;
|
||||
|
||||
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 = {
|
||||
"name",
|
||||
"verificationCode"
|
||||
})
|
||||
public class AdvancementApplyAddRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
@NotBlank(message = "申请人姓名不能为空")
|
||||
@Schema(description = "申请人姓名", example = "张三")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 申请人手机号
|
||||
*/
|
||||
@NotBlank(message = "申请人手机号不能为空")
|
||||
@Schema(description = "申请人手机号", example = "15888610253")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
@Schema(description = "验证码", example = "666999")
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 简历(view值)
|
||||
*/
|
||||
@NotBlank(message = "简历(view值)不能为空")
|
||||
@Schema(description = "简历(view值)", example = "D89SKF3N")
|
||||
private String resume;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
package com.greenorange.promotion.model.dto.advancementApply;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 晋升申请批准请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "晋升申请批准请求体", requiredProperties = {
|
||||
"applyId",
|
||||
"invitationCode",
|
||||
"userRole"
|
||||
})
|
||||
public class AdvancementApplyApproveRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 晋升申请id
|
||||
*/
|
||||
@Min(value = 1, message = "晋升申请id不能小于1")
|
||||
@Schema(description = "晋升申请id", example = "1")
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 邀请码
|
||||
*/
|
||||
@NotBlank(message = "邀请码不能为空")
|
||||
@Schema(description = "邀请码", example = "666999")
|
||||
private String invitationCode;
|
||||
|
||||
/**
|
||||
* 用户角色
|
||||
*/
|
||||
@NotBlank(message = "用户角色不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "用户角色", example = "user")
|
||||
private String userRole;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.greenorange.promotion.model.dto.advancementApply;
|
||||
|
||||
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 AdvancementApplyQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
@Schema(description = "申请人姓名", example = "张三")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 申请人手机号
|
||||
*/
|
||||
@Schema(description = "申请人手机号", example = "15888610253")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@Schema(description = "审核状态", example = "待审核")
|
||||
private String reviewStatus;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.greenorange.promotion.model.dto.advancementApply;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 晋升申请拒绝请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "晋升申请拒绝请求体", requiredProperties = {
|
||||
"applyId",
|
||||
"rejectReason"
|
||||
})
|
||||
public class AdvancementApplyRejectRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 晋升申请id
|
||||
*/
|
||||
@Min(value = 1, message = "晋升申请id不能小于1")
|
||||
@Schema(description = "晋升申请id", example = "1")
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 拒绝理由
|
||||
*/
|
||||
@NotBlank(message = "拒绝理由不能为空")
|
||||
@Schema(description = "拒绝理由", example = "拒绝理由")
|
||||
private String rejectReason;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.greenorange.promotion.model.dto.advancementApply;
|
||||
|
||||
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",
|
||||
"name",
|
||||
"phone",
|
||||
"verificationCode",
|
||||
"resume",
|
||||
"reviewStatus",
|
||||
})
|
||||
public class AdvancementApplyUpdateRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 晋升申请id
|
||||
*/
|
||||
@Min(value = 1L, message = "晋升申请id ID不能小于1")
|
||||
@Schema(description = "晋升申请id", example = "张三")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
@NotBlank(message = "申请人姓名不能为空")
|
||||
@Schema(description = "申请人姓名", example = "")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 申请人手机号
|
||||
*/
|
||||
@NotBlank(message = "申请人手机号不能为空")
|
||||
@Schema(description = "申请人手机号", example = "15888610253")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
@Schema(description = "验证码", example = "666999")
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 简历(view值)
|
||||
*/
|
||||
@NotBlank(message = "简历(view值)不能为空")
|
||||
@Schema(description = "简历(view值)", example = "3DFK2K3J")
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@NotBlank(message = "审核状态不能为空")
|
||||
@Schema(description = "审核状态", example = "待审核")
|
||||
private String reviewStatus;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -5,6 +5,8 @@ import com.greenorange.promotion.model.enums.CourseTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jdk.jfr.BooleanFlag;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@ -22,19 +24,24 @@ public class CourseQueryRequest extends PageRequest implements Serializable {
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@NotBlank(message = "课程名称不能为空")
|
||||
@Schema(description = "课程名称", example = "数据分析工程师训练营")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
|
||||
/**
|
||||
* 是否上架(true:上架,false:下架)
|
||||
*/
|
||||
@Schema(description = "是否上架(true:上架,false:下架)", example = "true")
|
||||
private Boolean isShelves;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -39,11 +39,11 @@ public class CourseChapterAddRequest implements Serializable {
|
||||
private Long duration;
|
||||
|
||||
/**
|
||||
* 试看权限
|
||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
||||
*/
|
||||
@NotBlank(message = "试看权限不能为空")
|
||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
||||
@Schema(description = "试看权限", example = "全集试看")
|
||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
||||
private String permissions;
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,7 @@ import com.greenorange.promotion.model.enums.PreviewPermissionEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@ -22,18 +23,24 @@ public class CourseChapterQueryRequest extends PageRequest implements Serializab
|
||||
/**
|
||||
* 章节名称
|
||||
*/
|
||||
@NotBlank(message = "章节名称不能为空")
|
||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 试看权限
|
||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
||||
*/
|
||||
@NotBlank(message = "试看权限不能为空")
|
||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
||||
@Schema(description = "试看权限", example = "全集试看")
|
||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
||||
private String permissions;
|
||||
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
@NotNull(message = "课程id不能为null")
|
||||
@Min(value = 1, message = "课程id不能小于1")
|
||||
@Schema(description = "课程id", example = "1")
|
||||
private Long courseId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -47,11 +47,11 @@ public class CourseChapterUpdateRequest implements Serializable {
|
||||
private Long duration;
|
||||
|
||||
/**
|
||||
* 试看权限
|
||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
||||
*/
|
||||
@NotBlank(message = "试看权限不能为空")
|
||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
||||
@Schema(description = "试看权限", example = "全集试看")
|
||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
||||
private String permissions;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,92 @@
|
||||
package com.greenorange.promotion.model.dto.courseOrder;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 课程订单添加请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "课程订单添加请求体", requiredProperties = {
|
||||
"courseId"
|
||||
})
|
||||
public class CourseOrderAddRequest implements Serializable {
|
||||
|
||||
// /**
|
||||
// * 订单号
|
||||
// */
|
||||
// @NotBlank(message = "订单号不能为空")
|
||||
// @Schema(description = "订单号", example = "202506241339232334d234234243")
|
||||
// private String orderNumber;
|
||||
|
||||
/**
|
||||
* 课程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;
|
||||
//
|
||||
// /**
|
||||
// * 课程封面图片URL
|
||||
// */
|
||||
// @NotBlank(message = "课程封面图片URL不能为空")
|
||||
// @Schema(description = "课程封面图片URL", example = "38EFJID33")
|
||||
// private String image;
|
||||
//
|
||||
// /**
|
||||
// * 课程原价
|
||||
// */
|
||||
// @Schema(description = "课程原价", example = "20.00")
|
||||
// private BigDecimal originPrice;
|
||||
//
|
||||
// /**
|
||||
// * 折扣价格
|
||||
// */
|
||||
// @Schema(description = "折扣价格", example = "80.00")
|
||||
// private BigDecimal discountPrice;
|
||||
//
|
||||
// /**
|
||||
// * 订单总金额
|
||||
// */
|
||||
// @Schema(description = "订单总金额", example = "80.00")
|
||||
// private BigDecimal totalAmount;
|
||||
//
|
||||
// /**
|
||||
// * 支付交易号
|
||||
// */
|
||||
// @NotBlank(message = "支付交易号不能为空")
|
||||
// @Schema(description = "支付交易号", example = "432332333324444444444444423")
|
||||
// private String transactionNumber;
|
||||
//
|
||||
// /**
|
||||
// * 订单状态
|
||||
// */
|
||||
// @NotBlank(message = "订单状态不能为空")
|
||||
//// @EnumValue(enumClass = CourseOrderStatusEnum.class)
|
||||
// @Schema(description = "订单状态", example = "order")
|
||||
// private String orderStatus;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package com.greenorange.promotion.model.dto.courseOrder;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.OrderStatusEnum;
|
||||
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;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 课程订单查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "课程订单查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class CourseOrderQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202506241339232334d234234243")
|
||||
private String orderNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
@EnumValue(enumClass = OrderStatusEnum.class)
|
||||
@Schema(description = "订单状态[交易关闭,交易成功,待支付,已退款]", example = "交易成功")
|
||||
private String orderStatus;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package com.greenorange.promotion.model.dto.courseOrder;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.OrderStatusEnum;
|
||||
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",
|
||||
"orderStatus"
|
||||
})
|
||||
public class CourseOrderUpdateRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@Min(value = 1L, message = "订单ID ID不能小于1")
|
||||
@Schema(description = "订单ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
@NotBlank(message = "订单状态不能为空")
|
||||
@EnumValue(enumClass = OrderStatusEnum.class)
|
||||
@Schema(description = "订单状态[交易关闭,交易成功,待支付,已退款]", example = "交易成功")
|
||||
private String orderStatus;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -59,6 +59,7 @@ public class ProjectAddRequest implements Serializable {
|
||||
/**
|
||||
* 项目状态[项目运行(running)|人数已满(full)|项目暂停(paused)]
|
||||
*/
|
||||
@NotBlank(message = "项目状态不能为空")
|
||||
@EnumValue(enumClass = ProjectStatusEnum.class)
|
||||
@Schema(description = "项目状态[项目运行(running)|人数已满(full)|项目暂停(paused)]", example = "running")
|
||||
private String projectStatus;
|
||||
|
@ -4,7 +4,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -42,6 +45,7 @@ public class UserInfoRegisterRequest implements Serializable {
|
||||
* 邀请码
|
||||
*/
|
||||
@Schema(description = "邀请码", example = "666999")
|
||||
@NotBlank(message = "邀请码不能为空")
|
||||
private String invitationCode;
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,10 @@ package com.greenorange.promotion.model.dto.userInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
@ -0,0 +1,76 @@
|
||||
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.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 晋升申请表
|
||||
* @TableName advancement_apply
|
||||
*/
|
||||
@TableName(value ="advancement_apply")
|
||||
@Data
|
||||
public class AdvancementApply implements Serializable {
|
||||
/**
|
||||
* 晋升申请id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 申请人手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 简历
|
||||
*/
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 查询凭证
|
||||
*/
|
||||
private String credential;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private String reviewStatus;
|
||||
|
||||
/**
|
||||
* 拒绝理由
|
||||
*/
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 用户id(申请成功后获得)
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -72,6 +72,11 @@ public class Course implements Serializable {
|
||||
*/
|
||||
private BigDecimal secondLevelRate;
|
||||
|
||||
/**
|
||||
* 是否上架(true:上架,false:下架)
|
||||
*/
|
||||
private Boolean isShelves;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
|
@ -4,6 +4,8 @@ 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.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
@ -29,12 +31,12 @@ public class CourseChapter implements Serializable {
|
||||
/**
|
||||
* 章节时长(格式可自定义,如"00:10:00")
|
||||
*/
|
||||
private String duration;
|
||||
private Long duration;
|
||||
|
||||
/**
|
||||
* 试看权限
|
||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
||||
*/
|
||||
private Object permissions;
|
||||
private String permissions;
|
||||
|
||||
/**
|
||||
* 视频文件 view 值
|
||||
@ -61,6 +63,7 @@ public class CourseChapter implements Serializable {
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@Serial
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -4,6 +4,8 @@ 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.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -53,7 +55,7 @@ public class CourseOrder implements Serializable {
|
||||
private BigDecimal originPrice;
|
||||
|
||||
/**
|
||||
* 实际成交价格
|
||||
* 折扣价格
|
||||
*/
|
||||
private BigDecimal discountPrice;
|
||||
|
||||
@ -68,9 +70,14 @@ public class CourseOrder implements Serializable {
|
||||
private String transactionNumber;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
private Object orderStatus;
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
@ -87,6 +94,7 @@ public class CourseOrder implements Serializable {
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@Serial
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
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.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 课程推广码申请表
|
||||
* @TableName course_qrcode_apply
|
||||
*/
|
||||
@TableName(value ="course_qrcode_apply")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CourseQrcodeApply implements Serializable {
|
||||
/**
|
||||
* 课程推广码申请id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程推广码(view值)
|
||||
*/
|
||||
private String courseQrcode;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -18,6 +18,9 @@ import lombok.NoArgsConstructor;
|
||||
*/
|
||||
@TableName(value ="user_info")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class UserInfo implements Serializable {
|
||||
/**
|
||||
* 用户ID
|
||||
|
@ -0,0 +1,59 @@
|
||||
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 OrderStatusEnum implements BaseEnum {
|
||||
|
||||
CLOSED("交易关闭"),
|
||||
SUCCESS("交易成功"),
|
||||
PENDING("待支付"),
|
||||
REFUNDED("已退款");
|
||||
|
||||
private final String value;
|
||||
|
||||
OrderStatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* BaseEnum 要求的方法:返回枚举对应的校验值
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有枚举值列表
|
||||
*/
|
||||
public static List<String> getValues() {
|
||||
return Arrays.stream(values())
|
||||
.map(OrderStatusEnum::getValue)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据值获取对应的枚举对象
|
||||
*/
|
||||
public static OrderStatusEnum getEnumByValue(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
for (OrderStatusEnum status : OrderStatusEnum.values()) {
|
||||
if (status.value.equals(value)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
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 ReviewStatusEnum implements BaseEnum {
|
||||
|
||||
PENDING("待审核"),
|
||||
APPROVED("已通过"),
|
||||
REJECTED("已拒绝"),
|
||||
WITHDRAWN("已撤回");
|
||||
|
||||
private final String value;
|
||||
|
||||
ReviewStatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* BaseEnum 要求的方法:返回枚举对应的校验值
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有枚举值列表
|
||||
*/
|
||||
public static List<String> getValues() {
|
||||
return Arrays.stream(values())
|
||||
.map(ReviewStatusEnum::getValue)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据值获取对应的枚举对象
|
||||
*/
|
||||
public static ReviewStatusEnum getEnumByValue(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
for (ReviewStatusEnum status : ReviewStatusEnum.values()) {
|
||||
if (status.value.equals(value)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -18,7 +18,10 @@ public enum UserRoleEnum implements BaseEnum {
|
||||
USER("用户", "user"),
|
||||
ADMIN("管理员", "admin"),
|
||||
BOSS("Boss", "boss"),
|
||||
BAN("被封号", "ban");
|
||||
BAN("被封号", "ban"),
|
||||
MANAGER("经理", "manager"),
|
||||
SUPERVISOR("主管", "supervisor"),
|
||||
STAFF("员工", "staff");
|
||||
|
||||
|
||||
private final String text;
|
||||
|
@ -0,0 +1,57 @@
|
||||
package com.greenorange.promotion.model.vo.advancementApply;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 晋升申请审核结果 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "晋升申请审核结果 视图对象")
|
||||
public class AdvancementApplyApproveVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
@Schema(description = "申请人姓名", example = "张三")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 申请人手机号
|
||||
*/
|
||||
@Schema(description = "申请人手机号", example = "15888610253")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@Schema(description = "审核状态", example = "待审核")
|
||||
private String reviewStatus;
|
||||
|
||||
/**
|
||||
* 拒绝理由
|
||||
*/
|
||||
@Schema(description = "拒绝理由", example = "无")
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@Schema(description = "账号", example = "qingcheng")
|
||||
private String userAccount;
|
||||
|
||||
|
||||
/**
|
||||
* 密码(建议加密存储)
|
||||
*/
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.greenorange.promotion.model.vo.advancementApply;
|
||||
|
||||
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;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 晋升申请 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "晋升申请 视图对象")
|
||||
public class AdvancementApplyVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 晋升申请ID
|
||||
*/
|
||||
@Schema(description = "晋升申请ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
@Schema(description = "申请人姓名", example = "张三")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 申请人手机号
|
||||
*/
|
||||
@Schema(description = "申请人手机号", example = "15888610253")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 简历(view值)
|
||||
*/
|
||||
@Schema(description = "简历(view值)", example = "32DK8DKL8")
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 查询凭证
|
||||
*/
|
||||
@Schema(description = "查询凭证", example = "cef281c7-578f-4cc9-aca9-f1b5f6bcacb1")
|
||||
private String credential;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@Schema(description = "审核状态", example = "待审核")
|
||||
private String reviewStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2023-03-01 00:00:00")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.greenorange.promotion.model.vo.advancementApply;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 晋升申请记录(id查询) 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "晋升申请记录(id查询) 视图对象")
|
||||
public class AdvancementApplyVOPlus implements Serializable {
|
||||
|
||||
/**
|
||||
* 晋升申请ID
|
||||
*/
|
||||
@Schema(description = "晋升申请ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
@Schema(description = "申请人姓名", example = "张三")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 申请人手机号
|
||||
*/
|
||||
@Schema(description = "申请人手机号", example = "15888610253")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 简历(view值)
|
||||
*/
|
||||
@Schema(description = "简历(view值)", example = "32DK8DKL8")
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 查询凭证
|
||||
*/
|
||||
@Schema(description = "查询凭证", example = "cef281c7-578f-4cc9-aca9-f1b5f6bcacb1")
|
||||
private String credential;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@Schema(description = "审核状态", example = "待审核")
|
||||
private String reviewStatus;
|
||||
|
||||
/**
|
||||
* 拒绝理由
|
||||
*/
|
||||
@Schema(description = "拒绝理由", example = "无")
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2023-03-01 00:00:00")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.greenorange.promotion.model.vo.course;
|
||||
|
||||
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 CourseCardVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
@Schema(description = "课程ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Schema(description = "课程名称", example = "数据分析工程师训练营")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
*/
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片URL
|
||||
*/
|
||||
@Schema(description = "课程图片URL", example = "324IEHJDE")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 课程原价
|
||||
*/
|
||||
@Schema(description = "课程原价", example = "3499")
|
||||
private BigDecimal originPrice;
|
||||
|
||||
/**
|
||||
* 折扣价格
|
||||
*/
|
||||
@Schema(description = "折扣价格", example = "2499")
|
||||
private BigDecimal discountPrice;
|
||||
|
||||
/**
|
||||
* 已下单人数
|
||||
*/
|
||||
@Schema(description = "已下单人数", example = "100")
|
||||
private Integer orderCount;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.greenorange.promotion.model.vo.course;
|
||||
|
||||
import com.greenorange.promotion.model.vo.courseChapter.CourseChapterVO;
|
||||
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.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Schema(description = "课程详情 视图对象")
|
||||
public class CourseDetailVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
@Schema(description = "课程ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Schema(description = "课程名称", example = "数据分析工程师训练营")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
*/
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程概述(富文本)
|
||||
*/
|
||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||
private String detail;
|
||||
|
||||
/**
|
||||
* 推广码说明(富文本)
|
||||
*/
|
||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
||||
private String promoCodeDesc;
|
||||
|
||||
/**
|
||||
* 课程图片URL
|
||||
*/
|
||||
@Schema(description = "课程图片URL", example = "324IEHJDE")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 课程原价
|
||||
*/
|
||||
@Schema(description = "课程原价", example = "3499")
|
||||
private BigDecimal originPrice;
|
||||
|
||||
/**
|
||||
* 折扣价格
|
||||
*/
|
||||
@Schema(description = "折扣价格", example = "2499")
|
||||
private BigDecimal discountPrice;
|
||||
|
||||
/**
|
||||
* 课程章节
|
||||
*/
|
||||
@Schema(description = "课程章节")
|
||||
private List<CourseChapterVO> courseChapters;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -80,6 +80,12 @@ public class CourseVO implements Serializable {
|
||||
@Schema(description = "二级佣金比例(%)", example = "5")
|
||||
private BigDecimal secondLevelRate;
|
||||
|
||||
/**
|
||||
* 是否上架(true:上架,false:下架)
|
||||
*/
|
||||
@Schema(description = "是否上架(true:上架,false:下架)", example = "true")
|
||||
private Boolean isShelves;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -35,9 +35,9 @@ public class CourseChapterVO implements Serializable {
|
||||
private Long duration;
|
||||
|
||||
/**
|
||||
* 试看权限
|
||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
||||
*/
|
||||
@Schema(description = "试看权限", example = "全集试看")
|
||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
||||
private String permissions;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,60 @@
|
||||
package com.greenorange.promotion.model.vo.courseOrder;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 课程订单卡片 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "课程订单卡片 视图对象")
|
||||
public class CourseOrderCardVO implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 课程订单ID
|
||||
*/
|
||||
@Schema(description = "课程订单ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202506241339232334d234234243")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Schema(description = "课程名称", example = "数据分析工程师训练营")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@Schema(description = "课程类别", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "100.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
@Schema(description = "订单状态[交易关闭,交易成功,待支付,已退款]", example = "交易成功")
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.greenorange.promotion.model.vo.courseOrder;
|
||||
|
||||
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 CourseOrderVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程订单ID
|
||||
*/
|
||||
@Schema(description = "课程订单ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202506241339232334d234234243")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
@Schema(description = "课程ID", example = "1")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Schema(description = "课程名称", example = "数据分析工程师训练营")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@Schema(description = "课程类别", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程封面图片URL
|
||||
*/
|
||||
@Schema(description = "课程封面图片URL", example = "32DHDF3KI")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 课程原价
|
||||
*/
|
||||
@Schema(description = "课程原价", example = "100.00")
|
||||
private BigDecimal originPrice;
|
||||
|
||||
/**
|
||||
* 折扣价格
|
||||
*/
|
||||
@Schema(description = "折扣价格", example = "50.00")
|
||||
private BigDecimal discountPrice;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "100.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 支付交易号
|
||||
*/
|
||||
@Schema(description = "支付交易号", example = "4342348232388888833333333333")
|
||||
private String transactionNumber;
|
||||
|
||||
/**
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
@Schema(description = "订单状态[交易关闭,交易成功,待支付,已退款]", example = "交易成功")
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", example = "2025-06-24 13:39:23")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.greenorange.promotion.service.course;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.model.dto.courseOrder.CourseOrderQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -10,4 +12,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface CourseOrderService extends IService<CourseOrder> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
QueryWrapper<CourseOrder> getQueryWrapper(CourseOrderQueryRequest courseOrderQueryRequest);
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.greenorange.promotion.service.course;
|
||||
|
||||
import com.greenorange.promotion.model.entity.CourseQrcodeApply;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【course_qrcode_apply(课程推广码申请表)】的数据库操作Service
|
||||
* @createDate 2025-06-24 22:10:39
|
||||
*/
|
||||
public interface CourseQrcodeApplyService extends IService<CourseQrcodeApply> {
|
||||
|
||||
}
|
@ -25,11 +25,13 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<CourseChapter> getQueryWrapper(CourseChapterQueryRequest courseChapterQueryRequest) {
|
||||
Long courseId = courseChapterQueryRequest.getCourseId();
|
||||
String name = courseChapterQueryRequest.getName();
|
||||
String permissions = courseChapterQueryRequest.getPermissions();
|
||||
String sortField = courseChapterQueryRequest.getSortField();
|
||||
String sortOrder = courseChapterQueryRequest.getSortOrder();
|
||||
QueryWrapper<CourseChapter> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("courseId", courseId);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(name), "name", name);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(permissions), "permissions", permissions);
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
|
||||
|
@ -1,9 +1,14 @@
|
||||
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.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.SqlUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -15,6 +20,22 @@ import org.springframework.stereotype.Service;
|
||||
public class CourseOrderServiceImpl extends ServiceImpl<CourseOrderMapper, CourseOrder>
|
||||
implements CourseOrderService{
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<CourseOrder> getQueryWrapper(CourseOrderQueryRequest courseOrderQueryRequest) {
|
||||
String orderNumber = courseOrderQueryRequest.getOrderNumber();
|
||||
String orderStatus = courseOrderQueryRequest.getOrderStatus();
|
||||
String sortField = courseOrderQueryRequest.getSortField();
|
||||
String sortOrder = courseOrderQueryRequest.getSortOrder();
|
||||
QueryWrapper<CourseOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(orderNumber), "orderNumber", orderNumber);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(orderStatus), "orderStatus", orderStatus);
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
|
||||
return queryWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.greenorange.promotion.service.course.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.greenorange.promotion.model.entity.CourseQrcodeApply;
|
||||
import com.greenorange.promotion.service.course.CourseQrcodeApplyService;
|
||||
import com.greenorange.promotion.mapper.CourseQrcodeApplyMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【course_qrcode_apply(课程推广码申请表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-24 22:10:39
|
||||
*/
|
||||
@Service
|
||||
public class CourseQrcodeApplyServiceImpl extends ServiceImpl<CourseQrcodeApplyMapper, CourseQrcodeApply>
|
||||
implements CourseQrcodeApplyService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@ import com.greenorange.promotion.model.entity.Course;
|
||||
import com.greenorange.promotion.service.course.CourseService;
|
||||
import com.greenorange.promotion.mapper.CourseMapper;
|
||||
import com.greenorange.promotion.utils.SqlUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -28,11 +29,13 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course>
|
||||
public QueryWrapper<Course> getQueryWrapper(CourseQueryRequest courseQueryRequest) {
|
||||
String name = courseQueryRequest.getName();
|
||||
String type = courseQueryRequest.getType();
|
||||
Boolean isShelves = courseQueryRequest.getIsShelves();
|
||||
String sortField = courseQueryRequest.getSortField();
|
||||
String sortOrder = courseQueryRequest.getSortOrder();
|
||||
QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(name), "name", name);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(type), "type", type);
|
||||
queryWrapper.eq(ObjectUtils.isNotEmpty(isShelves), "isShelves", isShelves);
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class ProjectCommissionServiceImpl extends ServiceImpl<ProjectCommissionM
|
||||
public void updateProjectCommissionRate(ProjectCommissionUpdateRequest projectCommissionUpdateRequest) {
|
||||
Long id = projectCommissionUpdateRequest.getId();
|
||||
BigDecimal currentCommissionRate = projectCommissionUpdateRequest.getCurrentCommissionRate();
|
||||
// 获取当前项目明细信息
|
||||
// 获取当前项目明细抽佣信息
|
||||
ProjectCommission projectCommission = this.getById(id);
|
||||
ThrowUtils.throwIf(projectCommission == null, ErrorCode.OPERATION_ERROR, "项目明细抽佣信息不存在");
|
||||
Long projectDetailId = projectCommission.getProjectDetailId();
|
||||
@ -356,7 +356,7 @@ public class ProjectCommissionServiceImpl extends ServiceImpl<ProjectCommissionM
|
||||
|
||||
startTime = System.currentTimeMillis();
|
||||
|
||||
// 更新用户项目明细抽佣记录
|
||||
// 批量更新用户项目明细抽佣记录
|
||||
List<SubUserProjectCommission> proCommissions = subProjectCommissions.stream().filter(subProjectCommission -> subProjectCommission.getSubUserId() == -1L).toList();
|
||||
List<ProjectCommission> proCommissionList = commonService.convertList(proCommissions, ProjectCommission.class);
|
||||
// this.updateBatchById(proCommissionList);
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.greenorange.promotion.service.userInfo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.model.dto.advancementApply.AdvancementApplyQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.AdvancementApply;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【advancement_apply(晋升申请表)】的数据库操作Service
|
||||
* @createDate 2025-06-29 12:39:54
|
||||
*/
|
||||
public interface AdvancementApplyService extends IService<AdvancementApply> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
QueryWrapper<AdvancementApply> getQueryWrapper(AdvancementApplyQueryRequest advancementApplyQueryRequest);
|
||||
}
|
@ -1,10 +1,13 @@
|
||||
package com.greenorange.promotion.service.userInfo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.model.dto.userInfo.*;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import com.greenorange.promotion.model.dto.advancementApply.AdvancementApplyApproveRequest;
|
||||
import com.greenorange.promotion.model.dto.userInfo.*;
|
||||
import com.greenorange.promotion.model.entity.AdvancementApply;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -68,4 +71,22 @@ public interface UserInfoService extends IService<UserInfo> {
|
||||
* 查询从 userId 一路到根节点的所有 id,按 depth 倒序(根先出)
|
||||
*/
|
||||
List<Long> findPathToRoot(Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户手机号和验证码
|
||||
*/
|
||||
void checkPhoneAndVerificationCode(String phoneNumber, String verificationCode, UserRoleEnum userRoleEnum);
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户权限来获取条件构造器
|
||||
*/
|
||||
LambdaQueryWrapper<UserInfo> getQueryWrapperByUserRole(UserRoleEnum userRoleEnum, LambdaQueryWrapper<UserInfo> lambdaQueryWrapper);
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端员工信息注册
|
||||
*/
|
||||
void staffUserInfoMiniRegister(AdvancementApplyApproveRequest advancementApplyApproveRequest);
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.greenorange.promotion.service.userInfo.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.advancementApply.AdvancementApplyQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.AdvancementApply;
|
||||
import com.greenorange.promotion.service.userInfo.AdvancementApplyService;
|
||||
import com.greenorange.promotion.mapper.AdvancementApplyMapper;
|
||||
import com.greenorange.promotion.utils.SqlUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【advancement_apply(晋升申请表)】的数据库操作Service实现
|
||||
* @createDate 2025-06-29 12:39:54
|
||||
*/
|
||||
@Service
|
||||
public class AdvancementApplyServiceImpl extends ServiceImpl<AdvancementApplyMapper, AdvancementApply>
|
||||
implements AdvancementApplyService{
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<AdvancementApply> getQueryWrapper(AdvancementApplyQueryRequest advancementApplyQueryRequest) {
|
||||
String name = advancementApplyQueryRequest.getName();
|
||||
String phone = advancementApplyQueryRequest.getPhone();
|
||||
String reviewStatus = advancementApplyQueryRequest.getReviewStatus();
|
||||
String sortField = advancementApplyQueryRequest.getSortField();
|
||||
String sortOrder = advancementApplyQueryRequest.getSortOrder();
|
||||
QueryWrapper<AdvancementApply> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(name), "name", name);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(phone), "phone", phone);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(reviewStatus), "reviewStatus", reviewStatus);
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_DESC), sortField);
|
||||
return queryWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -10,16 +10,20 @@ import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.constant.CommonConstant;
|
||||
import com.greenorange.promotion.constant.SystemConstant;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.mapper.UserInfoMapper;
|
||||
import com.greenorange.promotion.model.dto.advancementApply.AdvancementApplyApproveRequest;
|
||||
import com.greenorange.promotion.model.dto.projectCommission.ProjectCommissionAddRequest;
|
||||
import com.greenorange.promotion.model.dto.userInfo.*;
|
||||
import com.greenorange.promotion.model.entity.*;
|
||||
import com.greenorange.promotion.model.enums.ReviewStatusEnum;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.project.ProjectCommissionService;
|
||||
import com.greenorange.promotion.service.project.ProjectDetailService;
|
||||
import com.greenorange.promotion.service.project.SubUserProjectCommissionService;
|
||||
import com.greenorange.promotion.service.userInfo.AdvancementApplyService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||
@ -28,7 +32,6 @@ import com.greenorange.promotion.utils.RegexUtils;
|
||||
import com.greenorange.promotion.utils.SendSmsUtil;
|
||||
import com.greenorange.promotion.utils.SqlUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -36,13 +39,11 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
@ -89,6 +90,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
private ProjectDetailService projectDetailService;
|
||||
|
||||
|
||||
@Resource
|
||||
private AdvancementApplyService advancementApplyService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -131,6 +136,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序用户注册
|
||||
*/
|
||||
@ -138,87 +147,31 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void userInfoMiniRegister(UserInfoRegisterRequest userInfoRegisterRequest) {
|
||||
String phoneNumber = userInfoRegisterRequest.getPhoneNumber();
|
||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
||||
LambdaQueryWrapper<UserInfo> phoneNumberLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
phoneNumberLambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber);
|
||||
UserInfo userInfo = this.getOne(phoneNumberLambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(userInfo != null, ErrorCode.OPERATION_ERROR, "手机号已注册");
|
||||
|
||||
String verificationCode = userInfoRegisterRequest.getVerificationCode();
|
||||
String code = redisTemplate.opsForValue().get(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
ThrowUtils.throwIf(code == null, ErrorCode.OPERATION_ERROR, "验证码已失效");
|
||||
|
||||
// // 移除验证码
|
||||
// redisTemplate.delete(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
// 校验用户手机号和验证码
|
||||
checkPhoneAndVerificationCode(phoneNumber, verificationCode, UserRoleEnum.USER);
|
||||
|
||||
// 根据邀请码获得上级用户信息
|
||||
String invitationCode = userInfoRegisterRequest.getInvitationCode();
|
||||
LambdaQueryWrapper<UserInfo> invitedLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
invitedLambdaQueryWrapper.eq(UserInfo::getInvitationCode, invitationCode).eq(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE);
|
||||
UserInfo parentUserInfo = this.getOne(invitedLambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(parentUserInfo == null, ErrorCode.OPERATION_ERROR, "邀请码错误");
|
||||
UserInfo parentUserInfo = getParentUserInfoByInvitationCode(invitationCode);
|
||||
|
||||
// 保存用户
|
||||
UserInfo myUserInfo = commonService.copyProperties(userInfoRegisterRequest, UserInfo.class);
|
||||
// 判断当前用户是否是根节点
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE, this);
|
||||
if (userInfoList.isEmpty()) myUserInfo.setParentUserId(0L);
|
||||
myUserInfo.setParentUserId(parentUserInfo.getId());
|
||||
myUserInfo.setInvitationCode(RandomUtil.randomNumbers(6));
|
||||
myUserInfo.setUserAccount(phoneNumber);
|
||||
myUserInfo.setUserRole(UserConstant.DEFAULT_ROLE);
|
||||
myUserInfo.setUserAvatar(UserConstant.USER_DEFAULT_AVATAR);
|
||||
this.save(myUserInfo);
|
||||
UserMainInfo userMainInfo = new UserMainInfo();
|
||||
userMainInfo.setUserId(myUserInfo.getId());
|
||||
|
||||
// 批量更新父级用户团队人数
|
||||
List<Long> pathToRoot = this.findPathToRoot(myUserInfo.getId());
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(pathToRoot, userMainInfoService, id -> id, UserMainInfo::getUserId);
|
||||
for (UserMainInfo mainInfo : userMainInfoList) {
|
||||
mainInfo.setTeamSize(mainInfo.getTeamSize() + 1);
|
||||
}
|
||||
userMainInfoService.updateBatchById(userMainInfoList);
|
||||
UserMainInfo userMainInfo = updateParentUserInfoTeamCount(myUserInfo.getId());
|
||||
|
||||
// 生成邀请二维码
|
||||
try {
|
||||
String view = wechatGetQrcodeService.getWxQrCode(myUserInfo.getInvitationCode());
|
||||
userMainInfo.setInviteQrCode(view);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
userMainInfoService.save(userMainInfo);
|
||||
generateInvitationQrcode(userMainInfo, myUserInfo.getInvitationCode());
|
||||
|
||||
// 查询上级用户的项目抽佣记录
|
||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetField(ProjectCommission::getUserId, parentUserInfo.getId(), projectCommissionService);
|
||||
// 封装Map集合(键:项目明细id, 值:项目最小价格)
|
||||
Map<Long, BigDecimal> projectDetailMinPriceMap = new HashMap<>();
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId);
|
||||
for (ProjectDetail projectDetail : projectDetailList) {
|
||||
projectDetailMinPriceMap.put(projectDetail.getId(), projectDetail.getProjectMinSettlementPrice());
|
||||
}
|
||||
// 插入当前用户的项目抽佣记录
|
||||
List<ProjectCommission> projectCommissions = new ArrayList<>();
|
||||
for (ProjectCommission projectCommission : projectCommissionList) {
|
||||
ProjectCommissionAddRequest projectCommissionAddRequest = commonService.copyProperties(projectCommission, ProjectCommissionAddRequest.class);
|
||||
ProjectCommission proCommission = commonService.copyProperties(projectCommissionAddRequest, ProjectCommission.class);
|
||||
// 获取当前项目明细的最小结算价格
|
||||
BigDecimal projectMinSettlementPrice = projectDetailMinPriceMap.get(projectCommission.getProjectDetailId());
|
||||
BigDecimal currentSettlementPrice = projectCommission.getMyUnitPrice().multiply(BigDecimal.ONE.subtract(projectCommission.getCurrentCommissionRate().divide(BigDecimal.valueOf(100))));
|
||||
// 比较当前结算价格和项目明细最小结算价格,取出最大值
|
||||
proCommission.setMyUnitPrice(projectMinSettlementPrice.max(currentSettlementPrice));
|
||||
proCommission.setCurrentCommissionRate(BigDecimal.ZERO);
|
||||
proCommission.setUserId(myUserInfo.getId());
|
||||
projectCommissions.add(proCommission);
|
||||
}
|
||||
projectCommissionService.saveBatch(projectCommissions);
|
||||
// 插入下级用户的项目明细抽佣记录
|
||||
List<SubUserProjectCommission> subUserProjectCommissionList = new ArrayList<>();
|
||||
for (ProjectCommission projectCommission : projectCommissionList) {
|
||||
ProjectCommissionAddRequest projectCommissionAddRequest = commonService.copyProperties(projectCommission, ProjectCommissionAddRequest.class);
|
||||
SubUserProjectCommission subUserProjectCommission = commonService.copyProperties(projectCommissionAddRequest, SubUserProjectCommission.class);
|
||||
subUserProjectCommission.setSubUserId(myUserInfo.getId());
|
||||
subUserProjectCommissionList.add(subUserProjectCommission);
|
||||
}
|
||||
subUserProjectCommissionService.saveBatch(subUserProjectCommissionList);
|
||||
// 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
|
||||
saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
|
||||
}
|
||||
|
||||
|
||||
@ -254,14 +207,9 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
@Override
|
||||
public String userInfoMiniLoginByVcd(UserInfoMiniVerifyCodeLoginRequest userInfoMiniVerifyCodeLoginRequest) {
|
||||
String phoneNumber = userInfoMiniVerifyCodeLoginRequest.getPhoneNumber();
|
||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
||||
|
||||
String verificationCode = userInfoMiniVerifyCodeLoginRequest.getVerificationCode();
|
||||
String code = redisTemplate.opsForValue().get(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
ThrowUtils.throwIf(code == null, ErrorCode.OPERATION_ERROR, "验证码已失效");
|
||||
|
||||
// // 移除验证码
|
||||
// redisTemplate.delete(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
// 校验用户手机号和验证码
|
||||
checkPhoneAndVerificationCode(phoneNumber, verificationCode, null);
|
||||
|
||||
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber);
|
||||
@ -282,14 +230,9 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
@Override
|
||||
public void userInfoMiniResetPwd(UserInfoResetRequest userInfoResetRequest, boolean isInner) {
|
||||
String phoneNumber = userInfoResetRequest.getPhoneNumber();
|
||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
||||
|
||||
String verificationCode = userInfoResetRequest.getVerificationCode();
|
||||
String code = redisTemplate.opsForValue().get(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
ThrowUtils.throwIf(code == null, ErrorCode.OPERATION_ERROR, "验证码已失效");
|
||||
|
||||
// // 移除验证码
|
||||
// redisTemplate.delete(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
// 校验用户手机号和验证码
|
||||
checkPhoneAndVerificationCode(phoneNumber, verificationCode, null);
|
||||
|
||||
String userPassword = userInfoResetRequest.getUserPassword();
|
||||
String userConfirmPassword = userInfoResetRequest.getUserConfirmPassword();
|
||||
@ -340,6 +283,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序用户获取验证码(用于注册)
|
||||
*/
|
||||
@ -360,6 +304,173 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验用户手机号和验证码
|
||||
*/
|
||||
@Override
|
||||
public void checkPhoneAndVerificationCode(String phoneNumber, String verificationCode, UserRoleEnum userRoleEnum) {
|
||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
||||
if (userRoleEnum != null) {
|
||||
LambdaQueryWrapper<UserInfo> phoneNumberLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
phoneNumberLambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber);
|
||||
phoneNumberLambdaQueryWrapper = getQueryWrapperByUserRole(userRoleEnum, phoneNumberLambdaQueryWrapper);
|
||||
UserInfo userInfo = this.getOne(phoneNumberLambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(userInfo != null, ErrorCode.OPERATION_ERROR, "手机号已注册");
|
||||
}
|
||||
String code = redisTemplate.opsForValue().get(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
ThrowUtils.throwIf(code == null, ErrorCode.OPERATION_ERROR, "验证码已失效");
|
||||
|
||||
// // 移除验证码
|
||||
// redisTemplate.delete(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户权限来获取条件构造器
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryWrapper<UserInfo> getQueryWrapperByUserRole(UserRoleEnum userRoleEnum, LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper) {
|
||||
if (userRoleEnum.equals(UserRoleEnum.USER)) {
|
||||
userInfoLambdaQueryWrapper.eq(UserInfo::getUserRole, userRoleEnum.getValue());
|
||||
} else {
|
||||
userInfoLambdaQueryWrapper.in(UserInfo::getUserRole, UserRoleEnum.MANAGER, UserRoleEnum.SUPERVISOR, UserRoleEnum.STAFF);
|
||||
}
|
||||
return userInfoLambdaQueryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端员工信息注册
|
||||
*/
|
||||
@Override
|
||||
public void staffUserInfoMiniRegister(AdvancementApplyApproveRequest advancementApplyApproveRequest) {
|
||||
// 获取晋升申请记录信息
|
||||
Long applyId = advancementApplyApproveRequest.getApplyId();
|
||||
AdvancementApply advancementApply = advancementApplyService.getById(applyId);
|
||||
String phoneNumber = advancementApply.getPhone();
|
||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
||||
|
||||
// 根据邀请码获得上级用户信息
|
||||
String invitationCode = advancementApplyApproveRequest.getInvitationCode();
|
||||
UserInfo parentUserInfo = getParentUserInfoByInvitationCode(invitationCode);
|
||||
|
||||
// 添加用户
|
||||
UserInfo myUserInfo = UserInfo.builder()
|
||||
.id(null)
|
||||
.nickName(advancementApply.getName())
|
||||
.phoneNumber(advancementApply.getPhone())
|
||||
.userAvatar(UserConstant.USER_DEFAULT_AVATAR)
|
||||
.userAccount(RandomUtil.randomNumbers(12))
|
||||
.userPassword(RandomUtil.randomString(12))
|
||||
.invitationCode(RandomUtil.randomNumbers(6))
|
||||
.userRole(advancementApplyApproveRequest.getUserRole())
|
||||
.parentUserId(parentUserInfo.getId())
|
||||
.build();
|
||||
this.save(myUserInfo);
|
||||
|
||||
// 批量更新父级用户团队人数
|
||||
UserMainInfo userMainInfo = updateParentUserInfoTeamCount(myUserInfo.getId());
|
||||
|
||||
// 生成邀请二维码
|
||||
generateInvitationQrcode(userMainInfo, myUserInfo.getInvitationCode());
|
||||
|
||||
// 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
|
||||
saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
|
||||
|
||||
// 修改晋升申请记录的审核状态,并绑定申请成功的用户id
|
||||
LambdaUpdateWrapper<AdvancementApply> advancementApplyLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
advancementApplyLambdaUpdateWrapper.eq(AdvancementApply::getId, advancementApply.getId())
|
||||
.set(AdvancementApply::getReviewStatus, ReviewStatusEnum.APPROVED.getValue())
|
||||
.set(AdvancementApply::getUserId, myUserInfo.getId());
|
||||
advancementApplyService.update(advancementApplyLambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据邀请码获得上级用户信息
|
||||
*/
|
||||
private UserInfo getParentUserInfoByInvitationCode(String invitationCode) {
|
||||
LambdaQueryWrapper<UserInfo> invitedLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
invitedLambdaQueryWrapper.eq(UserInfo::getInvitationCode, invitationCode);
|
||||
UserInfo parentUserInfo = this.getOne(invitedLambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(parentUserInfo == null, ErrorCode.OPERATION_ERROR, "邀请码错误");
|
||||
return parentUserInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量更新父级用户团队人数
|
||||
*/
|
||||
private UserMainInfo updateParentUserInfoTeamCount(Long userId) {
|
||||
UserMainInfo userMainInfo = new UserMainInfo();
|
||||
userMainInfo.setUserId(userId);
|
||||
List<Long> pathToRoot = this.findPathToRoot(userId);
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(pathToRoot, userMainInfoService, id -> id, UserMainInfo::getUserId);
|
||||
for (UserMainInfo mainInfo : userMainInfoList) {
|
||||
mainInfo.setTeamSize(mainInfo.getTeamSize() + 1);
|
||||
}
|
||||
userMainInfoService.updateBatchById(userMainInfoList);
|
||||
return userMainInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成邀请二维码
|
||||
*/
|
||||
private void generateInvitationQrcode(UserMainInfo userMainInfo, String invitationCode) {
|
||||
try {
|
||||
String view = wechatGetQrcodeService.getWxQrCode(invitationCode);
|
||||
userMainInfo.setInviteQrCode(view);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
userMainInfoService.save(userMainInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
|
||||
*/
|
||||
private void saveBatchProjectCommissionAndSubUserProjectCommission(Long userId, Long parentUserId) {
|
||||
// 查询上级用户的项目抽佣记录
|
||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetField(ProjectCommission::getUserId, parentUserId, projectCommissionService);
|
||||
// 封装Map集合(键:项目明细id, 值:项目最小价格)
|
||||
Map<Long, BigDecimal> projectDetailMinPriceMap = new HashMap<>();
|
||||
List<ProjectDetail> projectDetailList = commonService.findByFieldInTargetField(projectCommissionList, projectDetailService, ProjectCommission::getProjectDetailId, ProjectDetail::getId);
|
||||
for (ProjectDetail projectDetail : projectDetailList) {
|
||||
projectDetailMinPriceMap.put(projectDetail.getId(), projectDetail.getProjectMinSettlementPrice());
|
||||
}
|
||||
// 插入当前用户的项目抽佣记录
|
||||
List<ProjectCommission> projectCommissions = new ArrayList<>();
|
||||
for (ProjectCommission projectCommission : projectCommissionList) {
|
||||
ProjectCommissionAddRequest projectCommissionAddRequest = commonService.copyProperties(projectCommission, ProjectCommissionAddRequest.class);
|
||||
ProjectCommission proCommission = commonService.copyProperties(projectCommissionAddRequest, ProjectCommission.class);
|
||||
// 获取当前项目明细的最小结算价格
|
||||
BigDecimal projectMinSettlementPrice = projectDetailMinPriceMap.get(projectCommission.getProjectDetailId());
|
||||
BigDecimal currentSettlementPrice = projectCommission.getMyUnitPrice().multiply(BigDecimal.ONE.subtract(projectCommission.getCurrentCommissionRate().divide(BigDecimal.valueOf(100))));
|
||||
// 比较当前结算价格和项目明细最小结算价格,取出最大值
|
||||
proCommission.setMyUnitPrice(projectMinSettlementPrice.max(currentSettlementPrice));
|
||||
proCommission.setCurrentCommissionRate(BigDecimal.ZERO);
|
||||
proCommission.setUserId(userId);
|
||||
projectCommissions.add(proCommission);
|
||||
}
|
||||
projectCommissionService.saveBatch(projectCommissions);
|
||||
// 插入下级用户的项目明细抽佣记录
|
||||
List<SubUserProjectCommission> subUserProjectCommissionList = new ArrayList<>();
|
||||
for (ProjectCommission projectCommission : projectCommissionList) {
|
||||
ProjectCommissionAddRequest projectCommissionAddRequest = commonService.copyProperties(projectCommission, ProjectCommissionAddRequest.class);
|
||||
SubUserProjectCommission subUserProjectCommission = commonService.copyProperties(projectCommissionAddRequest, SubUserProjectCommission.class);
|
||||
subUserProjectCommission.setSubUserId(userId);
|
||||
subUserProjectCommissionList.add(subUserProjectCommission);
|
||||
}
|
||||
subUserProjectCommissionService.saveBatch(subUserProjectCommissionList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.greenorange.promotion.service.wechat;
|
||||
|
||||
import com.greenorange.promotion.config.WxAccessToken;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -27,5 +29,5 @@ public interface WechatGetQrcodeService {
|
||||
/**
|
||||
* 微信小程序获取课程码
|
||||
*/
|
||||
String getWxCourseQrCode(String inviteCode) throws Exception;
|
||||
String getWxCourseQrCode(CommonRequest courseQrcodeAddRequest, HttpServletRequest request) throws Exception;
|
||||
}
|
||||
|
@ -12,13 +12,23 @@ import com.freewayso.image.combiner.enums.ZoomMode;
|
||||
import com.google.gson.Gson;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.config.WxAccessToken;
|
||||
import com.greenorange.promotion.constant.SystemConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.mapper.UserInfoMapper;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.entity.Course;
|
||||
import com.greenorange.promotion.model.entity.CourseQrcodeApply;
|
||||
import com.greenorange.promotion.model.entity.FileInfo;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.service.course.CourseQrcodeApplyService;
|
||||
import com.greenorange.promotion.service.course.CourseService;
|
||||
import com.greenorange.promotion.service.file.FileInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||
import com.greenorange.promotion.utils.QRCodeUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -31,7 +41,6 @@ import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -40,7 +49,6 @@ import java.util.concurrent.TimeUnit;
|
||||
public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||
|
||||
|
||||
|
||||
// 文件上传的存储目录
|
||||
@Value("${file.upload-dir}")
|
||||
private String uploadDir;
|
||||
@ -63,10 +71,18 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||
@Value("${wx.mini.appSecret}")
|
||||
private String appSecret;
|
||||
|
||||
|
||||
@Resource
|
||||
private FileInfoService fileInfoService;
|
||||
|
||||
@Resource
|
||||
private UserInfoMapper userInfoMapper;
|
||||
|
||||
@Resource
|
||||
private CourseService courseService;
|
||||
|
||||
@Resource
|
||||
private CourseQrcodeApplyService courseQrcodeApplyService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取接口调用凭据
|
||||
@ -197,14 +213,27 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String getWxCourseQrCode(String inviteCode) throws Exception {
|
||||
public String getWxCourseQrCode(CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||
String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
||||
if (accessToken == null) {
|
||||
accessToken = this.getAccessToken().getAccess_token();
|
||||
}
|
||||
// 获取用户邀请码
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
UserInfo userInfo = userInfoMapper.selectById(userId);
|
||||
String invitationCode = userInfo.getInvitationCode();
|
||||
// 获取课程信息
|
||||
Long courseId = commonRequest.getId();
|
||||
Course course = courseService.getById(courseId);
|
||||
String courseTitle = course.getName();
|
||||
String originalPrice = String.valueOf(course.getOriginPrice());
|
||||
String discountPrice = String.valueOf(course.getDiscountPrice());
|
||||
String discountText = "元券后价";
|
||||
|
||||
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("page", "pages/loginModule/register/register");
|
||||
param.put("scene", "invitationCode=" + inviteCode);
|
||||
param.put("scene", "invitationCode=" + invitationCode + "&courseId=" + courseId);
|
||||
param.put("width", 430);
|
||||
param.put("check_path", false);
|
||||
param.put("env_version", "develop");
|
||||
@ -216,10 +245,6 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||
.execute()
|
||||
.bodyBytes();
|
||||
|
||||
String courseTitle = "【早鸟42折】掌握CAD技能实战技能实战技能实战技能实战工作训练营";
|
||||
String originalPrice = "2680元";
|
||||
String discountPrice = "1680";
|
||||
String discountText = "元券后价";
|
||||
String FontType = "Microsoft YaHei UI";
|
||||
int FontStyle = Font.PLAIN;
|
||||
|
||||
@ -228,17 +253,9 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||
ImageCombiner combiner = new ImageCombiner(blankUrl, 341, 391, ZoomMode.WidthHeight, OutputFormat.PNG);
|
||||
|
||||
// 加载课程图片
|
||||
String courseUrl = "https://img.picui.cn/free/2025/06/22/6856ef5908d4b.jpg";
|
||||
String courseUrl = SystemConstant.FILE_COMMON_PREFIX + course.getImage();
|
||||
BufferedImage courseImage = ImageIO.read(new URL(courseUrl));
|
||||
|
||||
// Graphics2D graphics = courseImage.createGraphics();
|
||||
// graphics.setColor(Color.decode("#323232"));
|
||||
// graphics.setFont(new Font("阿里巴巴普惠体", Font.PLAIN, 60));
|
||||
// graphics.drawString("测试", 0, 80);
|
||||
// graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
|
||||
// graphics.drawString("测试", 0, 160);
|
||||
// graphics.dispose();
|
||||
|
||||
// 将二维码数据转换为 BufferedImage
|
||||
BufferedImage qrImage = ImageIO.read(new ByteArrayInputStream(responseBytes));
|
||||
|
||||
@ -311,21 +328,18 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||
.hashValue(hashValue)
|
||||
.build();
|
||||
fileInfoService.save(fileInfo);
|
||||
return biz + "-" + view;
|
||||
|
||||
String viewValue = biz + "-" + view;
|
||||
// 保存课程推广码申请记录
|
||||
CourseQrcodeApply courseQrcodeApply = CourseQrcodeApply.builder()
|
||||
.userId(userId)
|
||||
.courseId(courseId)
|
||||
.courseQrcode(viewValue)
|
||||
.build();
|
||||
courseQrcodeApplyService.save(courseQrcodeApply);
|
||||
return viewValue;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 获取本地图形环境
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
// 列出所有可用字体家族名
|
||||
String[] families = ge.getAvailableFontFamilyNames();
|
||||
|
||||
// 打印全部字体(可选)
|
||||
System.out.println("=== Available Font Families ===");
|
||||
Arrays.stream(families).forEach(System.out::println);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class OrderNumberUtils {
|
||||
// 获取时间戳(精确到秒)
|
||||
String timestamp = DATE_FORMAT.format(new Date());
|
||||
|
||||
// 获取4位随机数
|
||||
// 获取6位随机数
|
||||
String randomNumber = generateRandomNumber();
|
||||
|
||||
// 获取6位自增序列号,并确保不超过最大值
|
||||
@ -56,10 +56,10 @@ public class OrderNumberUtils {
|
||||
return new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
}
|
||||
|
||||
// 生成4位随机数(范围:0000到9999)
|
||||
// 生成6位随机数(范围:000000到999999)
|
||||
private static String generateRandomNumber() {
|
||||
int random = (int) (Math.random() * 10000); // 生成0到9999之间的随机数
|
||||
return String.format("%04d", random); // 格式化为4位
|
||||
int random = (int) (Math.random() * 1000000); // 生成0到999999之间的随机数
|
||||
return String.format("%06d", random); // 格式化为6位
|
||||
}
|
||||
|
||||
// 获取下一个自增序列号,使用ReentrantLock来确保线程安全
|
||||
|
@ -1,15 +1,21 @@
|
||||
spring:
|
||||
datasource:
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://27.30.77.229:3306/qingcheng_caozhe?serverTimezone=Asia/Shanghai
|
||||
# username: qingcheng
|
||||
# password: Qc@8ls2jf
|
||||
# hikari:
|
||||
# maximum-pool-size: 300
|
||||
# max-lifetime: 120000
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://27.30.77.229:3306/qingcheng_caozhe?serverTimezone=Asia/Shanghai
|
||||
username: qingcheng
|
||||
password: Qc@8ls2jf
|
||||
url: jdbc:mysql://43.143.28.121:3306/easybbs?serverTimezone=Asia/Shanghai
|
||||
username: easybbs
|
||||
password: root
|
||||
hikari:
|
||||
maximum-pool-size: 300
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
|
@ -1,4 +1,4 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: test
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
23
src/main/resources/mapper/AdvancementApplyMapper.xml
Normal file
23
src/main/resources/mapper/AdvancementApplyMapper.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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.AdvancementApplyMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.greenorange.promotion.model.entity.AdvancementApply">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||
<result property="resume" column="resume" jdbcType="VARCHAR"/>
|
||||
<result property="reviewStatus" column="reviewStatus" jdbcType="OTHER"/>
|
||||
<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,name,phone,
|
||||
resume,reviewStatus,isDelete,
|
||||
createTime,updateTime
|
||||
</sql>
|
||||
</mapper>
|
20
src/main/resources/mapper/CourseQrcodeApplyMapper.xml
Normal file
20
src/main/resources/mapper/CourseQrcodeApplyMapper.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?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.CourseQrcodeApplyMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.greenorange.promotion.model.entity.CourseQrcodeApply">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="userId" column="userId" jdbcType="BIGINT"/>
|
||||
<result property="courseId" column="courseId" 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,userId,courseId,
|
||||
isDelete,createTime,updateTime
|
||||
</sql>
|
||||
</mapper>
|
@ -42,7 +42,7 @@ public class ${entityName}Controller {
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "web端管理员根据id修改${entityComment}", description = "参数:${entityComment}更新请求体,权限:管理员,方法名:update${entityName}")
|
||||
@Operation(summary = "web端管理员根据id修改${entityComment}信息", description = "参数:${entityComment}更新请求体,权限:管理员,方法名:update${entityName}")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "${entityComment}管理", content = "web端管理员根据id修改${entityComment}信息")
|
||||
public BaseResponse<Boolean> update${entityName}(@Valid @RequestBody ${entityName}UpdateRequest ${entityNameLower}UpdateRequest) {
|
||||
|
@ -1,75 +1,74 @@
|
||||
package com.greenorange.promotion.junit;
|
||||
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.entity.Project;
|
||||
import com.greenorange.promotion.model.vo.project.ProjectVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.project.ProjectService;
|
||||
import com.greenorange.promotion.service.project.impl.ProjectServiceImpl;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class ProjectServiceImplTest {
|
||||
|
||||
@InjectMocks
|
||||
private ProjectServiceImpl service;
|
||||
// 把真正的业务实现类注入进来
|
||||
|
||||
@Mock
|
||||
private CommonService commonService;
|
||||
// 用于 copyProperties
|
||||
|
||||
@Mock
|
||||
private ProjectService projectService;
|
||||
// 用于 getById
|
||||
|
||||
@Test
|
||||
void queryProjectById_notFound_throwsException() {
|
||||
// Arrange
|
||||
CommonRequest req = new CommonRequest();
|
||||
req.setId(10L);
|
||||
when(projectService.getById(10L)).thenReturn(null);
|
||||
|
||||
// Act & Assert
|
||||
RuntimeException ex = assertThrows(RuntimeException.class, () ->
|
||||
service.queryProjectById(req)
|
||||
);
|
||||
assertTrue(ex.getMessage().contains("当前项目不存在"));
|
||||
|
||||
// commonService.copyProperties 不应被调用
|
||||
verify(commonService, never()).copyProperties(any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryProjectById_found_returnsVO() {
|
||||
// Arrange
|
||||
Long projectId = 20L;
|
||||
CommonRequest req = new CommonRequest();
|
||||
req.setId(projectId);
|
||||
|
||||
Project project = new Project();
|
||||
project.setId(projectId);
|
||||
project.setProjectName("示例项目");
|
||||
when(projectService.getById(projectId)).thenReturn(project);
|
||||
|
||||
ProjectVO vo = new ProjectVO();
|
||||
vo.setId(projectId);
|
||||
vo.setProjectName("示例项目");
|
||||
when(commonService.copyProperties(project, ProjectVO.class))
|
||||
.thenReturn(vo);
|
||||
|
||||
// Act
|
||||
ProjectVO result = service.queryProjectById(req);
|
||||
|
||||
// Assert
|
||||
assertSame(vo, result, "应返回 commonService.copyProperties 的结果");
|
||||
verify(commonService, times(1)).copyProperties(project, ProjectVO.class);
|
||||
}
|
||||
}
|
||||
//package com.greenorange.promotion.junit;
|
||||
//
|
||||
//import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
//import com.greenorange.promotion.model.entity.Project;
|
||||
//import com.greenorange.promotion.model.vo.project.ProjectVO;
|
||||
//import com.greenorange.promotion.service.common.CommonService;
|
||||
//import com.greenorange.promotion.service.project.ProjectService;
|
||||
//import com.greenorange.promotion.service.project.impl.ProjectServiceImpl;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import org.junit.jupiter.api.extension.ExtendWith;
|
||||
//import org.mockito.InjectMocks;
|
||||
//import org.mockito.Mock;
|
||||
//import org.mockito.junit.jupiter.MockitoExtension;
|
||||
//
|
||||
//import static org.junit.jupiter.api.Assertions.*;
|
||||
//import static org.mockito.Mockito.*;
|
||||
//
|
||||
//@ExtendWith(MockitoExtension.class)
|
||||
//class ProjectServiceImplTest {
|
||||
//
|
||||
// @InjectMocks
|
||||
// private ProjectServiceImpl service;
|
||||
// // 把真正的业务实现类注入进来
|
||||
//
|
||||
// @Mock
|
||||
// private CommonService commonService;
|
||||
// // 用于 copyProperties
|
||||
//
|
||||
// @Mock
|
||||
// private ProjectService projectService;
|
||||
// // 用于 getById
|
||||
//
|
||||
// @Test
|
||||
// void queryProjectById_notFound_throwsException() {
|
||||
// // Arrange
|
||||
// CommonRequest req = new CommonRequest();
|
||||
// req.setId(10L);
|
||||
// when(projectService.getById(10L)).thenReturn(null);
|
||||
// // Act & Assert
|
||||
// RuntimeException ex = assertThrows(RuntimeException.class, () ->
|
||||
// service.queryProjectById(req)
|
||||
// );
|
||||
// assertTrue(ex.getMessage().equals("当前项目不存在"));
|
||||
//
|
||||
// // commonService.copyProperties 不应被调用
|
||||
// verify(commonService, never()).copyProperties(any(), any());
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// void queryProjectById_found_returnsVO() {
|
||||
// // Arrange
|
||||
// Long projectId = 20L;
|
||||
// CommonRequest req = new CommonRequest();
|
||||
// req.setId(projectId);
|
||||
//
|
||||
// Project project = new Project();
|
||||
// project.setId(projectId);
|
||||
// project.setProjectName("示例项目");
|
||||
// when(projectService.getById(projectId)).thenReturn(project);
|
||||
//
|
||||
// ProjectVO vo = new ProjectVO();
|
||||
// vo.setId(projectId);
|
||||
// vo.setProjectName("示例项目");
|
||||
// when(commonService.copyProperties(project, ProjectVO.class))
|
||||
// .thenReturn(vo);
|
||||
//
|
||||
// // Act
|
||||
// ProjectVO result = service.queryProjectById(req);
|
||||
//
|
||||
// // Assert
|
||||
// assertSame(vo, result, "应返回 commonService.copyProperties 的结果");
|
||||
// verify(commonService, times(1)).copyProperties(project, ProjectVO.class);
|
||||
// }
|
||||
//}
|
||||
|
Reference in New Issue
Block a user