Compare commits
6 Commits
f51d42230c
...
dev
Author | SHA1 | Date | |
---|---|---|---|
cbaa7f8a0c | |||
8d766edec3 | |||
a0557729c6 | |||
656bee3ad1 | |||
5f7c3b50ff | |||
869fd1a8b1 |
@ -4,7 +4,7 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ErrorCode {
|
||||
// private static final SUCESS = new ErrorCode(1, "ok");
|
||||
|
||||
SUCCESS(1,"ok"),
|
||||
PARAMS_ERROR(40000,"请求参数错误"),
|
||||
NOT_LOGIN_ERROR(40100,"未登录"),
|
||||
|
@ -43,4 +43,19 @@ public interface UserConstant {
|
||||
*/
|
||||
String BAN_ROLE = "ban";
|
||||
|
||||
/**
|
||||
* 经理
|
||||
*/
|
||||
String MANAGER_ROLE = "manager";
|
||||
|
||||
/**
|
||||
* 主管
|
||||
*/
|
||||
String SUPERVISOR_ROLE = "supervisor";
|
||||
|
||||
/**
|
||||
* 员工
|
||||
*/
|
||||
String STAFF_ROLE = "staff";
|
||||
|
||||
}
|
||||
|
@ -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.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;
|
||||
@ -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.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;
|
||||
@ -63,16 +56,9 @@ public class CourseController {
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@Resource
|
||||
private CourseChapterService courseChapterService;
|
||||
|
||||
@Resource
|
||||
private WechatGetQrcodeService wechatGetQrcodeService;
|
||||
|
||||
@Resource
|
||||
private CourseQrcodeApplyService courseQrcodeApplyService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查看热门课程列表
|
||||
@ -124,29 +110,10 @@ public class CourseController {
|
||||
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查看课程基本信息
|
||||
@ -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)
|
||||
@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());
|
||||
@ -235,9 +181,6 @@ public class CourseController {
|
||||
public BaseResponse<Boolean> delCourse(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
courseService.removeById(id);
|
||||
// 删除课程下的所有章节
|
||||
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = commonService.buildQueryWrapperByField(CourseChapter::getCourseId, id, courseChapterService);
|
||||
courseChapterService.remove(lambdaQueryWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
@ -253,10 +196,6 @@ public class CourseController {
|
||||
public BaseResponse<Boolean> delBatchCourse(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
List<Long> ids = commonBatchRequest.getIds();
|
||||
courseService.removeByIds(ids);
|
||||
// 批量删除课程下的所有章节
|
||||
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(CourseChapter::getCourseId, ids);
|
||||
courseChapterService.remove(lambdaQueryWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
public class IdCardNumRequest {
|
||||
private String idcardnum;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
public class Project_commission {
|
||||
private Long userid;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
public class Promo_code_apply {
|
||||
private Long userid;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
//有get,set方法,to-string方法
|
||||
@Data
|
||||
//无参构造函数
|
||||
@NoArgsConstructor
|
||||
//全参构造函数
|
||||
@AllArgsConstructor
|
||||
public class QueryRequest {
|
||||
private Long pagesize;
|
||||
|
||||
|
||||
private Long pagenum;
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
public class Toselect {
|
||||
private String phoneNumber;
|
||||
private String bankNumber;
|
||||
}
|
@ -1,223 +0,0 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountAddRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.ProjectCommission;
|
||||
import com.greenorange.promotion.model.entity.PromoCodeApply;
|
||||
import com.greenorange.promotion.model.entity.UserAccount;
|
||||
import com.greenorange.promotion.service.project.ProjectCommissionService;
|
||||
import com.greenorange.promotion.service.project.PromoCodeApplyService;
|
||||
import com.greenorange.promotion.service.project.impl.PromoCodeApplyServiceImpl;
|
||||
import com.greenorange.promotion.service.settle.UserAccountService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.checkerframework.common.util.report.qual.ReportWrite;
|
||||
import org.jacoco.agent.rt.internal_f3994fa.IExceptionLogger;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.*;
|
||||
|
||||
//@ResponseBody 把返回值传到浏览器上
|
||||
//@Controller 把当前类的对象创建出来,存放到SpringIOC容器,
|
||||
//@RestController = @Controller + @ResponseBody
|
||||
@RestController
|
||||
// ip + 端口号用于运行这个服务
|
||||
// ip + 端口号 + /test/hello
|
||||
// @Controller @Service @Mapper 把当前类的对象创建出来,存放到SpringIOC容器,
|
||||
@RequestMapping("test")
|
||||
public class UserAccountTestController {
|
||||
|
||||
// 对userAccount表实现功能
|
||||
// 1.插入,删除,修改,全部查询,根据id查询
|
||||
@Resource
|
||||
// 从容器中取出名字为userAccountService的对象
|
||||
private UserAccountService userAccountService;
|
||||
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<String> add(@RequestBody UserAccountAddRequest userAccountAddRequest){
|
||||
if (userAccountAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数不能为空");
|
||||
}
|
||||
if (userAccountAddRequest.getBankCardNumber() == null ||
|
||||
userAccountAddRequest.getPhoneNumber() == null ||
|
||||
userAccountAddRequest.getIdCardNumber() == null ||
|
||||
userAccountAddRequest.getCardHolder() == null ||
|
||||
userAccountAddRequest.getOpenBank() == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "必填字段不能为空");
|
||||
}
|
||||
UserAccount userAccount = new UserAccount();
|
||||
// userAccount.setId(null);
|
||||
// userAccount.setBankCardNumber(userAccountAddRequest.getBankCardNumber());
|
||||
// userAccount.setOpenBank(userAccountAddRequest.getOpenBank());
|
||||
// userAccount.setPhoneNumber(userAccountAddRequest.getPhoneNumber());
|
||||
// userAccount.setIdCardNumber(userAccountAddRequest.getIdCardNumber());
|
||||
// userAccount.setCardHolder(userAccountAddRequest.getCardHolder());
|
||||
// userAccount.setUserId(1L);
|
||||
BeanUtils.copyProperties(userAccountAddRequest, userAccount);
|
||||
boolean result = userAccountService.save(userAccount);
|
||||
if (!result) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "新增用户账户失败");
|
||||
}
|
||||
return ResultUtils.success("插入成功");
|
||||
}
|
||||
|
||||
// @GetMapping("/delete")
|
||||
// public String delete(@RequestParam Long id) {
|
||||
// boolean removed = userAccountService.removeById(id);
|
||||
// return removed ? "删除成功" : "删除失败";
|
||||
|
||||
|
||||
// @GetMapping("/delete/{id}")
|
||||
// public String delete(@PathVariable Long id) {
|
||||
// boolean removed = userAccountService.removeById(id);
|
||||
// return removed ? "删除成功" : "删除失败";
|
||||
// }
|
||||
|
||||
|
||||
@PostMapping("/delete")
|
||||
public BaseResponse<String> delete(@RequestBody CommonRequest commonRequest){
|
||||
Long id = commonRequest.getId();
|
||||
if(id == null) throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数 id 不能为空");
|
||||
boolean removed = userAccountService.removeById(id);
|
||||
return ResultUtils.success(removed ? "删除成功" : "删除失败");
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<String> update(@RequestBody UserAccountUpdateRequest userAccountUpdateRequest){
|
||||
if (userAccountUpdateRequest == null || userAccountUpdateRequest.getId() == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "更新操作必须提供 ID");
|
||||
}
|
||||
UserAccount existing = userAccountService.getById(userAccountUpdateRequest.getId());
|
||||
if (existing == null) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "要更新的用户账户不存在");
|
||||
}
|
||||
UserAccount userAccount = new UserAccount();
|
||||
// userAccount.setId(userAccountUpdateRequest.getId());
|
||||
// userAccount.setOpenBank(userAccountUpdateRequest.getOpenBank());
|
||||
// userAccount.setPhoneNumber(userAccountUpdateRequest.getPhoneNumber());
|
||||
// userAccount.setCardHolder(userAccountUpdateRequest.getCardHolder());
|
||||
// userAccount.setIdCardNumber(userAccountUpdateRequest.getIdCardNumber());
|
||||
// userAccount.setUserId(1L);
|
||||
BeanUtils.copyProperties(userAccountUpdateRequest, userAccount);
|
||||
userAccountService.updateById(userAccount);
|
||||
boolean result = userAccountService.updateById(userAccount);
|
||||
if (!result) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "更新失败,请稍后再试");
|
||||
}
|
||||
return ResultUtils.success("更新成功");
|
||||
}
|
||||
|
||||
//根据id查询
|
||||
@PostMapping("/select")
|
||||
public BaseResponse<UserAccount> select(@RequestBody CommonRequest commonRequest){
|
||||
Long id = commonRequest.getId();
|
||||
if (id == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数 id 不能为空");
|
||||
}
|
||||
UserAccount selected = userAccountService.getById(id);
|
||||
if (selected == null) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "未找到对应的用户记录");
|
||||
}
|
||||
return ResultUtils.success(selected);
|
||||
}
|
||||
|
||||
@GetMapping("success")
|
||||
public BaseResponse<String> test() {
|
||||
for (int i = 0; i < 10; i ++ )
|
||||
System.out.println("运行了这个程序");
|
||||
String template = "运行程序";
|
||||
return ResultUtils.success(template);
|
||||
// return new BaseResponse<>(1, template, "ok");
|
||||
}
|
||||
|
||||
|
||||
//查询所有数据
|
||||
@PostMapping("/list")
|
||||
public BaseResponse<List<UserAccount>> list(){
|
||||
// 这里你可以根据 queryRequest 构造查询条件
|
||||
return ResultUtils.success(userAccountService.list());
|
||||
}
|
||||
|
||||
//分页查询
|
||||
// @PostMapping("/pagelist")
|
||||
// public BaseResponse<List<UserAccount>> pagelist(@RequestBody QueryRequest queryRequest){
|
||||
// System.out.println(queryRequest.toString());
|
||||
// Long start = queryRequest.getPagesize() * (queryRequest.getPagenum() - 1);
|
||||
// List<UserAccount> list = userAccountService.list();
|
||||
// List<UserAccount> newlist = list.subList(start.intValue(), start.intValue() + queryRequest.getPagesize().intValue());
|
||||
// return ResultUtils.success(newlist);
|
||||
// }
|
||||
@PostMapping("/pagelist")
|
||||
public BaseResponse<Page<UserAccount>> pagelist(@RequestBody QueryRequest queryRequest){
|
||||
Long pagesize = queryRequest.getPagesize();
|
||||
Long pagenum = queryRequest.getPagenum();
|
||||
Page<UserAccount> userAccountPage = new Page<>(pagenum, pagesize);//分页的规则
|
||||
Page<UserAccount> page = userAccountService.page(userAccountPage);//根据分页规则取出集合里对应的部分
|
||||
return ResultUtils.success(page);
|
||||
}
|
||||
|
||||
//根据IdCardnum查询
|
||||
@PostMapping("/idcardnumselect")
|
||||
public BaseResponse<UserAccount> idcardnumselect(@RequestBody IdCardNumRequest idCardNumRequest) throws Exception {
|
||||
String idcardnum = idCardNumRequest.getIdcardnum();
|
||||
// LambdaQueryWrapper<UserAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
QueryWrapper<UserAccount> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.eq(UserAccount::getIdCardNumber, idcardnum);
|
||||
queryWrapper.eq("idCardNumber", idcardnum);
|
||||
UserAccount userAccount = userAccountService.getOne(queryWrapper);
|
||||
if(userAccount == null) throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "这条记录不存在");
|
||||
// if(userAccount == null) ResultUtils.error(ErrorCode.NOT_FOUND_ERROR);
|
||||
return ResultUtils.success(userAccount);
|
||||
}
|
||||
|
||||
//根据phoneNumber,bankCardNumber
|
||||
@PostMapping("phonebankNumberselect")
|
||||
public BaseResponse<List<UserAccount>> phonebankselect(@RequestBody Toselect toselect){
|
||||
String phoneNumber = toselect.getPhoneNumber();
|
||||
String bankNumber = toselect.getBankNumber();
|
||||
LambdaQueryWrapper<UserAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserAccount::getPhoneNumber, phoneNumber);
|
||||
queryWrapper.eq(UserAccount::getBankCardNumber, bankNumber);
|
||||
List<UserAccount> list = userAccountService.list(queryWrapper);
|
||||
if (list == null || list.isEmpty()) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "没有符合条件的用户账户信息");
|
||||
}
|
||||
return ResultUtils.success(list);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private PromoCodeApplyService promoCodeApplyService;
|
||||
|
||||
@Resource
|
||||
private ProjectCommissionService projectCommissionService;
|
||||
|
||||
|
||||
@PostMapping("/queryByIds")
|
||||
public BaseResponse<List<ProjectCommission>> phonebankselectHello(){
|
||||
List<PromoCodeApply> list = promoCodeApplyService.list();
|
||||
List<Long> ids = list.stream().map(PromoCodeApply::getUserId).toList();
|
||||
LambdaQueryWrapper<ProjectCommission> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(ProjectCommission::getUserId, ids);
|
||||
List<ProjectCommission> projectCommissions = projectCommissionService.list(lambdaQueryWrapper);
|
||||
|
||||
return ResultUtils.success(projectCommissions);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @GetMapping("error")
|
||||
// public BaseResponse<String> error() throws Exception {
|
||||
//// String error = "空指针异常";
|
||||
// String template = null;
|
||||
// if (template == null) throw new Exception("空指针异常");
|
||||
// return ResultUtils.success("error");
|
||||
// }
|
||||
|
||||
}
|
@ -71,12 +71,6 @@ public class ProjectCommissionController {
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Resource
|
||||
private UserMainInfoService userMainInfoService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序用户查看查询项目的抽佣情况
|
||||
|
@ -15,6 +15,7 @@ import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailAddRequest
|
||||
import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailUpdateRequest;
|
||||
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionAddRequest;
|
||||
import com.greenorange.promotion.model.entity.*;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.model.vo.projectDetail.ProjectDetailVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.project.ProjectCommissionService;
|
||||
@ -92,7 +93,9 @@ public class ProjectDetailController {
|
||||
projectService.updateById(project);
|
||||
|
||||
// 获取所有的小程序用户
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE, userInfoService);
|
||||
LambdaQueryWrapper<UserInfo> miniUserInfoQueryWrapper = userInfoService.getMiniUserInfoQueryWrapper();
|
||||
List<UserInfo> userInfoList = userInfoService.list(miniUserInfoQueryWrapper);
|
||||
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
|
||||
// 封装Map(键:用户id, 值:抽佣比例)
|
||||
Map<Long, BigDecimal> userCommissionRateMap = new HashMap<>();
|
||||
|
@ -1,17 +0,0 @@
|
||||
package com.greenorange.promotion.controller.projectSettlement;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
public class Addqurrywithdraw {
|
||||
private Long userid;
|
||||
private BigDecimal payouts;
|
||||
}
|
@ -2,18 +2,20 @@ package com.greenorange.promotion.controller.projectSettlement;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.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.userAccount.UserAccountQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
|
||||
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.FundsItemVO;
|
||||
import com.greenorange.promotion.model.vo.userAccount.UserAccountConditionVO;
|
||||
@ -22,19 +24,15 @@ import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.settle.FundsChangeService;
|
||||
import com.greenorange.promotion.service.settle.UserAccountService;
|
||||
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Priority;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
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.RestController;
|
||||
|
||||
@ -51,46 +49,148 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Tag(name = "提现申请记录管理")
|
||||
public class WithdrawalApplyController {
|
||||
@Resource
|
||||
private UserAccountService userAccountService;
|
||||
@Resource
|
||||
private UserMainInfoService userMainInfoService;
|
||||
|
||||
@Resource
|
||||
private WithdrawalApplyService withdrawalApplyService;
|
||||
|
||||
@Resource
|
||||
private FundsChangeService fundsChangeService;
|
||||
|
||||
@PostMapping("addqurry")
|
||||
public BaseResponse<String> addqurry(@RequestBody Addqurrywithdraw addqurrywithdraw ){
|
||||
Long userid = addqurrywithdraw.getUserid();
|
||||
BigDecimal payouts = addqurrywithdraw.getPayouts();
|
||||
LambdaQueryWrapper<UserMainInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserMainInfo::getUserId, userid);
|
||||
UserMainInfo one = userMainInfoService.getOne(queryWrapper);
|
||||
BigDecimal currentBalance = one.getCurrentBalance();
|
||||
if(payouts.compareTo(currentBalance) > 0) throw new BusinessException(ErrorCode.OPERATION_ERROR,"提现金额超过当前的余额");
|
||||
LambdaQueryWrapper<UserAccount> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.eq(UserAccount::getUserId, userid);
|
||||
UserAccount two = userAccountService.getOne(queryWrapper2);
|
||||
WithdrawalApply withdrawalApply = new WithdrawalApply();
|
||||
BeanUtils.copyProperties(two, withdrawalApply);
|
||||
withdrawalApply.setId(null);
|
||||
withdrawalApply.setUpdateTime(null);
|
||||
withdrawalApply.setCreateTime(null);
|
||||
withdrawalApply.setWithdrawnAmount(payouts);
|
||||
withdrawalApply.setWithdrawalStatus("processing");
|
||||
withdrawalApplyService.save(withdrawalApply);
|
||||
BigDecimal subtract = currentBalance.subtract(payouts);
|
||||
one.setCurrentBalance(subtract);
|
||||
userMainInfoService.updateById(one);
|
||||
FundsChange fundsChange = new FundsChange();
|
||||
fundsChange.setUserId(userid);
|
||||
fundsChange.setChangeAmount(payouts);
|
||||
fundsChange.setProjectName("processing");
|
||||
fundsChange.setCurrentAmount(subtract);
|
||||
fundsChange.setProjectSettlementId(0L);
|
||||
fundsChangeService.save(fundsChange);
|
||||
return ResultUtils.success("提现成功");
|
||||
}
|
||||
}
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@Resource
|
||||
private UserMainInfoService userMainInfoService;
|
||||
|
||||
@Resource
|
||||
private UserAccountService userAccountService;
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询账户提现状况
|
||||
* @return 提现申请记录id
|
||||
*/
|
||||
@PostMapping("query/condition")
|
||||
@Operation(summary = "小程序端用户查询账户提现状况", description = "参数:无,权限:管理员,方法名:queryWithdrawalCondition")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<UserAccountConditionVO> queryWithdrawalCondition(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
||||
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserAccount::getUserId, userId, userAccountService);
|
||||
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
|
||||
String bankCardNumber = userAccount == null ? "" : userAccount.getBankCardNumber();
|
||||
UserAccountConditionVO userAccountConditionVO = UserAccountConditionVO.builder()
|
||||
.currentBalance(userMainInfo.getCurrentBalance())
|
||||
.bankCardNumber(bankCardNumber)
|
||||
.build();
|
||||
return ResultUtils.success(userAccountConditionVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户申请提现
|
||||
* @param withdrawalApplyAddRequest 提现申请记录查添加请求体
|
||||
* @return 提现申请记录id
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序端用户申请提现", description = "参数:提现申请记录查添加请求体,权限:管理员,方法名:addWithdrawalApply")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "提现申请记录管理", content = "小程序端用户申请提现")
|
||||
public BaseResponse<Long> addWithdrawalApply(@Valid @RequestBody WithdrawalApplyAddRequest withdrawalApplyAddRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserAccount::getUserId, userId, userAccountService);
|
||||
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(userAccount == null, ErrorCode.OPERATION_ERROR, "请先绑定银行卡");
|
||||
BigDecimal withdrawnAmount = withdrawalApplyAddRequest.getWithdrawnAmount();
|
||||
WithdrawalApply withdrawalApply = WithdrawalApply.builder()
|
||||
.withdrawnAmount(withdrawnAmount)
|
||||
.cardHolder(userAccount.getCardHolder())
|
||||
.idCardNumber(userAccount.getIdCardNumber())
|
||||
.phoneNumber(userAccount.getPhoneNumber())
|
||||
.bankCardNumber(userAccount.getBankCardNumber())
|
||||
.openBank(userAccount.getOpenBank())
|
||||
.userId(userId)
|
||||
.build();
|
||||
withdrawalApplyService.save(withdrawalApply);
|
||||
// 修改个人主要信息
|
||||
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
||||
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||
userMainInfo.setWithdrawalAmount(userMainInfo.getWithdrawalAmount().add(withdrawnAmount));
|
||||
userMainInfo.setCurrentBalance(userMainInfo.getCurrentBalance().subtract(withdrawnAmount));
|
||||
userMainInfoService.updateById(userMainInfo);
|
||||
// 添加资金明细记录
|
||||
FundsChange fundsChange = FundsChange.builder()
|
||||
.projectName("用户提现")
|
||||
.changeAmount(withdrawnAmount.negate())
|
||||
.currentAmount(userMainInfo.getCurrentBalance())
|
||||
.userId(userId)
|
||||
.projectSettlementId(0L)
|
||||
.build();
|
||||
fundsChangeService.save(fundsChange);
|
||||
return ResultUtils.success(withdrawalApply.getId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询提现申请记录
|
||||
* @return 提现申请记录列表
|
||||
*/
|
||||
@PostMapping("query")
|
||||
@Operation(summary = "小程序端用户查询提现申请记录", description = "参数:无,权限:管理员,方法名:queryWithdrawalApplyByUserId")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "提现申请记录管理", content = "小程序端用户查询提现申请记录")
|
||||
public BaseResponse<List<WithdrawalApplyVO>> queryWithdrawalApplyByUserId(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
List<WithdrawalApply> withdrawalApplyList = commonService.findByFieldEqTargetField(WithdrawalApply::getUserId, userId, withdrawalApplyService);
|
||||
List<WithdrawalApplyVO> withdrawalApplyVOS = commonService.convertList(withdrawalApplyList, WithdrawalApplyVO.class);
|
||||
Collections.reverse(withdrawalApplyVOS);
|
||||
return ResultUtils.success(withdrawalApplyVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询资金变动记录
|
||||
* @return 提现申请记录id
|
||||
*/
|
||||
@PostMapping("query/change")
|
||||
@Operation(summary = "小程序端用户查询资金变动记录", description = "参数:无,权限:管理员,方法名:queryFundsChangeByUserId")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "提现申请记录管理", content = "小程序端用户查询资金变动记录")
|
||||
public BaseResponse<FundsItemVO> queryFundsChangeByUserId(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
||||
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||
FundsItemVO fundsItemVO = commonService.copyProperties(userMainInfo, FundsItemVO.class);
|
||||
List<FundsChange> fundsChangeList = commonService.findByFieldEqTargetField(FundsChange::getUserId, userId, fundsChangeService);
|
||||
List<FundsChangeVO> fundsChangeVOS = commonService.convertList(fundsChangeList, FundsChangeVO.class);
|
||||
Collections.reverse(fundsChangeVOS);
|
||||
fundsItemVO.setFundsChangeVOList(fundsChangeVOS);
|
||||
return ResultUtils.success(fundsItemVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询提现申请记录
|
||||
* @param withdrawalApplyQueryRequest 提现申请记录查询请求体
|
||||
* @return 提现申请记录列表
|
||||
*/
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询提现申请记录", description = "参数:提现申请记录查询请求体,权限:管理员,方法名:listWithdrawalApplyByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "提现申请记录管理", content = "Web端管理员分页查询提现申请记录")
|
||||
public BaseResponse<Page<WithdrawalApplyVO>> listWithdrawalApplyByPage(@Valid @RequestBody WithdrawalApplyQueryRequest withdrawalApplyQueryRequest) {
|
||||
long current = withdrawalApplyQueryRequest.getCurrent();
|
||||
long pageSize = withdrawalApplyQueryRequest.getPageSize();
|
||||
QueryWrapper<WithdrawalApply> queryWrapper = withdrawalApplyService.getQueryWrapper(withdrawalApplyQueryRequest);
|
||||
Page<WithdrawalApply> page = withdrawalApplyService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<WithdrawalApply> withdrawalApplyList = page.getRecords();
|
||||
List<WithdrawalApplyVO> withdrawalApplyVOList = commonService.convertList(withdrawalApplyList, WithdrawalApplyVO.class);
|
||||
Page<WithdrawalApplyVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(withdrawalApplyVOList);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
}
|
@ -0,0 +1,219 @@
|
||||
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 = "参数:晋升申请记录id,权限:管理员,方法名: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);
|
||||
}
|
||||
}
|
@ -1,17 +1,11 @@
|
||||
package com.greenorange.promotion.controller.userInfo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
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.userAccount.UserAccountAddRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.UserAccount;
|
||||
import com.greenorange.promotion.model.vo.userAccount.UserAccountVO;
|
||||
@ -21,17 +15,13 @@ 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 com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户账户 控制器
|
||||
|
@ -10,7 +10,6 @@ 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;
|
||||
@ -31,7 +30,6 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.io.JBoss6VFS;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -305,14 +303,6 @@ public class UserInfoController {
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员添加用户")
|
||||
public BaseResponse<Boolean> addUserInfo(@Valid @RequestBody UserInfoAddRequest userInfoAddRequest) {
|
||||
String userAccount = userInfoAddRequest.getUserAccount();
|
||||
String userPassword = userInfoAddRequest.getUserPassword();
|
||||
LambdaQueryWrapper<UserInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserInfo::getUserRole,"boss");
|
||||
UserInfo one = userInfoService.getOne(queryWrapper);
|
||||
String userAccount2 = one.getUserAccount();
|
||||
String userPassword2 = one.getUserPassword();
|
||||
if(userAccount2.equals(userAccount) && userPassword2.equals(userPassword)) throw new BusinessException(ErrorCode.OPERATION_ERROR,"不能添加跟boss重名的账号和密码");
|
||||
UserInfo userInfo = commonService.copyProperties(userInfoAddRequest, UserInfo.class);
|
||||
userInfo.setParentUserId(-1L);
|
||||
userInfo.setUserRole(UserConstant.ADMIN_ROLE);
|
||||
|
@ -113,104 +113,4 @@ public class UserMainInfoController {
|
||||
return ResultUtils.success(userTeamInfoVO);
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * web端管理员添加用户主要信息
|
||||
// * @param userMainInfoAddRequest 用户主要信息添加请求体
|
||||
// * @return 是否添加成功
|
||||
// */
|
||||
// @PostMapping("add")
|
||||
// @Operation(summary = "web端管理员添加用户主要信息", description = "参数:用户主要信息添加请求体,权限:管理员,方法名:addUserMainInfo")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "用户主要信息管理", content = "web端管理员添加用户主要信息")
|
||||
// public BaseResponse<Boolean> addUserMainInfo(@Valid @RequestBody UserMainInfoAddRequest userMainInfoAddRequest) {
|
||||
// UserMainInfo userMainInfo = commonService.copyProperties(userMainInfoAddRequest, UserMainInfo.class);
|
||||
// userMainInfoService.save(userMainInfo);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id修改用户主要信息信息
|
||||
// * @param userMainInfoUpdateRequest 用户主要信息更新请求体
|
||||
// * @return 是否更新成功
|
||||
// */
|
||||
// @PostMapping("update")
|
||||
// @Operation(summary = "web端管理员更新用户主要信息", description = "参数:用户主要信息更新请求体,权限:管理员,方法名:updateUserMainInfo")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "用户主要信息管理", content = "web端管理员根据id修改用户主要信息信息")
|
||||
// public BaseResponse<Boolean> updateUserMainInfo(@Valid @RequestBody UserMainInfoUpdateRequest userMainInfoUpdateRequest) {
|
||||
// UserMainInfo userMainInfo = commonService.copyProperties(userMainInfoUpdateRequest, UserMainInfo.class);
|
||||
// userMainInfoService.updateById(userMainInfo);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id删除用户主要信息
|
||||
// * @param commonRequest 用户主要信息删除请求体
|
||||
// * @return 是否删除成功
|
||||
// */
|
||||
// @PostMapping("delete")
|
||||
// @Operation(summary = "web端管理员根据id删除用户主要信息", description = "参数:用户主要信息删除请求体,权限:管理员,方法名:delUserMainInfo")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "用户主要信息管理", content = "web端管理员根据id删除用户主要信息")
|
||||
// public BaseResponse<Boolean> delUserMainInfo(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long id = commonRequest.getId();
|
||||
// userMainInfoService.removeById(id);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * web端管理员批量删除用户主要信息
|
||||
// * @param commonBatchRequest 用户主要信息批量删除请求体
|
||||
// * @return 是否删除成功
|
||||
// */
|
||||
// @PostMapping("delBatch")
|
||||
// @Operation(summary = "web端管理员批量删除用户主要信息", description = "参数:用户主要信息批量删除请求体,权限:管理员,方法名:delBatchUserMainInfo")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "用户主要信息管理", content = "web端管理员批量删除用户主要信息")
|
||||
// public BaseResponse<Boolean> delBatchUserMainInfo(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
// List<Long> ids = commonBatchRequest.getIds();
|
||||
// userMainInfoService.removeByIds(ids);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id查询用户主要信息
|
||||
// * @param commonRequest 用户主要信息查询请求体
|
||||
// * @return 用户主要信息信息
|
||||
// */
|
||||
// @PostMapping("queryById")
|
||||
// @Operation(summary = "web端管理员根据id查询用户主要信息", description = "参数:用户主要信息查询请求体,权限:管理员,方法名:queryUserMainInfoById")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "用户主要信息管理", content = "web端管理员根据id查询用户主要信息")
|
||||
// public BaseResponse<UserMainInfoVO> queryUserMainInfoById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long id = commonRequest.getId();
|
||||
// UserMainInfo userMainInfo = userMainInfoService.getById(id);
|
||||
// ThrowUtils.throwIf(userMainInfo == null, ErrorCode.OPERATION_ERROR, "当前用户主要信息不存在");
|
||||
// UserMainInfoVO userMainInfoVO = commonService.copyProperties(userMainInfo, UserMainInfoVO.class);
|
||||
// return ResultUtils.success(userMainInfoVO);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Web端管理员分页查询用户主要信息
|
||||
// * @param userMainInfoQueryRequest 用户主要信息查询请求体
|
||||
// * @return 用户主要信息列表
|
||||
// */
|
||||
// @PostMapping("page")
|
||||
// @Operation(summary = "Web端管理员分页查询用户主要信息", description = "参数:用户主要信息查询请求体,权限:管理员,方法名:listUserMainInfoByPage")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "用户主要信息管理", content = "Web端管理员分页查询用户主要信息")
|
||||
// public BaseResponse<Page<UserMainInfoVO>> listUserMainInfoByPage(@Valid @RequestBody UserMainInfoQueryRequest userMainInfoQueryRequest) {
|
||||
// long current = userMainInfoQueryRequest.getCurrent();
|
||||
// long pageSize = userMainInfoQueryRequest.getPageSize();
|
||||
// QueryWrapper<UserMainInfo> queryWrapper = userMainInfoService.getQueryWrapper(userMainInfoQueryRequest);
|
||||
// Page<UserMainInfo> page = userMainInfoService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
// List<UserMainInfo> userMainInfoList = page.getRecords();
|
||||
// List<UserMainInfoVO> userMainInfoVOList = commonService.convertList(userMainInfoList, UserMainInfoVO.class);
|
||||
// Page<UserMainInfoVO> voPage = new Page<>(current, pageSize);
|
||||
// voPage.setRecords(userMainInfoVOList);
|
||||
// voPage.setPages(page.getPages());
|
||||
// voPage.setTotal(page.getTotal());
|
||||
// return ResultUtils.success(voPage);
|
||||
// }
|
||||
}
|
@ -65,19 +65,19 @@ public class WechatGetQrcodeController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序获取课程码
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@Hidden
|
||||
@PostMapping("/get/course/qrcode")
|
||||
@Operation(summary = "微信小程序获取课程码", description = "参数:无, 权限:所有人, 方法名:getCourseQrcode")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<String> getCourseQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||
String view = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
||||
return ResultUtils.success(view);
|
||||
}
|
||||
// /**
|
||||
// * 微信小程序获取课程码
|
||||
// * @return
|
||||
// * @throws IOException
|
||||
// */
|
||||
// @Hidden
|
||||
// @PostMapping("/get/course/qrcode")
|
||||
// @Operation(summary = "微信小程序获取课程码", description = "参数:无, 权限:所有人, 方法名:getCourseQrcode")
|
||||
//// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// public BaseResponse<String> getCourseQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||
// String view = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
||||
// return ResultUtils.success(view);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
@ -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 = "CourseOrder";
|
||||
private static final String ENTITY_NAME = "AdvancementApply";
|
||||
// 表名
|
||||
private static final String TABLE_NAME = "course_order";
|
||||
private static final String TABLE_NAME = "advancement_apply";
|
||||
// 实体类属性名
|
||||
private static final String ENTITY_NAME_LOWER = "courseOrder";
|
||||
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> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
@ -19,12 +19,9 @@ import java.io.Serializable;
|
||||
"name",
|
||||
"type",
|
||||
"detail",
|
||||
"promoCodeDesc",
|
||||
"image",
|
||||
"originPrice",
|
||||
"discountPrice",
|
||||
"firstLevelRate",
|
||||
"secondLevelRate",
|
||||
"discountPrice"
|
||||
})
|
||||
public class CourseAddRequest implements Serializable {
|
||||
|
||||
@ -36,11 +33,11 @@ public class CourseAddRequest implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
* 课程类别[考公,财经]
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
@ -50,13 +47,6 @@ public class CourseAddRequest implements Serializable {
|
||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||
private String detail;
|
||||
|
||||
/**
|
||||
* 推广码说明(富文本)
|
||||
*/
|
||||
@NotBlank(message = "推广码说明(富文本)不能为空")
|
||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
||||
private String promoCodeDesc;
|
||||
|
||||
/**
|
||||
* 课程图片URL
|
||||
*/
|
||||
@ -78,20 +68,6 @@ public class CourseAddRequest implements Serializable {
|
||||
@Schema(description = "折扣价格", example = "2499")
|
||||
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
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -28,10 +28,10 @@ public class CourseQueryRequest extends PageRequest implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
* 课程类别[考公,财经]
|
||||
*/
|
||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
|
||||
|
@ -22,13 +22,10 @@ import java.io.Serializable;
|
||||
"name",
|
||||
"type",
|
||||
"detail",
|
||||
"promoCodeDesc",
|
||||
"image",
|
||||
"originPrice",
|
||||
"discountPrice",
|
||||
"orderCount",
|
||||
"firstLevelRate",
|
||||
"secondLevelRate",
|
||||
"orderCount"
|
||||
})
|
||||
public class CourseUpdateRequest implements Serializable {
|
||||
|
||||
@ -47,11 +44,11 @@ public class CourseUpdateRequest implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
* 课程类别[考公,财经]
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
@ -61,13 +58,6 @@ public class CourseUpdateRequest implements Serializable {
|
||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||
private String detail;
|
||||
|
||||
/**
|
||||
* 推广码说明(富文本)
|
||||
*/
|
||||
@NotBlank(message = "推广码说明(富文本)不能为空")
|
||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
||||
private String promoCodeDesc;
|
||||
|
||||
/**
|
||||
* 课程图片URL
|
||||
*/
|
||||
@ -95,20 +85,6 @@ public class CourseUpdateRequest implements Serializable {
|
||||
@Schema(description = "已下单人数", example = "100")
|
||||
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
|
||||
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;
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -4,49 +4,57 @@ 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 advancement_apply
|
||||
*/
|
||||
@TableName(value ="course_chapter")
|
||||
@TableName(value ="advancement_apply")
|
||||
@Data
|
||||
public class CourseChapter implements Serializable {
|
||||
public class AdvancementApply implements Serializable {
|
||||
/**
|
||||
* 章节ID
|
||||
* 晋升申请id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 章节名称
|
||||
* 申请人姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 章节时长(格式可自定义,如"00:10:00")
|
||||
* 申请人手机号
|
||||
*/
|
||||
private Long duration;
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
||||
* 简历
|
||||
*/
|
||||
private String permissions;
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 视频文件 view 值
|
||||
* 查询凭证
|
||||
*/
|
||||
private String videoView;
|
||||
private String credential;
|
||||
|
||||
/**
|
||||
* 所属课程ID
|
||||
* 审核状态
|
||||
*/
|
||||
private Long courseId;
|
||||
private String reviewStatus;
|
||||
|
||||
/**
|
||||
* 拒绝理由
|
||||
*/
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 用户id(申请成功后获得)
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
@ -63,7 +71,6 @@ public class CourseChapter implements Serializable {
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@Serial
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -28,7 +28,7 @@ public class Course implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
* 课程类别[考公,财经]
|
||||
*/
|
||||
private String type;
|
||||
|
||||
@ -37,11 +37,6 @@ public class Course implements Serializable {
|
||||
*/
|
||||
private String detail;
|
||||
|
||||
/**
|
||||
* 推广码说明(富文本)
|
||||
*/
|
||||
private String promoCodeDesc;
|
||||
|
||||
/**
|
||||
* 课程图片URL
|
||||
*/
|
||||
@ -62,16 +57,6 @@ public class Course implements Serializable {
|
||||
*/
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 一级佣金比例(%)
|
||||
*/
|
||||
private BigDecimal firstLevelRate;
|
||||
|
||||
/**
|
||||
* 二级佣金比例(%)
|
||||
*/
|
||||
private BigDecimal secondLevelRate;
|
||||
|
||||
/**
|
||||
* 是否上架(true:上架,false:下架)
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
@ -18,6 +18,9 @@ import lombok.NoArgsConstructor;
|
||||
*/
|
||||
@TableName(value ="user_info")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class UserInfo implements Serializable {
|
||||
/**
|
||||
* 用户ID
|
||||
|
@ -14,8 +14,7 @@ import java.util.stream.Collectors;
|
||||
@Getter
|
||||
public enum CourseTypeEnum implements BaseEnum {
|
||||
|
||||
KAOGONGKAOYAN("考公考研"),
|
||||
ZIMEITI("自媒体"),
|
||||
KAOGONG("考公"),
|
||||
CAIJING("财经");
|
||||
|
||||
private final String value;
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -24,9 +24,9 @@ public class CourseCardVO implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
* 课程类别[考公,财经]
|
||||
*/
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
|
@ -1,13 +1,11 @@
|
||||
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
|
||||
@ -27,9 +25,9 @@ public class CourseDetailVO implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
* 课程类别[考公,财经]
|
||||
*/
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
@ -38,12 +36,6 @@ public class CourseDetailVO implements Serializable {
|
||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||
private String detail;
|
||||
|
||||
/**
|
||||
* 推广码说明(富文本)
|
||||
*/
|
||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
||||
private String promoCodeDesc;
|
||||
|
||||
/**
|
||||
* 课程图片URL
|
||||
*/
|
||||
@ -62,12 +54,6 @@ public class CourseDetailVO implements Serializable {
|
||||
@Schema(description = "折扣价格", example = "2499")
|
||||
private BigDecimal discountPrice;
|
||||
|
||||
/**
|
||||
* 课程章节
|
||||
*/
|
||||
@Schema(description = "课程章节")
|
||||
private List<CourseChapterVO> courseChapters;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -27,9 +27,9 @@ public class CourseVO implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别[考公考研,自媒体,财经]
|
||||
* 课程类别[考公,财经]
|
||||
*/
|
||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
||||
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
@ -38,12 +38,6 @@ public class CourseVO implements Serializable {
|
||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||
private String detail;
|
||||
|
||||
/**
|
||||
* 推广码说明(富文本)
|
||||
*/
|
||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
||||
private String promoCodeDesc;
|
||||
|
||||
/**
|
||||
* 课程图片URL
|
||||
*/
|
||||
@ -68,18 +62,6 @@ public class CourseVO implements Serializable {
|
||||
@Schema(description = "已下单人数", example = "100")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 一级佣金比例(%)
|
||||
*/
|
||||
@Schema(description = "一级佣金比例(%)", example = "10")
|
||||
private BigDecimal firstLevelRate;
|
||||
|
||||
/**
|
||||
* 二级佣金比例(%)
|
||||
*/
|
||||
@Schema(description = "二级佣金比例(%)", example = "5")
|
||||
private BigDecimal secondLevelRate;
|
||||
|
||||
/**
|
||||
* 是否上架(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{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
@ -69,4 +72,27 @@ public interface UserInfoService extends IService<UserInfo> {
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
/**
|
||||
* 获取小程序用户的查询条件
|
||||
*/
|
||||
LambdaQueryWrapper<UserInfo> getMiniUserInfoQueryWrapper();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -12,14 +12,17 @@ import com.greenorange.promotion.constant.SystemConstant;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
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 +31,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 +38,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 +89,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
private ProjectDetailService projectDetailService;
|
||||
|
||||
|
||||
@Resource
|
||||
private AdvancementApplyService advancementApplyService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -131,6 +135,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序用户注册
|
||||
*/
|
||||
@ -138,87 +146,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 +206,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 +229,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 +282,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序用户获取验证码(用于注册)
|
||||
*/
|
||||
@ -360,6 +303,184 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取小程序用户的查询条件
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryWrapper<UserInfo> getMiniUserInfoQueryWrapper() {
|
||||
LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userInfoLambdaQueryWrapper.in(UserInfo::getUserRole, UserRoleEnum.USER, UserRoleEnum.MANAGER, UserRoleEnum.SUPERVISOR, UserRoleEnum.STAFF);
|
||||
return userInfoLambdaQueryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据邀请码获得上级用户信息
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,8 +26,8 @@ public interface WechatGetQrcodeService {
|
||||
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.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;
|
||||
@ -74,15 +71,6 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||
@Resource
|
||||
private FileInfoService fileInfoService;
|
||||
|
||||
@Resource
|
||||
private UserInfoMapper userInfoMapper;
|
||||
|
||||
@Resource
|
||||
private CourseService courseService;
|
||||
|
||||
@Resource
|
||||
private CourseQrcodeApplyService courseQrcodeApplyService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取接口调用凭据
|
||||
@ -207,146 +195,138 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序获取课程码
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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=" + invitationCode + "&courseId=" + courseId);
|
||||
param.put("width", 430);
|
||||
param.put("check_path", false);
|
||||
param.put("env_version", "develop");
|
||||
String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
|
||||
String jsonParams = JSONUtil.toJsonStr(param);
|
||||
byte[] responseBytes = HttpUtil.createPost(url)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(jsonParams)
|
||||
.execute()
|
||||
.bodyBytes();
|
||||
|
||||
String FontType = "Microsoft YaHei UI";
|
||||
int FontStyle = Font.PLAIN;
|
||||
|
||||
// 加载一张空白图像
|
||||
String blankUrl = "https://img.picui.cn/free/2025/06/21/6856a072e9eea.png";
|
||||
ImageCombiner combiner = new ImageCombiner(blankUrl, 341, 391, ZoomMode.WidthHeight, OutputFormat.PNG);
|
||||
|
||||
// 加载课程图片
|
||||
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));
|
||||
|
||||
// 缩放图片(不失真)
|
||||
Image scaledImage = qrImage.getScaledInstance(134, 134, Image.SCALE_SMOOTH);
|
||||
BufferedImage resizedImage = new BufferedImage(134, 134, BufferedImage.TYPE_INT_RGB);
|
||||
resizedImage.getGraphics().drawImage(scaledImage, 0, 0, null);
|
||||
|
||||
combiner.setQuality(1f);
|
||||
|
||||
// 将课程图片合并到组合器中
|
||||
combiner.addImageElement(courseImage, 18, 16, 306, 158, ZoomMode.WidthHeight).setRoundCorner(5).setCenter(true);
|
||||
// 将二维码图片合并到组合器中
|
||||
combiner.addImageElement(resizedImage, 190, 240);
|
||||
|
||||
// 绘制文本
|
||||
TextElement courseTitleElement = new TextElement(courseTitle, FontType, FontStyle, 18, 20, 186);
|
||||
courseTitleElement.setColor(Color.decode("#323232"))
|
||||
.setCenter(true)
|
||||
.setAutoBreakLine(306);
|
||||
combiner.addElement(courseTitleElement);
|
||||
|
||||
TextElement originalPriceElement = new TextElement(originalPrice, FontType, FontStyle, 24, 56, 275);
|
||||
originalPriceElement.setColor(Color.decode("#8C8C8C")).setStrikeThrough(true);
|
||||
combiner.addElement(originalPriceElement);
|
||||
|
||||
TextElement discountedPriceElement = new TextElement(discountPrice, FontType, Font.BOLD, 28, 31, 343);
|
||||
discountedPriceElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base).setSpace(0.01f);
|
||||
combiner.addElement(discountedPriceElement);
|
||||
|
||||
TextElement discountedTextElement = new TextElement(discountText, FontType, FontStyle, 16, discountedPriceElement.getX() + discountedPriceElement.getWidth(), 341);
|
||||
discountedTextElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base);
|
||||
combiner.addElement(discountedTextElement);
|
||||
|
||||
combiner.combine();
|
||||
|
||||
InputStream resultStream = combiner.getCombinedImageStream();
|
||||
byte[] resultBytes = resultStream.readAllBytes();
|
||||
// 创建上传目录,如果不存在
|
||||
String biz = "default";
|
||||
String fileName = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "." + "png";
|
||||
// 获取文件类型
|
||||
String fileType = FileUtil.getSuffix(fileName);
|
||||
// 获取view值
|
||||
String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
||||
File file = new File(uploadDir + fileName);
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();// 如果路径不存在则创建
|
||||
}
|
||||
// 将文件上传到目标位置
|
||||
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE)) {
|
||||
bos.write(resultBytes);
|
||||
} catch (IOException e) {
|
||||
throw new BusinessException(ErrorCode.OPERATION_ERROR, "文件上传失败,失败原因:" + e.getMessage());
|
||||
}
|
||||
|
||||
// 获取文件大小
|
||||
Double fileSize = file.length() / 1024.0;
|
||||
fileSize = Double.valueOf(String.format("%.2f", fileSize));
|
||||
// 获取文件哈希值
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
String hashValue = DigestUtils.sha256Hex(inputStream);
|
||||
// 保存文件
|
||||
FileInfo fileInfo = FileInfo.builder()
|
||||
.name(fileName)
|
||||
.type(fileType)
|
||||
.size(fileSize)
|
||||
.fileView(view)
|
||||
.biz(biz)
|
||||
.hashValue(hashValue)
|
||||
.build();
|
||||
fileInfoService.save(fileInfo);
|
||||
|
||||
String viewValue = biz + "-" + view;
|
||||
// 保存课程推广码申请记录
|
||||
CourseQrcodeApply courseQrcodeApply = CourseQrcodeApply.builder()
|
||||
.userId(userId)
|
||||
.courseId(courseId)
|
||||
.courseQrcode(viewValue)
|
||||
.build();
|
||||
courseQrcodeApplyService.save(courseQrcodeApply);
|
||||
return viewValue;
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 微信小程序获取课程码
|
||||
// */
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// 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=" + invitationCode + "&courseId=" + courseId);
|
||||
// param.put("width", 430);
|
||||
// param.put("check_path", false);
|
||||
// param.put("env_version", "develop");
|
||||
// String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
|
||||
// String jsonParams = JSONUtil.toJsonStr(param);
|
||||
// byte[] responseBytes = HttpUtil.createPost(url)
|
||||
// .header("Content-Type", "application/json")
|
||||
// .body(jsonParams)
|
||||
// .execute()
|
||||
// .bodyBytes();
|
||||
//
|
||||
// String FontType = "Microsoft YaHei UI";
|
||||
// int FontStyle = Font.PLAIN;
|
||||
//
|
||||
// // 加载一张空白图像
|
||||
// String blankUrl = "https://img.picui.cn/free/2025/06/21/6856a072e9eea.png";
|
||||
// ImageCombiner combiner = new ImageCombiner(blankUrl, 341, 391, ZoomMode.WidthHeight, OutputFormat.PNG);
|
||||
//
|
||||
// // 加载课程图片
|
||||
// String courseUrl = SystemConstant.FILE_COMMON_PREFIX + course.getImage();
|
||||
// BufferedImage courseImage = ImageIO.read(new URL(courseUrl));
|
||||
//
|
||||
// // 将二维码数据转换为 BufferedImage
|
||||
// BufferedImage qrImage = ImageIO.read(new ByteArrayInputStream(responseBytes));
|
||||
//
|
||||
// // 缩放图片(不失真)
|
||||
// Image scaledImage = qrImage.getScaledInstance(134, 134, Image.SCALE_SMOOTH);
|
||||
// BufferedImage resizedImage = new BufferedImage(134, 134, BufferedImage.TYPE_INT_RGB);
|
||||
// resizedImage.getGraphics().drawImage(scaledImage, 0, 0, null);
|
||||
//
|
||||
// combiner.setQuality(1f);
|
||||
//
|
||||
// // 将课程图片合并到组合器中
|
||||
// combiner.addImageElement(courseImage, 18, 16, 306, 158, ZoomMode.WidthHeight).setRoundCorner(5).setCenter(true);
|
||||
// // 将二维码图片合并到组合器中
|
||||
// combiner.addImageElement(resizedImage, 190, 240);
|
||||
//
|
||||
// // 绘制文本
|
||||
// TextElement courseTitleElement = new TextElement(courseTitle, FontType, FontStyle, 18, 20, 186);
|
||||
// courseTitleElement.setColor(Color.decode("#323232"))
|
||||
// .setCenter(true)
|
||||
// .setAutoBreakLine(306);
|
||||
// combiner.addElement(courseTitleElement);
|
||||
//
|
||||
// TextElement originalPriceElement = new TextElement(originalPrice, FontType, FontStyle, 24, 56, 275);
|
||||
// originalPriceElement.setColor(Color.decode("#8C8C8C")).setStrikeThrough(true);
|
||||
// combiner.addElement(originalPriceElement);
|
||||
//
|
||||
// TextElement discountedPriceElement = new TextElement(discountPrice, FontType, Font.BOLD, 28, 31, 343);
|
||||
// discountedPriceElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base).setSpace(0.01f);
|
||||
// combiner.addElement(discountedPriceElement);
|
||||
//
|
||||
// TextElement discountedTextElement = new TextElement(discountText, FontType, FontStyle, 16, discountedPriceElement.getX() + discountedPriceElement.getWidth(), 341);
|
||||
// discountedTextElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base);
|
||||
// combiner.addElement(discountedTextElement);
|
||||
//
|
||||
// combiner.combine();
|
||||
//
|
||||
// InputStream resultStream = combiner.getCombinedImageStream();
|
||||
// byte[] resultBytes = resultStream.readAllBytes();
|
||||
// // 创建上传目录,如果不存在
|
||||
// String biz = "default";
|
||||
// String fileName = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "." + "png";
|
||||
// // 获取文件类型
|
||||
// String fileType = FileUtil.getSuffix(fileName);
|
||||
// // 获取view值
|
||||
// String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
||||
// File file = new File(uploadDir + fileName);
|
||||
// if (!file.getParentFile().exists()) {
|
||||
// file.getParentFile().mkdirs();// 如果路径不存在则创建
|
||||
// }
|
||||
// // 将文件上传到目标位置
|
||||
// try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE)) {
|
||||
// bos.write(resultBytes);
|
||||
// } catch (IOException e) {
|
||||
// throw new BusinessException(ErrorCode.OPERATION_ERROR, "文件上传失败,失败原因:" + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// // 获取文件大小
|
||||
// Double fileSize = file.length() / 1024.0;
|
||||
// fileSize = Double.valueOf(String.format("%.2f", fileSize));
|
||||
// // 获取文件哈希值
|
||||
// InputStream inputStream = new FileInputStream(file);
|
||||
// String hashValue = DigestUtils.sha256Hex(inputStream);
|
||||
// // 保存文件
|
||||
// FileInfo fileInfo = FileInfo.builder()
|
||||
// .name(fileName)
|
||||
// .type(fileType)
|
||||
// .size(fileSize)
|
||||
// .fileView(view)
|
||||
// .biz(biz)
|
||||
// .hashValue(hashValue)
|
||||
// .build();
|
||||
// fileInfoService.save(fileInfo);
|
||||
//
|
||||
// String viewValue = biz + "-" + view;
|
||||
// // 保存课程推广码申请记录
|
||||
// CourseQrcodeApply courseQrcodeApply = CourseQrcodeApply.builder()
|
||||
// .userId(userId)
|
||||
// .courseId(courseId)
|
||||
// .courseQrcode(viewValue)
|
||||
// .build();
|
||||
// courseQrcodeApplyService.save(courseQrcodeApply);
|
||||
// return viewValue;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: practice
|
||||
active: test
|
||||
|
||||
|
@ -2,23 +2,22 @@
|
||||
<!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">
|
||||
<mapper namespace="com.greenorange.promotion.mapper.AdvancementApplyMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.greenorange.promotion.model.entity.CourseChapter">
|
||||
<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="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="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,duration,
|
||||
permissions,videoView,courseId,
|
||||
isDelete,createTime,updateTime
|
||||
id,name,phone,
|
||||
resume,reviewStatus,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