修复了冗余的接口和实体类
This commit is contained in:
@ -1,145 +0,0 @@
|
|||||||
package com.greenorange.promotion.controller.course;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
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.CommonBatchRequest;
|
|
||||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
|
||||||
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterAddRequest;
|
|
||||||
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterQueryRequest;
|
|
||||||
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterUpdateRequest;
|
|
||||||
import com.greenorange.promotion.model.entity.CourseChapter;
|
|
||||||
import com.greenorange.promotion.model.vo.courseChapter.CourseChapterVO;
|
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
|
||||||
import com.greenorange.promotion.service.course.CourseChapterService;
|
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节 控制器
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("courseChapter")
|
|
||||||
@Slf4j
|
|
||||||
@Tag(name = "课程章节模块")
|
|
||||||
public class CourseChapterController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseChapterService courseChapterService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CommonService commonService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* web端管理员添加课程章节
|
|
||||||
* @param courseChapterAddRequest 课程章节添加请求体
|
|
||||||
* @return 是否添加成功
|
|
||||||
*/
|
|
||||||
@PostMapping("add")
|
|
||||||
@Operation(summary = "web端管理员添加课程章节", description = "参数:课程章节添加请求体,权限:管理员,方法名:addCourseChapter")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@SysLog(title = "课程章节管理", content = "web端管理员添加课程章节")
|
|
||||||
public BaseResponse<Long> addCourseChapter(@Valid @RequestBody CourseChapterAddRequest courseChapterAddRequest) {
|
|
||||||
CourseChapter courseChapter = commonService.copyProperties(courseChapterAddRequest, CourseChapter.class);
|
|
||||||
courseChapterService.save(courseChapter);
|
|
||||||
return ResultUtils.success(courseChapter.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* web端管理员根据id修改课程章节信息
|
|
||||||
* @param courseChapterUpdateRequest 课程章节更新请求体
|
|
||||||
* @return 是否更新成功
|
|
||||||
*/
|
|
||||||
@PostMapping("update")
|
|
||||||
@Operation(summary = "web端管理员根据id修改课程章节", description = "参数:课程章节更新请求体,权限:管理员,方法名:updateCourseChapter")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@SysLog(title = "课程章节管理", content = "web端管理员根据id修改课程章节信息")
|
|
||||||
public BaseResponse<Boolean> updateCourseChapter(@Valid @RequestBody CourseChapterUpdateRequest courseChapterUpdateRequest) {
|
|
||||||
CourseChapter courseChapter = commonService.copyProperties(courseChapterUpdateRequest, CourseChapter.class);
|
|
||||||
courseChapterService.updateById(courseChapter);
|
|
||||||
return ResultUtils.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* web端管理员根据id删除课程章节
|
|
||||||
* @param commonRequest 课程章节删除请求体
|
|
||||||
* @return 是否删除成功
|
|
||||||
*/
|
|
||||||
@PostMapping("delete")
|
|
||||||
@Operation(summary = "web端管理员根据id删除课程章节", description = "参数:课程章节删除请求体,权限:管理员,方法名:delCourseChapter")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@SysLog(title = "课程章节管理", content = "web端管理员根据id删除课程章节")
|
|
||||||
public BaseResponse<Boolean> delCourseChapter(@Valid @RequestBody CommonRequest commonRequest) {
|
|
||||||
Long id = commonRequest.getId();
|
|
||||||
courseChapterService.removeById(id);
|
|
||||||
return ResultUtils.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* web端管理员批量删除课程章节
|
|
||||||
* @param commonBatchRequest 课程章节批量删除请求体
|
|
||||||
* @return 是否删除成功
|
|
||||||
*/
|
|
||||||
@PostMapping("delBatch")
|
|
||||||
@Operation(summary = "web端管理员批量删除课程章节", description = "参数:课程章节批量删除请求体,权限:管理员,方法名:delBatchCourseChapter")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@SysLog(title = "课程章节管理", content = "web端管理员批量删除课程章节")
|
|
||||||
public BaseResponse<Boolean> delBatchCourseChapter(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
|
||||||
List<Long> ids = commonBatchRequest.getIds();
|
|
||||||
courseChapterService.removeByIds(ids);
|
|
||||||
return ResultUtils.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* web端管理员根据id查询课程章节
|
|
||||||
* @param commonRequest 课程章节查询请求体
|
|
||||||
* @return 课程章节信息
|
|
||||||
*/
|
|
||||||
@PostMapping("queryById")
|
|
||||||
@Operation(summary = "web端管理员根据id查询课程章节", description = "参数:课程章节查询请求体,权限:管理员,方法名:queryCourseChapterById")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@SysLog(title = "课程章节管理", content = "web端管理员根据id查询课程章节")
|
|
||||||
public BaseResponse<CourseChapterVO> queryCourseChapterById(@Valid @RequestBody CommonRequest commonRequest) {
|
|
||||||
Long id = commonRequest.getId();
|
|
||||||
CourseChapter courseChapter = courseChapterService.getById(id);
|
|
||||||
CourseChapterVO courseChapterVO = commonService.copyProperties(courseChapter, CourseChapterVO.class);
|
|
||||||
return ResultUtils.success(courseChapterVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Web端管理员根据课程id分页查询课程章节
|
|
||||||
* @param courseChapterQueryRequest 课程章节查询请求体
|
|
||||||
* @return 课程章节列表
|
|
||||||
*/
|
|
||||||
@PostMapping("page")
|
|
||||||
@Operation(summary = "Web端管理员根据课程id分页查询课程章节", description = "参数:课程章节查询请求体,权限:管理员,方法名:listCourseChapterByPageByCourseId")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@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);
|
|
||||||
Page<CourseChapter> page = courseChapterService.page(new Page<>(current, pageSize), queryWrapper);
|
|
||||||
List<CourseChapter> courseChapterList = page.getRecords();
|
|
||||||
List<CourseChapterVO> courseChapterVOList = commonService.convertList(courseChapterList, CourseChapterVO.class);
|
|
||||||
Page<CourseChapterVO> voPage = new Page<>(current, pageSize);
|
|
||||||
voPage.setRecords(courseChapterVOList);
|
|
||||||
voPage.setPages(page.getPages());
|
|
||||||
voPage.setTotal(page.getTotal());
|
|
||||||
return ResultUtils.success(voPage);
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,7 +10,6 @@ import com.greenorange.promotion.common.BaseResponse;
|
|||||||
import com.greenorange.promotion.common.ErrorCode;
|
import com.greenorange.promotion.common.ErrorCode;
|
||||||
import com.greenorange.promotion.common.ResultUtils;
|
import com.greenorange.promotion.common.ResultUtils;
|
||||||
import com.greenorange.promotion.constant.UserConstant;
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
import com.greenorange.promotion.exception.BusinessException;
|
|
||||||
import com.greenorange.promotion.exception.ThrowUtils;
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||||
@ -19,16 +18,10 @@ import com.greenorange.promotion.model.dto.course.CourseAddRequest;
|
|||||||
import com.greenorange.promotion.model.dto.course.CourseQueryRequest;
|
import com.greenorange.promotion.model.dto.course.CourseQueryRequest;
|
||||||
import com.greenorange.promotion.model.dto.course.CourseUpdateRequest;
|
import com.greenorange.promotion.model.dto.course.CourseUpdateRequest;
|
||||||
import com.greenorange.promotion.model.entity.Course;
|
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.CourseCardVO;
|
||||||
import com.greenorange.promotion.model.vo.course.CourseDetailVO;
|
import com.greenorange.promotion.model.vo.course.CourseDetailVO;
|
||||||
import com.greenorange.promotion.model.vo.course.CourseVO;
|
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.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.course.CourseService;
|
||||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -63,16 +56,9 @@ public class CourseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseChapterService courseChapterService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WechatGetQrcodeService wechatGetQrcodeService;
|
private WechatGetQrcodeService wechatGetQrcodeService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseQrcodeApplyService courseQrcodeApplyService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序端用户查看热门课程列表
|
* 小程序端用户查看热门课程列表
|
||||||
@ -124,29 +110,10 @@ public class CourseController {
|
|||||||
Long id = commonRequest.getId();
|
Long id = commonRequest.getId();
|
||||||
Course course = courseService.getById(id);
|
Course course = courseService.getById(id);
|
||||||
CourseDetailVO courseDetailVO = commonService.copyProperties(course, CourseDetailVO.class);
|
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);
|
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查看课程基本信息
|
* 小程序端用户根据id查看课程基本信息
|
||||||
@ -165,24 +132,6 @@ public class CourseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 小程序端用户查看当前课程推广码
|
|
||||||
* @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());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -200,9 +149,6 @@ public class CourseController {
|
|||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
@SysLog(title = "课程管理", content = "web端管理员添加课程")
|
@SysLog(title = "课程管理", content = "web端管理员添加课程")
|
||||||
public BaseResponse<Long> addCourse(@Valid @RequestBody CourseAddRequest courseAddRequest) {
|
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);
|
Course course = commonService.copyProperties(courseAddRequest, Course.class);
|
||||||
courseService.save(course);
|
courseService.save(course);
|
||||||
return ResultUtils.success(course.getId());
|
return ResultUtils.success(course.getId());
|
||||||
@ -235,9 +181,6 @@ public class CourseController {
|
|||||||
public BaseResponse<Boolean> delCourse(@Valid @RequestBody CommonRequest commonRequest) {
|
public BaseResponse<Boolean> delCourse(@Valid @RequestBody CommonRequest commonRequest) {
|
||||||
Long id = commonRequest.getId();
|
Long id = commonRequest.getId();
|
||||||
courseService.removeById(id);
|
courseService.removeById(id);
|
||||||
// 删除课程下的所有章节
|
|
||||||
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = commonService.buildQueryWrapperByField(CourseChapter::getCourseId, id, courseChapterService);
|
|
||||||
courseChapterService.remove(lambdaQueryWrapper);
|
|
||||||
return ResultUtils.success(true);
|
return ResultUtils.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,10 +196,6 @@ public class CourseController {
|
|||||||
public BaseResponse<Boolean> delBatchCourse(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
public BaseResponse<Boolean> delBatchCourse(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||||
List<Long> ids = commonBatchRequest.getIds();
|
List<Long> ids = commonBatchRequest.getIds();
|
||||||
courseService.removeByIds(ids);
|
courseService.removeByIds(ids);
|
||||||
// 批量删除课程下的所有章节
|
|
||||||
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.in(CourseChapter::getCourseId, ids);
|
|
||||||
courseChapterService.remove(lambdaQueryWrapper);
|
|
||||||
return ResultUtils.success(true);
|
return ResultUtils.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.greenorange.promotion.controller.projectSettlement;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||||
import com.greenorange.promotion.annotation.SysLog;
|
import com.greenorange.promotion.annotation.SysLog;
|
||||||
import com.greenorange.promotion.common.BaseResponse;
|
import com.greenorange.promotion.common.BaseResponse;
|
||||||
@ -11,7 +12,10 @@ import com.greenorange.promotion.constant.UserConstant;
|
|||||||
import com.greenorange.promotion.exception.ThrowUtils;
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
|
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
|
||||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
|
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
|
||||||
import com.greenorange.promotion.model.entity.*;
|
import com.greenorange.promotion.model.entity.FundsChange;
|
||||||
|
import com.greenorange.promotion.model.entity.UserAccount;
|
||||||
|
import com.greenorange.promotion.model.entity.UserMainInfo;
|
||||||
|
import com.greenorange.promotion.model.entity.WithdrawalApply;
|
||||||
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
|
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
|
||||||
import com.greenorange.promotion.model.vo.fundsChange.FundsItemVO;
|
import com.greenorange.promotion.model.vo.fundsChange.FundsItemVO;
|
||||||
import com.greenorange.promotion.model.vo.userAccount.UserAccountConditionVO;
|
import com.greenorange.promotion.model.vo.userAccount.UserAccountConditionVO;
|
||||||
@ -20,17 +24,15 @@ import com.greenorange.promotion.service.common.CommonService;
|
|||||||
import com.greenorange.promotion.service.settle.FundsChangeService;
|
import com.greenorange.promotion.service.settle.FundsChangeService;
|
||||||
import com.greenorange.promotion.service.settle.UserAccountService;
|
import com.greenorange.promotion.service.settle.UserAccountService;
|
||||||
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
|
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
|
||||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
|
||||||
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -65,19 +65,19 @@ public class WechatGetQrcodeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 微信小程序获取课程码
|
// * 微信小程序获取课程码
|
||||||
* @return
|
// * @return
|
||||||
* @throws IOException
|
// * @throws IOException
|
||||||
*/
|
// */
|
||||||
@Hidden
|
// @Hidden
|
||||||
@PostMapping("/get/course/qrcode")
|
// @PostMapping("/get/course/qrcode")
|
||||||
@Operation(summary = "微信小程序获取课程码", description = "参数:无, 权限:所有人, 方法名:getCourseQrcode")
|
// @Operation(summary = "微信小程序获取课程码", description = "参数:无, 权限:所有人, 方法名:getCourseQrcode")
|
||||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
//// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
public BaseResponse<String> getCourseQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
// public BaseResponse<String> getCourseQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||||
String view = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
// String view = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
||||||
return ResultUtils.success(view);
|
// return ResultUtils.success(view);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
package com.greenorange.promotion.mapper;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.model.entity.CourseChapter;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 35880
|
|
||||||
* @description 针对表【course_chapter(课程章节表)】的数据库操作Mapper
|
|
||||||
* @createDate 2025-06-23 18:30:28
|
|
||||||
* @Entity com.greenorange.promotion.model.entity.CourseChapter
|
|
||||||
*/
|
|
||||||
public interface CourseChapterMapper extends BaseMapper<CourseChapter> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
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> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.greenorange.promotion.mapper;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.model.entity.PromoRecord;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 35880
|
|
||||||
* @description 针对表【promo_record(推广记录表)】的数据库操作Mapper
|
|
||||||
* @createDate 2025-06-23 18:31:45
|
|
||||||
* @Entity com.greenorange.promotion.model.entity.PromoRecord
|
|
||||||
*/
|
|
||||||
public interface PromoRecordMapper extends BaseMapper<PromoRecord> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -19,12 +19,9 @@ import java.io.Serializable;
|
|||||||
"name",
|
"name",
|
||||||
"type",
|
"type",
|
||||||
"detail",
|
"detail",
|
||||||
"promoCodeDesc",
|
|
||||||
"image",
|
"image",
|
||||||
"originPrice",
|
"originPrice",
|
||||||
"discountPrice",
|
"discountPrice"
|
||||||
"firstLevelRate",
|
|
||||||
"secondLevelRate",
|
|
||||||
})
|
})
|
||||||
public class CourseAddRequest implements Serializable {
|
public class CourseAddRequest implements Serializable {
|
||||||
|
|
||||||
@ -36,11 +33,11 @@ public class CourseAddRequest implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "课程类别不能为空")
|
@NotBlank(message = "课程类别不能为空")
|
||||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,13 +47,6 @@ public class CourseAddRequest implements Serializable {
|
|||||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "推广码说明(富文本)不能为空")
|
|
||||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -78,20 +68,6 @@ public class CourseAddRequest implements Serializable {
|
|||||||
@Schema(description = "折扣价格", example = "2499")
|
@Schema(description = "折扣价格", example = "2499")
|
||||||
private BigDecimal discountPrice;
|
private BigDecimal discountPrice;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0", message = "一级佣金比例不能小于0")
|
|
||||||
@Schema(description = "一级佣金比例(%)", example = "10")
|
|
||||||
private BigDecimal firstLevelRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0", message = "二级佣金比例不能小于0")
|
|
||||||
@Schema(description = "二级佣金比例(%)", example = "5")
|
|
||||||
private BigDecimal secondLevelRate;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -28,10 +28,10 @@ public class CourseQueryRequest extends PageRequest implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,13 +22,10 @@ import java.io.Serializable;
|
|||||||
"name",
|
"name",
|
||||||
"type",
|
"type",
|
||||||
"detail",
|
"detail",
|
||||||
"promoCodeDesc",
|
|
||||||
"image",
|
"image",
|
||||||
"originPrice",
|
"originPrice",
|
||||||
"discountPrice",
|
"discountPrice",
|
||||||
"orderCount",
|
"orderCount"
|
||||||
"firstLevelRate",
|
|
||||||
"secondLevelRate",
|
|
||||||
})
|
})
|
||||||
public class CourseUpdateRequest implements Serializable {
|
public class CourseUpdateRequest implements Serializable {
|
||||||
|
|
||||||
@ -47,11 +44,11 @@ public class CourseUpdateRequest implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "课程类别不能为空")
|
@NotBlank(message = "课程类别不能为空")
|
||||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,13 +58,6 @@ public class CourseUpdateRequest implements Serializable {
|
|||||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "推广码说明(富文本)不能为空")
|
|
||||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -95,20 +85,6 @@ public class CourseUpdateRequest implements Serializable {
|
|||||||
@Schema(description = "已下单人数", example = "100")
|
@Schema(description = "已下单人数", example = "100")
|
||||||
private Integer orderCount;
|
private Integer orderCount;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0.0", message = "一级佣金比例不能小于0")
|
|
||||||
@Schema(description = "一级佣金比例(%)", example = "10")
|
|
||||||
private BigDecimal firstLevelRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0.0", message = "二级佣金比例不能小于0")
|
|
||||||
@Schema(description = "二级佣金比例(%)", example = "5")
|
|
||||||
private BigDecimal secondLevelRate;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.dto.courseChapter;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.annotation.EnumValue;
|
|
||||||
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 lombok.Data;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节添加请求体
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "课程章节添加请求体", requiredProperties = {
|
|
||||||
"name",
|
|
||||||
"duration",
|
|
||||||
"permissions",
|
|
||||||
"videoView",
|
|
||||||
"courseId",
|
|
||||||
})
|
|
||||||
public class CourseChapterAddRequest implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "章节名称不能为空")
|
|
||||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节时长(单位:秒)
|
|
||||||
*/
|
|
||||||
@Min(value = 0L, message = "章节时长不能小于0")
|
|
||||||
@Schema(description = "章节时长", example = "600")
|
|
||||||
private Long duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "试看权限不能为空")
|
|
||||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
|
||||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
|
||||||
private String permissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频文件 view 值
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "视频文件 view 值不能为空")
|
|
||||||
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
|
|
||||||
private String videoView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属课程ID
|
|
||||||
*/
|
|
||||||
@Min(value = 1L, message = "所属课程ID ID不能小于1")
|
|
||||||
@Schema(description = "所属课程ID", example = "1")
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.dto.courseChapter;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.annotation.EnumValue;
|
|
||||||
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;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.greenorange.promotion.common.PageRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节查询请求体,继承自分页请求 PageRequest
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "课程章节查询请求体", requiredProperties = {"current", "pageSize"})
|
|
||||||
public class CourseChapterQueryRequest extends PageRequest implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.dto.courseChapter;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.annotation.EnumValue;
|
|
||||||
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 lombok.Data;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节更新请求体
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "课程章节更新请求体", requiredProperties = {
|
|
||||||
"id",
|
|
||||||
"name",
|
|
||||||
"duration",
|
|
||||||
"permissions",
|
|
||||||
"videoView",
|
|
||||||
"courseId",
|
|
||||||
})
|
|
||||||
public class CourseChapterUpdateRequest implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节ID
|
|
||||||
*/
|
|
||||||
@Min(value = 1L, message = "章节ID ID不能小于1")
|
|
||||||
@Schema(description = "章节ID", example = "1")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "章节名称不能为空")
|
|
||||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节时长(单位:秒)
|
|
||||||
*/
|
|
||||||
@Min(value = 0L, message = "章节时长不能小于0")
|
|
||||||
@Schema(description = "章节时长", example = "600")
|
|
||||||
private Long duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "试看权限不能为空")
|
|
||||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
|
||||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
|
||||||
private String permissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频文件 view 值
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "视频文件 view 值不能为空")
|
|
||||||
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
|
|
||||||
private String videoView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属课程ID
|
|
||||||
*/
|
|
||||||
@Min(value = 1L, message = "所属课程ID ID不能小于1")
|
|
||||||
@Schema(description = "所属课程ID", example = "1")
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
@ -28,7 +28,7 @@ public class Course implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
@ -37,11 +37,6 @@ public class Course implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -62,16 +57,6 @@ public class Course implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer orderCount;
|
private Integer orderCount;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一级佣金比例(%)
|
|
||||||
*/
|
|
||||||
private BigDecimal firstLevelRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级佣金比例(%)
|
|
||||||
*/
|
|
||||||
private BigDecimal secondLevelRate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否上架(true:上架,false:下架)
|
* 是否上架(true:上架,false:下架)
|
||||||
*/
|
*/
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
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.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节表
|
|
||||||
* @TableName course_chapter
|
|
||||||
*/
|
|
||||||
@TableName(value ="course_chapter")
|
|
||||||
@Data
|
|
||||||
public class CourseChapter implements Serializable {
|
|
||||||
/**
|
|
||||||
* 章节ID
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节时长(格式可自定义,如"00:10:00")
|
|
||||||
*/
|
|
||||||
private Long duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
private String permissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频文件 view 值
|
|
||||||
*/
|
|
||||||
private String videoView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属课程ID
|
|
||||||
*/
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
private Integer isDelete;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
@TableField(exist = false)
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广记录表
|
|
||||||
* @TableName promo_record
|
|
||||||
*/
|
|
||||||
@TableName(value ="promo_record")
|
|
||||||
@Data
|
|
||||||
public class PromoRecord implements Serializable {
|
|
||||||
/**
|
|
||||||
* 推广记录ID
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 被推广课程ID
|
|
||||||
*/
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下级用户ID
|
|
||||||
*/
|
|
||||||
private Long subUserId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下级用户昵称
|
|
||||||
*/
|
|
||||||
private String nickName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下级用户手机号
|
|
||||||
*/
|
|
||||||
private String phone;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下级带给上级的收益
|
|
||||||
*/
|
|
||||||
private BigDecimal benefits;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定时间(字符串格式)
|
|
||||||
*/
|
|
||||||
private String bindTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广类型
|
|
||||||
*/
|
|
||||||
private Object promoType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广人(上级用户)ID
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
private Integer isDelete;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
@ -14,8 +14,7 @@ import java.util.stream.Collectors;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum CourseTypeEnum implements BaseEnum {
|
public enum CourseTypeEnum implements BaseEnum {
|
||||||
|
|
||||||
KAOGONGKAOYAN("考公考研"),
|
KAOGONG("考公"),
|
||||||
ZIMEITI("自媒体"),
|
|
||||||
CAIJING("财经");
|
CAIJING("财经");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
@ -24,9 +24,9 @@ public class CourseCardVO implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package com.greenorange.promotion.model.vo.course;
|
package com.greenorange.promotion.model.vo.course;
|
||||||
|
|
||||||
import com.greenorange.promotion.model.vo.courseChapter.CourseChapterVO;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -27,9 +25,9 @@ public class CourseDetailVO implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,12 +36,6 @@ public class CourseDetailVO implements Serializable {
|
|||||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -62,12 +54,6 @@ public class CourseDetailVO implements Serializable {
|
|||||||
@Schema(description = "折扣价格", example = "2499")
|
@Schema(description = "折扣价格", example = "2499")
|
||||||
private BigDecimal discountPrice;
|
private BigDecimal discountPrice;
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节
|
|
||||||
*/
|
|
||||||
@Schema(description = "课程章节")
|
|
||||||
private List<CourseChapterVO> courseChapters;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -27,9 +27,9 @@ public class CourseVO implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,12 +38,6 @@ public class CourseVO implements Serializable {
|
|||||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -68,18 +62,6 @@ public class CourseVO implements Serializable {
|
|||||||
@Schema(description = "已下单人数", example = "100")
|
@Schema(description = "已下单人数", example = "100")
|
||||||
private Integer orderCount;
|
private Integer orderCount;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@Schema(description = "一级佣金比例(%)", example = "10")
|
|
||||||
private BigDecimal firstLevelRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@Schema(description = "二级佣金比例(%)", example = "5")
|
|
||||||
private BigDecimal secondLevelRate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否上架(true:上架,false:下架)
|
* 是否上架(true:上架,false:下架)
|
||||||
*/
|
*/
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.vo.courseChapter;
|
|
||||||
|
|
||||||
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;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节 视图对象
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "课程章节 视图对象")
|
|
||||||
public class CourseChapterVO implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "课程章节ID", example = "1")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节时长(单位:秒)
|
|
||||||
*/
|
|
||||||
@Schema(description = "章节时长", example = "600")
|
|
||||||
private Long duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
|
||||||
private String permissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频文件 view 值
|
|
||||||
*/
|
|
||||||
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
|
|
||||||
private String videoView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属课程ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "所属课程ID", example = "所属课程ID ID不能小于1")
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.greenorange.promotion.service.course;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.greenorange.promotion.model.dto.courseChapter.CourseChapterQueryRequest;
|
|
||||||
import com.greenorange.promotion.model.entity.CourseChapter;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 35880
|
|
||||||
* @description 针对表【course_chapter(课程章节表)】的数据库操作Service
|
|
||||||
* @createDate 2025-06-23 18:30:28
|
|
||||||
*/
|
|
||||||
public interface CourseChapterService extends IService<CourseChapter> {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取查询条件
|
|
||||||
*/
|
|
||||||
QueryWrapper<CourseChapter> getQueryWrapper(CourseChapterQueryRequest courseChapterQueryRequest);
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
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> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package com.greenorange.promotion.service.course;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.model.entity.PromoRecord;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 35880
|
|
||||||
* @description 针对表【promo_record(推广记录表)】的数据库操作Service
|
|
||||||
* @createDate 2025-06-23 18:31:45
|
|
||||||
*/
|
|
||||||
public interface PromoRecordService extends IService<PromoRecord> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
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.courseChapter.CourseChapterQueryRequest;
|
|
||||||
import com.greenorange.promotion.model.entity.CourseChapter;
|
|
||||||
import com.greenorange.promotion.service.course.CourseChapterService;
|
|
||||||
import com.greenorange.promotion.mapper.CourseChapterMapper;
|
|
||||||
import com.greenorange.promotion.utils.SqlUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 35880
|
|
||||||
* @description 针对表【course_chapter(课程章节表)】的数据库操作Service实现
|
|
||||||
* @createDate 2025-06-23 18:30:28
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, CourseChapter>
|
|
||||||
implements CourseChapterService{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取查询条件
|
|
||||||
*/
|
|
||||||
@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);
|
|
||||||
return queryWrapper;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
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{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
package com.greenorange.promotion.service.course.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.greenorange.promotion.model.entity.PromoRecord;
|
|
||||||
import com.greenorange.promotion.service.course.PromoRecordService;
|
|
||||||
import com.greenorange.promotion.mapper.PromoRecordMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 35880
|
|
||||||
* @description 针对表【promo_record(推广记录表)】的数据库操作Service实现
|
|
||||||
* @createDate 2025-06-23 18:31:45
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class PromoRecordServiceImpl extends ServiceImpl<PromoRecordMapper, PromoRecord>
|
|
||||||
implements PromoRecordService{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,8 +26,8 @@ public interface WechatGetQrcodeService {
|
|||||||
String getWxQrCode(String inviteCode) throws IOException;
|
String getWxQrCode(String inviteCode) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 微信小程序获取课程码
|
// * 微信小程序获取课程码
|
||||||
*/
|
// */
|
||||||
String getWxCourseQrCode(CommonRequest courseQrcodeAddRequest, HttpServletRequest request) throws Exception;
|
// String getWxCourseQrCode(CommonRequest courseQrcodeAddRequest, HttpServletRequest request) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,10 @@ import com.greenorange.promotion.exception.BusinessException;
|
|||||||
import com.greenorange.promotion.mapper.UserInfoMapper;
|
import com.greenorange.promotion.mapper.UserInfoMapper;
|
||||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||||
import com.greenorange.promotion.model.entity.Course;
|
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.FileInfo;
|
||||||
import com.greenorange.promotion.model.entity.UserInfo;
|
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.course.CourseService;
|
||||||
import com.greenorange.promotion.service.file.FileInfoService;
|
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.service.wechat.WechatGetQrcodeService;
|
||||||
import com.greenorange.promotion.utils.QRCodeUtil;
|
import com.greenorange.promotion.utils.QRCodeUtil;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -74,15 +71,6 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
|||||||
@Resource
|
@Resource
|
||||||
private FileInfoService fileInfoService;
|
private FileInfoService fileInfoService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private UserInfoMapper userInfoMapper;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseService courseService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseQrcodeApplyService courseQrcodeApplyService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取接口调用凭据
|
* 获取接口调用凭据
|
||||||
@ -207,138 +195,138 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 微信小程序获取课程码
|
// * 微信小程序获取课程码
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public String getWxCourseQrCode(CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
// public String getWxCourseQrCode(CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||||
String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
// String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
||||||
if (accessToken == null) {
|
// if (accessToken == null) {
|
||||||
accessToken = this.getAccessToken().getAccess_token();
|
// accessToken = this.getAccessToken().getAccess_token();
|
||||||
}
|
// }
|
||||||
// 获取用户邀请码
|
// // 获取用户邀请码
|
||||||
Long userId = (Long) request.getAttribute("userId");
|
// Long userId = (Long) request.getAttribute("userId");
|
||||||
UserInfo userInfo = userInfoMapper.selectById(userId);
|
// UserInfo userInfo = userInfoMapper.selectById(userId);
|
||||||
String invitationCode = userInfo.getInvitationCode();
|
// String invitationCode = userInfo.getInvitationCode();
|
||||||
// 获取课程信息
|
// // 获取课程信息
|
||||||
Long courseId = commonRequest.getId();
|
// Long courseId = commonRequest.getId();
|
||||||
Course course = courseService.getById(courseId);
|
// Course course = courseService.getById(courseId);
|
||||||
String courseTitle = course.getName();
|
// String courseTitle = course.getName();
|
||||||
String originalPrice = String.valueOf(course.getOriginPrice());
|
// String originalPrice = String.valueOf(course.getOriginPrice());
|
||||||
String discountPrice = String.valueOf(course.getDiscountPrice());
|
// String discountPrice = String.valueOf(course.getDiscountPrice());
|
||||||
String discountText = "元券后价";
|
// String discountText = "元券后价";
|
||||||
|
//
|
||||||
|
//
|
||||||
Map<String, Object> param = new HashMap<>();
|
// Map<String, Object> param = new HashMap<>();
|
||||||
param.put("page", "pages/loginModule/register/register");
|
// param.put("page", "pages/loginModule/register/register");
|
||||||
param.put("scene", "invitationCode=" + invitationCode + "&courseId=" + courseId);
|
// param.put("scene", "invitationCode=" + invitationCode + "&courseId=" + courseId);
|
||||||
param.put("width", 430);
|
// param.put("width", 430);
|
||||||
param.put("check_path", false);
|
// param.put("check_path", false);
|
||||||
param.put("env_version", "develop");
|
// param.put("env_version", "develop");
|
||||||
String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
|
// String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
|
||||||
String jsonParams = JSONUtil.toJsonStr(param);
|
// String jsonParams = JSONUtil.toJsonStr(param);
|
||||||
byte[] responseBytes = HttpUtil.createPost(url)
|
// byte[] responseBytes = HttpUtil.createPost(url)
|
||||||
.header("Content-Type", "application/json")
|
// .header("Content-Type", "application/json")
|
||||||
.body(jsonParams)
|
// .body(jsonParams)
|
||||||
.execute()
|
// .execute()
|
||||||
.bodyBytes();
|
// .bodyBytes();
|
||||||
|
//
|
||||||
String FontType = "Microsoft YaHei UI";
|
// String FontType = "Microsoft YaHei UI";
|
||||||
int FontStyle = Font.PLAIN;
|
// int FontStyle = Font.PLAIN;
|
||||||
|
//
|
||||||
// 加载一张空白图像
|
// // 加载一张空白图像
|
||||||
String blankUrl = "https://img.picui.cn/free/2025/06/21/6856a072e9eea.png";
|
// String blankUrl = "https://img.picui.cn/free/2025/06/21/6856a072e9eea.png";
|
||||||
ImageCombiner combiner = new ImageCombiner(blankUrl, 341, 391, ZoomMode.WidthHeight, OutputFormat.PNG);
|
// ImageCombiner combiner = new ImageCombiner(blankUrl, 341, 391, ZoomMode.WidthHeight, OutputFormat.PNG);
|
||||||
|
//
|
||||||
// 加载课程图片
|
// // 加载课程图片
|
||||||
String courseUrl = SystemConstant.FILE_COMMON_PREFIX + course.getImage();
|
// String courseUrl = SystemConstant.FILE_COMMON_PREFIX + course.getImage();
|
||||||
BufferedImage courseImage = ImageIO.read(new URL(courseUrl));
|
// BufferedImage courseImage = ImageIO.read(new URL(courseUrl));
|
||||||
|
//
|
||||||
// 将二维码数据转换为 BufferedImage
|
// // 将二维码数据转换为 BufferedImage
|
||||||
BufferedImage qrImage = ImageIO.read(new ByteArrayInputStream(responseBytes));
|
// BufferedImage qrImage = ImageIO.read(new ByteArrayInputStream(responseBytes));
|
||||||
|
//
|
||||||
// 缩放图片(不失真)
|
// // 缩放图片(不失真)
|
||||||
Image scaledImage = qrImage.getScaledInstance(134, 134, Image.SCALE_SMOOTH);
|
// Image scaledImage = qrImage.getScaledInstance(134, 134, Image.SCALE_SMOOTH);
|
||||||
BufferedImage resizedImage = new BufferedImage(134, 134, BufferedImage.TYPE_INT_RGB);
|
// BufferedImage resizedImage = new BufferedImage(134, 134, BufferedImage.TYPE_INT_RGB);
|
||||||
resizedImage.getGraphics().drawImage(scaledImage, 0, 0, null);
|
// resizedImage.getGraphics().drawImage(scaledImage, 0, 0, null);
|
||||||
|
//
|
||||||
combiner.setQuality(1f);
|
// combiner.setQuality(1f);
|
||||||
|
//
|
||||||
// 将课程图片合并到组合器中
|
// // 将课程图片合并到组合器中
|
||||||
combiner.addImageElement(courseImage, 18, 16, 306, 158, ZoomMode.WidthHeight).setRoundCorner(5).setCenter(true);
|
// combiner.addImageElement(courseImage, 18, 16, 306, 158, ZoomMode.WidthHeight).setRoundCorner(5).setCenter(true);
|
||||||
// 将二维码图片合并到组合器中
|
// // 将二维码图片合并到组合器中
|
||||||
combiner.addImageElement(resizedImage, 190, 240);
|
// combiner.addImageElement(resizedImage, 190, 240);
|
||||||
|
//
|
||||||
// 绘制文本
|
// // 绘制文本
|
||||||
TextElement courseTitleElement = new TextElement(courseTitle, FontType, FontStyle, 18, 20, 186);
|
// TextElement courseTitleElement = new TextElement(courseTitle, FontType, FontStyle, 18, 20, 186);
|
||||||
courseTitleElement.setColor(Color.decode("#323232"))
|
// courseTitleElement.setColor(Color.decode("#323232"))
|
||||||
.setCenter(true)
|
// .setCenter(true)
|
||||||
.setAutoBreakLine(306);
|
// .setAutoBreakLine(306);
|
||||||
combiner.addElement(courseTitleElement);
|
// combiner.addElement(courseTitleElement);
|
||||||
|
//
|
||||||
TextElement originalPriceElement = new TextElement(originalPrice, FontType, FontStyle, 24, 56, 275);
|
// TextElement originalPriceElement = new TextElement(originalPrice, FontType, FontStyle, 24, 56, 275);
|
||||||
originalPriceElement.setColor(Color.decode("#8C8C8C")).setStrikeThrough(true);
|
// originalPriceElement.setColor(Color.decode("#8C8C8C")).setStrikeThrough(true);
|
||||||
combiner.addElement(originalPriceElement);
|
// combiner.addElement(originalPriceElement);
|
||||||
|
//
|
||||||
TextElement discountedPriceElement = new TextElement(discountPrice, FontType, Font.BOLD, 28, 31, 343);
|
// TextElement discountedPriceElement = new TextElement(discountPrice, FontType, Font.BOLD, 28, 31, 343);
|
||||||
discountedPriceElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base).setSpace(0.01f);
|
// discountedPriceElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base).setSpace(0.01f);
|
||||||
combiner.addElement(discountedPriceElement);
|
// combiner.addElement(discountedPriceElement);
|
||||||
|
//
|
||||||
TextElement discountedTextElement = new TextElement(discountText, FontType, FontStyle, 16, discountedPriceElement.getX() + discountedPriceElement.getWidth(), 341);
|
// TextElement discountedTextElement = new TextElement(discountText, FontType, FontStyle, 16, discountedPriceElement.getX() + discountedPriceElement.getWidth(), 341);
|
||||||
discountedTextElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base);
|
// discountedTextElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base);
|
||||||
combiner.addElement(discountedTextElement);
|
// combiner.addElement(discountedTextElement);
|
||||||
|
//
|
||||||
combiner.combine();
|
// combiner.combine();
|
||||||
|
//
|
||||||
InputStream resultStream = combiner.getCombinedImageStream();
|
// InputStream resultStream = combiner.getCombinedImageStream();
|
||||||
byte[] resultBytes = resultStream.readAllBytes();
|
// byte[] resultBytes = resultStream.readAllBytes();
|
||||||
// 创建上传目录,如果不存在
|
// // 创建上传目录,如果不存在
|
||||||
String biz = "default";
|
// String biz = "default";
|
||||||
String fileName = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "." + "png";
|
// String fileName = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "." + "png";
|
||||||
// 获取文件类型
|
// // 获取文件类型
|
||||||
String fileType = FileUtil.getSuffix(fileName);
|
// String fileType = FileUtil.getSuffix(fileName);
|
||||||
// 获取view值
|
// // 获取view值
|
||||||
String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
// String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
||||||
File file = new File(uploadDir + fileName);
|
// File file = new File(uploadDir + fileName);
|
||||||
if (!file.getParentFile().exists()) {
|
// if (!file.getParentFile().exists()) {
|
||||||
file.getParentFile().mkdirs();// 如果路径不存在则创建
|
// file.getParentFile().mkdirs();// 如果路径不存在则创建
|
||||||
}
|
// }
|
||||||
// 将文件上传到目标位置
|
// // 将文件上传到目标位置
|
||||||
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE)) {
|
// try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE)) {
|
||||||
bos.write(resultBytes);
|
// bos.write(resultBytes);
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
throw new BusinessException(ErrorCode.OPERATION_ERROR, "文件上传失败,失败原因:" + e.getMessage());
|
// throw new BusinessException(ErrorCode.OPERATION_ERROR, "文件上传失败,失败原因:" + e.getMessage());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 获取文件大小
|
// // 获取文件大小
|
||||||
Double fileSize = file.length() / 1024.0;
|
// Double fileSize = file.length() / 1024.0;
|
||||||
fileSize = Double.valueOf(String.format("%.2f", fileSize));
|
// fileSize = Double.valueOf(String.format("%.2f", fileSize));
|
||||||
// 获取文件哈希值
|
// // 获取文件哈希值
|
||||||
InputStream inputStream = new FileInputStream(file);
|
// InputStream inputStream = new FileInputStream(file);
|
||||||
String hashValue = DigestUtils.sha256Hex(inputStream);
|
// String hashValue = DigestUtils.sha256Hex(inputStream);
|
||||||
// 保存文件
|
// // 保存文件
|
||||||
FileInfo fileInfo = FileInfo.builder()
|
// FileInfo fileInfo = FileInfo.builder()
|
||||||
.name(fileName)
|
// .name(fileName)
|
||||||
.type(fileType)
|
// .type(fileType)
|
||||||
.size(fileSize)
|
// .size(fileSize)
|
||||||
.fileView(view)
|
// .fileView(view)
|
||||||
.biz(biz)
|
// .biz(biz)
|
||||||
.hashValue(hashValue)
|
// .hashValue(hashValue)
|
||||||
.build();
|
// .build();
|
||||||
fileInfoService.save(fileInfo);
|
// fileInfoService.save(fileInfo);
|
||||||
|
//
|
||||||
String viewValue = biz + "-" + view;
|
// String viewValue = biz + "-" + view;
|
||||||
// 保存课程推广码申请记录
|
// // 保存课程推广码申请记录
|
||||||
CourseQrcodeApply courseQrcodeApply = CourseQrcodeApply.builder()
|
// CourseQrcodeApply courseQrcodeApply = CourseQrcodeApply.builder()
|
||||||
.userId(userId)
|
// .userId(userId)
|
||||||
.courseId(courseId)
|
// .courseId(courseId)
|
||||||
.courseQrcode(viewValue)
|
// .courseQrcode(viewValue)
|
||||||
.build();
|
// .build();
|
||||||
courseQrcodeApplyService.save(courseQrcodeApply);
|
// courseQrcodeApplyService.save(courseQrcodeApply);
|
||||||
return viewValue;
|
// return viewValue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
<?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.CourseChapterMapper">
|
|
||||||
|
|
||||||
<resultMap id="BaseResultMap" type="com.greenorange.promotion.model.entity.CourseChapter">
|
|
||||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
|
||||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
|
||||||
<result property="duration" column="duration" jdbcType="VARCHAR"/>
|
|
||||||
<result property="permissions" column="permissions" jdbcType="OTHER"/>
|
|
||||||
<result property="videoView" column="videoView" jdbcType="VARCHAR"/>
|
|
||||||
<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,name,duration,
|
|
||||||
permissions,videoView,courseId,
|
|
||||||
isDelete,createTime,updateTime
|
|
||||||
</sql>
|
|
||||||
</mapper>
|
|
@ -1,20 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,28 +0,0 @@
|
|||||||
<?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.PromoRecordMapper">
|
|
||||||
|
|
||||||
<resultMap id="BaseResultMap" type="com.greenorange.promotion.model.entity.PromoRecord">
|
|
||||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
|
||||||
<result property="courseId" column="courseId" jdbcType="BIGINT"/>
|
|
||||||
<result property="subUserId" column="subUserId" jdbcType="BIGINT"/>
|
|
||||||
<result property="nickName" column="nickName" jdbcType="VARCHAR"/>
|
|
||||||
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
|
||||||
<result property="benefits" column="benefits" jdbcType="DECIMAL"/>
|
|
||||||
<result property="bindTime" column="bindTime" jdbcType="VARCHAR"/>
|
|
||||||
<result property="promoType" column="promoType" jdbcType="OTHER"/>
|
|
||||||
<result property="userId" column="userId" jdbcType="BIGINT"/>
|
|
||||||
<result property="isDelete" column="isDelete" jdbcType="TINYINT"/>
|
|
||||||
<result property="createTime" column="createTime" jdbcType="TIMESTAMP"/>
|
|
||||||
<result property="updateTime" column="updateTime" jdbcType="TIMESTAMP"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
id,courseId,subUserId,
|
|
||||||
nickName,phone,benefits,
|
|
||||||
bindTime,promoType,userId,
|
|
||||||
isDelete,createTime,updateTime
|
|
||||||
</sql>
|
|
||||||
</mapper>
|
|
Reference in New Issue
Block a user