Compare commits
10 Commits
f51d42230c
...
dev
Author | SHA1 | Date | |
---|---|---|---|
097bbb9b55 | |||
7a226ebe50 | |||
f094f58159 | |||
6c248d1da3 | |||
cbaa7f8a0c | |||
8d766edec3 | |||
a0557729c6 | |||
656bee3ad1 | |||
5f7c3b50ff | |||
869fd1a8b1 |
5
pom.xml
5
pom.xml
@ -221,6 +221,11 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!--rabbitmq依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,11 +72,15 @@ public class PermissionCheck {
|
|||||||
String userRole = userInfo.getUserRole();
|
String userRole = userInfo.getUserRole();
|
||||||
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||||
|
|
||||||
// 接口权限只能是 USER,ADMIN,BOSS,用户权限是 ADMIN,BOSS,USER,BAN
|
// 接口权限只能是 USER,ADMIN,BOSS,用户权限是 ADMIN,BOSS,USER,BAN,MANAGER,SUPERVISOR,STAFF
|
||||||
// 校验角色
|
// 校验角色
|
||||||
ThrowUtils.throwIf(UserRoleEnum.USER.equals(userRoleEnum) && !UserRoleEnum.USER.equals(interfaceRoleEnum), ErrorCode.NO_AUTH_ERROR);
|
ThrowUtils.throwIf(UserRoleEnum.BOSS.equals(userRoleEnum) && UserRoleEnum.USER.equals(interfaceRoleEnum), ErrorCode.NO_AUTH_ERROR);
|
||||||
ThrowUtils.throwIf(UserRoleEnum.BAN.equals(userRoleEnum), ErrorCode.NO_AUTH_ERROR, "用户已被封禁");
|
ThrowUtils.throwIf(UserRoleEnum.ADMIN.equals(userRoleEnum) && !UserRoleEnum.ADMIN.equals(interfaceRoleEnum), ErrorCode.NO_AUTH_ERROR);
|
||||||
ThrowUtils.throwIf(UserRoleEnum.ADMIN.equals(userRoleEnum) && UserRoleEnum.BOSS.equals(interfaceRoleEnum), ErrorCode.NO_AUTH_ERROR);
|
ThrowUtils.throwIf(UserRoleEnum.BAN.equals(userRoleEnum), ErrorCode.PARAMS_ERROR, "用户已被封禁");
|
||||||
|
ThrowUtils.throwIf((UserRoleEnum.USER.equals(userRoleEnum)
|
||||||
|
|| UserRoleEnum.STAFF.equals(userRoleEnum)
|
||||||
|
|| UserRoleEnum.SUPERVISOR.equals(userRoleEnum)
|
||||||
|
|| UserRoleEnum.MANAGER.equals(userRoleEnum)) && !UserRoleEnum.USER.equals(interfaceRoleEnum), ErrorCode.NO_AUTH_ERROR);
|
||||||
|
|
||||||
return joinPoint.proceed();
|
return joinPoint.proceed();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import lombok.Getter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum ErrorCode {
|
public enum ErrorCode {
|
||||||
// private static final SUCESS = new ErrorCode(1, "ok");
|
|
||||||
SUCCESS(1,"ok"),
|
SUCCESS(1,"ok"),
|
||||||
PARAMS_ERROR(40000,"请求参数错误"),
|
PARAMS_ERROR(40000,"请求参数错误"),
|
||||||
NOT_LOGIN_ERROR(40100,"未登录"),
|
NOT_LOGIN_ERROR(40100,"未登录"),
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.greenorange.promotion.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.support.converter.DefaultClassMapper;
|
||||||
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RabbitMQConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MessageConverter jsonToMapMessageConverter() {
|
||||||
|
DefaultClassMapper defaultClassMapper = new DefaultClassMapper();
|
||||||
|
defaultClassMapper.setTrustedPackages("com.greenorange.promotion.utils.MultiDelayMessage"); // trusted packages
|
||||||
|
Jackson2JsonMessageConverter jackson2JsonMessageConverter = new Jackson2JsonMessageConverter();
|
||||||
|
jackson2JsonMessageConverter.setClassMapper(defaultClassMapper);
|
||||||
|
return jackson2JsonMessageConverter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MessageConverter messageConverter(){
|
||||||
|
return new Jackson2JsonMessageConverter();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.greenorange.promotion.config;
|
||||||
|
|
||||||
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||||
|
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
||||||
|
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Slf4j
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "wx.mini")
|
||||||
|
public class WxOpenConfig {
|
||||||
|
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
|
private WxMaService wxMaService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单例模式
|
||||||
|
*/
|
||||||
|
public WxMaService getWxMaService() {
|
||||||
|
if (wxMaService != null) {
|
||||||
|
return wxMaService;
|
||||||
|
}
|
||||||
|
synchronized (this) {
|
||||||
|
if (wxMaService != null) {
|
||||||
|
return wxMaService;
|
||||||
|
}
|
||||||
|
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
||||||
|
config.setAppid(appId);
|
||||||
|
config.setSecret(appSecret);
|
||||||
|
WxMaService service = new WxMaServiceImpl();
|
||||||
|
service.setWxMaConfig(config);
|
||||||
|
wxMaService = service;
|
||||||
|
return wxMaService;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.greenorange.promotion.config;
|
||||||
|
|
||||||
|
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||||
|
import com.wechat.pay.java.core.util.IOUtil;
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||||
|
import com.wechat.pay.java.service.refund.RefundService;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Slf4j
|
||||||
|
@Configuration
|
||||||
|
@Component("WxPayConfig")
|
||||||
|
@ConfigurationProperties(prefix = "wx.pay")
|
||||||
|
public class WxPayConfig {
|
||||||
|
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
private String apiV3Key;
|
||||||
|
|
||||||
|
private String notifyUrl;
|
||||||
|
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
private String privateKeyPath;
|
||||||
|
|
||||||
|
private String merchantSerialNumber;
|
||||||
|
|
||||||
|
// RSA配置
|
||||||
|
private RSAAutoCertificateConfig RSAConfig;
|
||||||
|
|
||||||
|
// JSAPI支付
|
||||||
|
private JsapiServiceExtension jsapiServiceExtension;
|
||||||
|
|
||||||
|
// 退款
|
||||||
|
private RefundService refundService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化配置
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public boolean initWxPayConfig() throws IOException {
|
||||||
|
this.RSAConfig = buildRSAAutoCertificateConfig();
|
||||||
|
this.jsapiServiceExtension = buildJsapiServiceExtension(RSAConfig);
|
||||||
|
this.refundService = buildRefundService(RSAConfig);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建并使用自动更新平台证书的RSA配置,一个商户号只能初始化一个配置,否则会因为重复的下载任务报错
|
||||||
|
private RSAAutoCertificateConfig buildRSAAutoCertificateConfig() throws IOException {
|
||||||
|
// 将 resource 目录下的文件转为 InputStream,然后利用 IOUtil.toString(inputStream) 转化为密钥
|
||||||
|
String privateKey = IOUtil.toString(new ClassPathResource(privateKeyPath).getInputStream());
|
||||||
|
return new RSAAutoCertificateConfig.Builder()
|
||||||
|
.merchantId(merchantId)
|
||||||
|
.privateKey(privateKey)
|
||||||
|
.merchantSerialNumber(merchantSerialNumber)
|
||||||
|
.apiV3Key(apiV3Key)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建JSAPI支付
|
||||||
|
private JsapiServiceExtension buildJsapiServiceExtension(RSAAutoCertificateConfig config) {
|
||||||
|
return new JsapiServiceExtension.Builder().config(config).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建退款
|
||||||
|
private RefundService buildRefundService(RSAAutoCertificateConfig config) {
|
||||||
|
return new RefundService.Builder().config(config).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -43,4 +43,19 @@ public interface UserConstant {
|
|||||||
*/
|
*/
|
||||||
String BAN_ROLE = "ban";
|
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.ErrorCode;
|
||||||
import com.greenorange.promotion.common.ResultUtils;
|
import com.greenorange.promotion.common.ResultUtils;
|
||||||
import com.greenorange.promotion.constant.UserConstant;
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
import com.greenorange.promotion.exception.BusinessException;
|
|
||||||
import com.greenorange.promotion.exception.ThrowUtils;
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||||
@ -19,16 +18,10 @@ import com.greenorange.promotion.model.dto.course.CourseAddRequest;
|
|||||||
import com.greenorange.promotion.model.dto.course.CourseQueryRequest;
|
import com.greenorange.promotion.model.dto.course.CourseQueryRequest;
|
||||||
import com.greenorange.promotion.model.dto.course.CourseUpdateRequest;
|
import com.greenorange.promotion.model.dto.course.CourseUpdateRequest;
|
||||||
import com.greenorange.promotion.model.entity.Course;
|
import com.greenorange.promotion.model.entity.Course;
|
||||||
import com.greenorange.promotion.model.entity.CourseChapter;
|
|
||||||
import com.greenorange.promotion.model.entity.CourseQrcodeApply;
|
|
||||||
import com.greenorange.promotion.model.entity.ProjectCommission;
|
|
||||||
import com.greenorange.promotion.model.vo.course.CourseCardVO;
|
import com.greenorange.promotion.model.vo.course.CourseCardVO;
|
||||||
import com.greenorange.promotion.model.vo.course.CourseDetailVO;
|
import com.greenorange.promotion.model.vo.course.CourseDetailVO;
|
||||||
import com.greenorange.promotion.model.vo.course.CourseVO;
|
import com.greenorange.promotion.model.vo.course.CourseVO;
|
||||||
import com.greenorange.promotion.model.vo.courseChapter.CourseChapterVO;
|
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
import com.greenorange.promotion.service.course.CourseChapterService;
|
|
||||||
import com.greenorange.promotion.service.course.CourseQrcodeApplyService;
|
|
||||||
import com.greenorange.promotion.service.course.CourseService;
|
import com.greenorange.promotion.service.course.CourseService;
|
||||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -63,16 +56,6 @@ public class CourseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseChapterService courseChapterService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private WechatGetQrcodeService wechatGetQrcodeService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseQrcodeApplyService courseQrcodeApplyService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序端用户查看热门课程列表
|
* 小程序端用户查看热门课程列表
|
||||||
@ -124,29 +107,10 @@ public class CourseController {
|
|||||||
Long id = commonRequest.getId();
|
Long id = commonRequest.getId();
|
||||||
Course course = courseService.getById(id);
|
Course course = courseService.getById(id);
|
||||||
CourseDetailVO courseDetailVO = commonService.copyProperties(course, CourseDetailVO.class);
|
CourseDetailVO courseDetailVO = commonService.copyProperties(course, CourseDetailVO.class);
|
||||||
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.eq(CourseChapter::getCourseId, id);
|
|
||||||
List<CourseChapter> courseChapterList = courseChapterService.list(lambdaQueryWrapper);
|
|
||||||
List<CourseChapterVO> courseChapterVOS = commonService.convertList(courseChapterList, CourseChapterVO.class);
|
|
||||||
courseDetailVO.setCourseChapters(courseChapterVOS);
|
|
||||||
return ResultUtils.success(courseDetailVO);
|
return ResultUtils.success(courseDetailVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 小程序端用户生成课程推广码
|
|
||||||
* @param commonRequest 课程id
|
|
||||||
* @return 课程信息列表
|
|
||||||
*/
|
|
||||||
@PostMapping("generate/qrcode")
|
|
||||||
@Operation(summary = "小程序端用户生成课程推广码", description = "参数:课程id,权限:管理员,方法名:miniGenerateQrcode")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
|
||||||
@SysLog(title = "课程管理", content = "小程序端用户生成课程推广码")
|
|
||||||
public BaseResponse<String> miniGenerateQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
|
||||||
String videoView = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
|
||||||
return ResultUtils.success(videoView);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序端用户根据id查看课程基本信息
|
* 小程序端用户根据id查看课程基本信息
|
||||||
@ -165,24 +129,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 +146,6 @@ public class CourseController {
|
|||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
@SysLog(title = "课程管理", content = "web端管理员添加课程")
|
@SysLog(title = "课程管理", content = "web端管理员添加课程")
|
||||||
public BaseResponse<Long> addCourse(@Valid @RequestBody CourseAddRequest courseAddRequest) {
|
public BaseResponse<Long> addCourse(@Valid @RequestBody CourseAddRequest courseAddRequest) {
|
||||||
BigDecimal firstLevelRate = courseAddRequest.getFirstLevelRate();
|
|
||||||
BigDecimal secondLevelRate = courseAddRequest.getSecondLevelRate();
|
|
||||||
ThrowUtils.throwIf(firstLevelRate.compareTo(secondLevelRate) < 0, ErrorCode.PARAMS_ERROR, "一级佣金比例不能小于二级佣金比例");
|
|
||||||
Course course = commonService.copyProperties(courseAddRequest, Course.class);
|
Course course = commonService.copyProperties(courseAddRequest, Course.class);
|
||||||
courseService.save(course);
|
courseService.save(course);
|
||||||
return ResultUtils.success(course.getId());
|
return ResultUtils.success(course.getId());
|
||||||
@ -235,9 +178,6 @@ public class CourseController {
|
|||||||
public BaseResponse<Boolean> delCourse(@Valid @RequestBody CommonRequest commonRequest) {
|
public BaseResponse<Boolean> delCourse(@Valid @RequestBody CommonRequest commonRequest) {
|
||||||
Long id = commonRequest.getId();
|
Long id = commonRequest.getId();
|
||||||
courseService.removeById(id);
|
courseService.removeById(id);
|
||||||
// 删除课程下的所有章节
|
|
||||||
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = commonService.buildQueryWrapperByField(CourseChapter::getCourseId, id, courseChapterService);
|
|
||||||
courseChapterService.remove(lambdaQueryWrapper);
|
|
||||||
return ResultUtils.success(true);
|
return ResultUtils.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,10 +193,6 @@ public class CourseController {
|
|||||||
public BaseResponse<Boolean> delBatchCourse(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
public BaseResponse<Boolean> delBatchCourse(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||||
List<Long> ids = commonBatchRequest.getIds();
|
List<Long> ids = commonBatchRequest.getIds();
|
||||||
courseService.removeByIds(ids);
|
courseService.removeByIds(ids);
|
||||||
// 批量删除课程下的所有章节
|
|
||||||
LambdaQueryWrapper<CourseChapter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.in(CourseChapter::getCourseId, ids);
|
|
||||||
courseChapterService.remove(lambdaQueryWrapper);
|
|
||||||
return ResultUtils.success(true);
|
return ResultUtils.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
@Resource
|
||||||
private UserInfoService userInfoService;
|
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.projectDetail.ProjectDetailUpdateRequest;
|
||||||
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionAddRequest;
|
import com.greenorange.promotion.model.dto.subUserProjectCommission.SubUserProjectCommissionAddRequest;
|
||||||
import com.greenorange.promotion.model.entity.*;
|
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.model.vo.projectDetail.ProjectDetailVO;
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
import com.greenorange.promotion.service.project.ProjectCommissionService;
|
import com.greenorange.promotion.service.project.ProjectCommissionService;
|
||||||
@ -92,7 +93,9 @@ public class ProjectDetailController {
|
|||||||
projectService.updateById(project);
|
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);
|
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
|
||||||
// 封装Map(键:用户id, 值:抽佣比例)
|
// 封装Map(键:用户id, 值:抽佣比例)
|
||||||
Map<Long, BigDecimal> userCommissionRateMap = new HashMap<>();
|
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.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||||
import com.greenorange.promotion.annotation.SysLog;
|
import com.greenorange.promotion.annotation.SysLog;
|
||||||
import com.greenorange.promotion.common.BaseResponse;
|
import com.greenorange.promotion.common.BaseResponse;
|
||||||
import com.greenorange.promotion.common.ErrorCode;
|
import com.greenorange.promotion.common.ErrorCode;
|
||||||
import com.greenorange.promotion.common.ResultUtils;
|
import com.greenorange.promotion.common.ResultUtils;
|
||||||
import com.greenorange.promotion.constant.UserConstant;
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
import com.greenorange.promotion.exception.BusinessException;
|
|
||||||
import com.greenorange.promotion.exception.ThrowUtils;
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountQueryRequest;
|
|
||||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
|
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
|
||||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
|
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
|
||||||
import com.greenorange.promotion.model.entity.*;
|
import com.greenorange.promotion.model.entity.FundsChange;
|
||||||
|
import com.greenorange.promotion.model.entity.UserAccount;
|
||||||
|
import com.greenorange.promotion.model.entity.UserMainInfo;
|
||||||
|
import com.greenorange.promotion.model.entity.WithdrawalApply;
|
||||||
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
|
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
|
||||||
import com.greenorange.promotion.model.vo.fundsChange.FundsItemVO;
|
import com.greenorange.promotion.model.vo.fundsChange.FundsItemVO;
|
||||||
import com.greenorange.promotion.model.vo.userAccount.UserAccountConditionVO;
|
import com.greenorange.promotion.model.vo.userAccount.UserAccountConditionVO;
|
||||||
@ -22,19 +24,15 @@ import com.greenorange.promotion.service.common.CommonService;
|
|||||||
import com.greenorange.promotion.service.settle.FundsChangeService;
|
import com.greenorange.promotion.service.settle.FundsChangeService;
|
||||||
import com.greenorange.promotion.service.settle.UserAccountService;
|
import com.greenorange.promotion.service.settle.UserAccountService;
|
||||||
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
|
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
|
||||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
|
||||||
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Priority;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -51,46 +49,148 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Tag(name = "提现申请记录管理")
|
@Tag(name = "提现申请记录管理")
|
||||||
public class WithdrawalApplyController {
|
public class WithdrawalApplyController {
|
||||||
@Resource
|
|
||||||
private UserAccountService userAccountService;
|
|
||||||
@Resource
|
|
||||||
private UserMainInfoService userMainInfoService;
|
|
||||||
@Resource
|
@Resource
|
||||||
private WithdrawalApplyService withdrawalApplyService;
|
private WithdrawalApplyService withdrawalApplyService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FundsChangeService fundsChangeService;
|
private FundsChangeService fundsChangeService;
|
||||||
|
|
||||||
@PostMapping("addqurry")
|
@Resource
|
||||||
public BaseResponse<String> addqurry(@RequestBody Addqurrywithdraw addqurrywithdraw ){
|
private CommonService commonService;
|
||||||
Long userid = addqurrywithdraw.getUserid();
|
|
||||||
BigDecimal payouts = addqurrywithdraw.getPayouts();
|
@Resource
|
||||||
LambdaQueryWrapper<UserMainInfo> queryWrapper = new LambdaQueryWrapper<>();
|
private UserMainInfoService userMainInfoService;
|
||||||
queryWrapper.eq(UserMainInfo::getUserId, userid);
|
|
||||||
UserMainInfo one = userMainInfoService.getOne(queryWrapper);
|
@Resource
|
||||||
BigDecimal currentBalance = one.getCurrentBalance();
|
private UserAccountService userAccountService;
|
||||||
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();
|
* @return 提现申请记录id
|
||||||
BeanUtils.copyProperties(two, withdrawalApply);
|
*/
|
||||||
withdrawalApply.setId(null);
|
@PostMapping("query/condition")
|
||||||
withdrawalApply.setUpdateTime(null);
|
@Operation(summary = "小程序端用户查询账户提现状况", description = "参数:无,权限:管理员,方法名:queryWithdrawalCondition")
|
||||||
withdrawalApply.setCreateTime(null);
|
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
withdrawalApply.setWithdrawnAmount(payouts);
|
public BaseResponse<UserAccountConditionVO> queryWithdrawalCondition(HttpServletRequest request) {
|
||||||
withdrawalApply.setWithdrawalStatus("processing");
|
Long userId = (Long) request.getAttribute("userId");
|
||||||
withdrawalApplyService.save(withdrawalApply);
|
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
||||||
BigDecimal subtract = currentBalance.subtract(payouts);
|
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||||
one.setCurrentBalance(subtract);
|
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserAccount::getUserId, userId, userAccountService);
|
||||||
userMainInfoService.updateById(one);
|
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
|
||||||
FundsChange fundsChange = new FundsChange();
|
String bankCardNumber = userAccount == null ? "" : userAccount.getBankCardNumber();
|
||||||
fundsChange.setUserId(userid);
|
UserAccountConditionVO userAccountConditionVO = UserAccountConditionVO.builder()
|
||||||
fundsChange.setChangeAmount(payouts);
|
.currentBalance(userMainInfo.getCurrentBalance())
|
||||||
fundsChange.setProjectName("processing");
|
.bankCardNumber(bankCardNumber)
|
||||||
fundsChange.setCurrentAmount(subtract);
|
.build();
|
||||||
fundsChange.setProjectSettlementId(0L);
|
return ResultUtils.success(userAccountConditionVO);
|
||||||
fundsChangeService.save(fundsChange);
|
|
||||||
return ResultUtils.success("提现成功");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序端用户申请提现
|
||||||
|
* @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;
|
package com.greenorange.promotion.controller.userInfo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||||
import com.greenorange.promotion.annotation.SysLog;
|
|
||||||
import com.greenorange.promotion.common.BaseResponse;
|
import com.greenorange.promotion.common.BaseResponse;
|
||||||
import com.greenorange.promotion.common.ErrorCode;
|
|
||||||
import com.greenorange.promotion.common.ResultUtils;
|
import com.greenorange.promotion.common.ResultUtils;
|
||||||
import com.greenorange.promotion.constant.UserConstant;
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
import com.greenorange.promotion.exception.ThrowUtils;
|
|
||||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
|
||||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountAddRequest;
|
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.dto.userAccount.UserAccountUpdateRequest;
|
||||||
import com.greenorange.promotion.model.entity.UserAccount;
|
import com.greenorange.promotion.model.entity.UserAccount;
|
||||||
import com.greenorange.promotion.model.vo.userAccount.UserAccountVO;
|
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 io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
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.ErrorCode;
|
||||||
import com.greenorange.promotion.common.ResultUtils;
|
import com.greenorange.promotion.common.ResultUtils;
|
||||||
import com.greenorange.promotion.constant.UserConstant;
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
import com.greenorange.promotion.exception.BusinessException;
|
|
||||||
import com.greenorange.promotion.exception.ThrowUtils;
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||||
@ -31,7 +30,6 @@ import jakarta.annotation.Resource;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.ibatis.io.JBoss6VFS;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -305,14 +303,6 @@ public class UserInfoController {
|
|||||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||||
@SysLog(title = "用户管理", content = "web端管理员添加用户")
|
@SysLog(title = "用户管理", content = "web端管理员添加用户")
|
||||||
public BaseResponse<Boolean> addUserInfo(@Valid @RequestBody UserInfoAddRequest userInfoAddRequest) {
|
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 userInfo = commonService.copyProperties(userInfoAddRequest, UserInfo.class);
|
||||||
userInfo.setParentUserId(-1L);
|
userInfo.setParentUserId(-1L);
|
||||||
userInfo.setUserRole(UserConstant.ADMIN_ROLE);
|
userInfo.setUserRole(UserConstant.ADMIN_ROLE);
|
||||||
|
@ -113,104 +113,4 @@ public class UserMainInfoController {
|
|||||||
return ResultUtils.success(userTeamInfoVO);
|
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
|
// * @return
|
||||||
* @throws IOException
|
// * @throws IOException
|
||||||
*/
|
// */
|
||||||
@Hidden
|
// @Hidden
|
||||||
@PostMapping("/get/course/qrcode")
|
// @PostMapping("/get/course/qrcode")
|
||||||
@Operation(summary = "微信小程序获取课程码", description = "参数:无, 权限:所有人, 方法名:getCourseQrcode")
|
// @Operation(summary = "微信小程序获取课程码", description = "参数:无, 权限:所有人, 方法名:getCourseQrcode")
|
||||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
//// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
public BaseResponse<String> getCourseQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
// public BaseResponse<String> getCourseQrcode(@Valid @RequestBody CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||||
String view = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
// String view = wechatGetQrcodeService.getWxCourseQrCode(commonRequest, request);
|
||||||
return ResultUtils.success(view);
|
// return ResultUtils.success(view);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,150 @@
|
|||||||
|
package com.greenorange.promotion.controller.wechat;
|
||||||
|
|
||||||
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||||
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||||
|
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||||
|
import com.greenorange.promotion.common.BaseResponse;
|
||||||
|
import com.greenorange.promotion.common.ErrorCode;
|
||||||
|
import com.greenorange.promotion.common.ResultUtils;
|
||||||
|
import com.greenorange.promotion.config.WxOpenConfig;
|
||||||
|
import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||||
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
|
import com.greenorange.promotion.exception.BusinessException;
|
||||||
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
|
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||||
|
import com.greenorange.promotion.model.dto.wxPay.WechatPayRequest;
|
||||||
|
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||||
|
import com.greenorange.promotion.model.entity.UserInfo;
|
||||||
|
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||||
|
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||||
|
import com.greenorange.promotion.service.wechat.WechatPayService;
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||||
|
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Refund;
|
||||||
|
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||||
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
|
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 me.chanjar.weixin.common.error.WxErrorException;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
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.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "微信支付")
|
||||||
|
@RequestMapping("/wxPay")
|
||||||
|
public class WechatPayController {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WechatPayService weChatService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserInfoService userInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CourseOrderService courseOrderService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxOpenConfig wxOpenConfig;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSAPI 下单
|
||||||
|
*/
|
||||||
|
@PostMapping("/payment/create")
|
||||||
|
@Operation(summary = "JSAPI 下单", description = "参数:订单id, 权限:所有人, 方法名:createPayment")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
|
public BaseResponse<PrepayWithRequestPaymentResponse> createPayment(@Valid @RequestBody WechatPayRequest wechatPayRequest, HttpServletRequest request) {
|
||||||
|
|
||||||
|
String code = wechatPayRequest.getCode();
|
||||||
|
WxMaJscode2SessionResult sessionInfo;
|
||||||
|
String miniOpenId;
|
||||||
|
try {
|
||||||
|
WxMaService wxMaService = wxOpenConfig.getWxMaService();
|
||||||
|
sessionInfo = wxMaService.jsCode2SessionInfo(code);
|
||||||
|
miniOpenId = sessionInfo.getOpenid();
|
||||||
|
if (StringUtils.isAnyBlank(miniOpenId)) {
|
||||||
|
throw new BusinessException(ErrorCode.SYSTEM_ERROR);
|
||||||
|
}
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
log.error("userLoginByWxOpen error", e);
|
||||||
|
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "登录失败,系统错误");
|
||||||
|
}
|
||||||
|
Long userId = (Long) request.getAttribute("userId");
|
||||||
|
UserInfo userInfo = userInfoService.getById(userId);
|
||||||
|
|
||||||
|
Long orderId = wechatPayRequest.getOrderId();
|
||||||
|
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||||
|
ThrowUtils.throwIf(courseOrder == null, ErrorCode.NOT_FOUND_ERROR, "订单不存在");
|
||||||
|
ThrowUtils.throwIf(!courseOrder.getOrderStatus().equals(OrderStatusConstant.PENDING), ErrorCode.OPERATION_ERROR, "订单状态错误");
|
||||||
|
if (!userInfo.getId().equals(courseOrder.getUserId())) {
|
||||||
|
throw new BusinessException(ErrorCode.NO_AUTH_ERROR, "你不是该订单用户!");
|
||||||
|
}
|
||||||
|
PrepayWithRequestPaymentResponse response = weChatService.createPayment(String.valueOf(orderId), miniOpenId, courseOrder.getTotalAmount());
|
||||||
|
return ResultUtils.success(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSAPI 下单回调
|
||||||
|
*/
|
||||||
|
@Hidden
|
||||||
|
@PostMapping("/payment/callback")
|
||||||
|
@Operation(summary = "JSAPI 下单回调", description = "参数:订单id, 权限:所有人, 方法名:callbackPayment")
|
||||||
|
public synchronized BaseResponse<Boolean> callbackPayment(HttpServletRequest request) throws IOException {
|
||||||
|
// 获取下单信息
|
||||||
|
Transaction transaction = weChatService.getTransactionInfo(request);
|
||||||
|
System.out.println("下单信息:" + transaction);
|
||||||
|
// 支付回调
|
||||||
|
boolean result = weChatService.paymentCallback(transaction);
|
||||||
|
ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR, "微信支付回调失败");
|
||||||
|
return ResultUtils.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Web管理员部分退款
|
||||||
|
* @param commonRequest 订单id
|
||||||
|
*/
|
||||||
|
@PostMapping("/refund/part/create")
|
||||||
|
@Operation(summary = "Web管理员部分退款", description = "参数:订单id, 权限:web端管理员, 方法名:createPartRefund")
|
||||||
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
|
public BaseResponse<Refund> createPartRefund(@Valid @RequestBody CommonRequest commonRequest) {
|
||||||
|
Long orderId = commonRequest.getId();
|
||||||
|
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||||
|
ThrowUtils.throwIf(courseOrder == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||||
|
|
||||||
|
Refund refund = weChatService.refundPartPayment(String.valueOf(orderId), courseOrder.getTotalAmount());
|
||||||
|
return ResultUtils.success(refund);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部分退款回调
|
||||||
|
*/
|
||||||
|
@Hidden
|
||||||
|
@PostMapping("/refund/part/callback")
|
||||||
|
@Operation(summary = "部分退款回调", description = "参数:订单id, 权限:web端管理员, 方法名:callbackRefundPart")
|
||||||
|
public BaseResponse<Boolean> callbackRefundPart(HttpServletRequest request) {
|
||||||
|
// 获取退款信息
|
||||||
|
RefundNotification refundNotification = weChatService.getRefundInfo(request);
|
||||||
|
// 退款回调
|
||||||
|
boolean result = weChatService.refundPartCallback(refundNotification);
|
||||||
|
ThrowUtils.throwIf(!result, ErrorCode.SYSTEM_ERROR, "退款回调失败");
|
||||||
|
return ResultUtils.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -26,7 +26,6 @@ import java.util.Map;
|
|||||||
public class WechatPayoutsController {
|
public class WechatPayoutsController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信小程序积分提现到银行卡
|
* 微信小程序积分提现到银行卡
|
||||||
*/
|
*/
|
||||||
|
@ -27,13 +27,13 @@ public class Generator {
|
|||||||
// 作者
|
// 作者
|
||||||
private static final String AUTHOR = "chenxinzhi";
|
private static final String AUTHOR = "chenxinzhi";
|
||||||
// 表注释
|
// 表注释
|
||||||
private static final String TABLE_COMMENT = "课程订单";
|
private static final String TABLE_COMMENT = "晋升申请";
|
||||||
// 实体类名
|
// 实体类名
|
||||||
private static final String ENTITY_NAME = "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";
|
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",
|
"name",
|
||||||
"type",
|
"type",
|
||||||
"detail",
|
"detail",
|
||||||
"promoCodeDesc",
|
|
||||||
"image",
|
"image",
|
||||||
"originPrice",
|
"originPrice",
|
||||||
"discountPrice",
|
"discountPrice"
|
||||||
"firstLevelRate",
|
|
||||||
"secondLevelRate",
|
|
||||||
})
|
})
|
||||||
public class CourseAddRequest implements Serializable {
|
public class CourseAddRequest implements Serializable {
|
||||||
|
|
||||||
@ -36,11 +33,11 @@ public class CourseAddRequest implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "课程类别不能为空")
|
@NotBlank(message = "课程类别不能为空")
|
||||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,13 +47,6 @@ public class CourseAddRequest implements Serializable {
|
|||||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "推广码说明(富文本)不能为空")
|
|
||||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -78,20 +68,6 @@ public class CourseAddRequest implements Serializable {
|
|||||||
@Schema(description = "折扣价格", example = "2499")
|
@Schema(description = "折扣价格", example = "2499")
|
||||||
private BigDecimal discountPrice;
|
private BigDecimal discountPrice;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0", message = "一级佣金比例不能小于0")
|
|
||||||
@Schema(description = "一级佣金比例(%)", example = "10")
|
|
||||||
private BigDecimal firstLevelRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0", message = "二级佣金比例不能小于0")
|
|
||||||
@Schema(description = "二级佣金比例(%)", example = "5")
|
|
||||||
private BigDecimal secondLevelRate;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -28,10 +28,10 @@ public class CourseQueryRequest extends PageRequest implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,13 +22,10 @@ import java.io.Serializable;
|
|||||||
"name",
|
"name",
|
||||||
"type",
|
"type",
|
||||||
"detail",
|
"detail",
|
||||||
"promoCodeDesc",
|
|
||||||
"image",
|
"image",
|
||||||
"originPrice",
|
"originPrice",
|
||||||
"discountPrice",
|
"discountPrice",
|
||||||
"orderCount",
|
"orderCount"
|
||||||
"firstLevelRate",
|
|
||||||
"secondLevelRate",
|
|
||||||
})
|
})
|
||||||
public class CourseUpdateRequest implements Serializable {
|
public class CourseUpdateRequest implements Serializable {
|
||||||
|
|
||||||
@ -47,11 +44,11 @@ public class CourseUpdateRequest implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "课程类别不能为空")
|
@NotBlank(message = "课程类别不能为空")
|
||||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,13 +58,6 @@ public class CourseUpdateRequest implements Serializable {
|
|||||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "推广码说明(富文本)不能为空")
|
|
||||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -95,20 +85,6 @@ public class CourseUpdateRequest implements Serializable {
|
|||||||
@Schema(description = "已下单人数", example = "100")
|
@Schema(description = "已下单人数", example = "100")
|
||||||
private Integer orderCount;
|
private Integer orderCount;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0.0", message = "一级佣金比例不能小于0")
|
|
||||||
@Schema(description = "一级佣金比例(%)", example = "10")
|
|
||||||
private BigDecimal firstLevelRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@DecimalMin(value = "0.0", message = "二级佣金比例不能小于0")
|
|
||||||
@Schema(description = "二级佣金比例(%)", example = "5")
|
|
||||||
private BigDecimal secondLevelRate;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.dto.courseChapter;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.annotation.EnumValue;
|
|
||||||
import com.greenorange.promotion.model.enums.PreviewPermissionEnum;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.Min;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节添加请求体
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "课程章节添加请求体", requiredProperties = {
|
|
||||||
"name",
|
|
||||||
"duration",
|
|
||||||
"permissions",
|
|
||||||
"videoView",
|
|
||||||
"courseId",
|
|
||||||
})
|
|
||||||
public class CourseChapterAddRequest implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "章节名称不能为空")
|
|
||||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节时长(单位:秒)
|
|
||||||
*/
|
|
||||||
@Min(value = 0L, message = "章节时长不能小于0")
|
|
||||||
@Schema(description = "章节时长", example = "600")
|
|
||||||
private Long duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "试看权限不能为空")
|
|
||||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
|
||||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
|
||||||
private String permissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频文件 view 值
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "视频文件 view 值不能为空")
|
|
||||||
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
|
|
||||||
private String videoView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属课程ID
|
|
||||||
*/
|
|
||||||
@Min(value = 1L, message = "所属课程ID ID不能小于1")
|
|
||||||
@Schema(description = "所属课程ID", example = "1")
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.dto.courseChapter;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.annotation.EnumValue;
|
|
||||||
import com.greenorange.promotion.model.enums.PreviewPermissionEnum;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.Min;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import com.greenorange.promotion.common.PageRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节查询请求体,继承自分页请求 PageRequest
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "课程章节查询请求体", requiredProperties = {"current", "pageSize"})
|
|
||||||
public class CourseChapterQueryRequest extends PageRequest implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
|
||||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
|
||||||
private String permissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "课程id不能为null")
|
|
||||||
@Min(value = 1, message = "课程id不能小于1")
|
|
||||||
@Schema(description = "课程id", example = "1")
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.dto.courseChapter;
|
|
||||||
|
|
||||||
import com.greenorange.promotion.annotation.EnumValue;
|
|
||||||
import com.greenorange.promotion.model.enums.PreviewPermissionEnum;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.Min;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节更新请求体
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "课程章节更新请求体", requiredProperties = {
|
|
||||||
"id",
|
|
||||||
"name",
|
|
||||||
"duration",
|
|
||||||
"permissions",
|
|
||||||
"videoView",
|
|
||||||
"courseId",
|
|
||||||
})
|
|
||||||
public class CourseChapterUpdateRequest implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节ID
|
|
||||||
*/
|
|
||||||
@Min(value = 1L, message = "章节ID ID不能小于1")
|
|
||||||
@Schema(description = "章节ID", example = "1")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "章节名称不能为空")
|
|
||||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节时长(单位:秒)
|
|
||||||
*/
|
|
||||||
@Min(value = 0L, message = "章节时长不能小于0")
|
|
||||||
@Schema(description = "章节时长", example = "600")
|
|
||||||
private Long duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "试看权限不能为空")
|
|
||||||
@EnumValue(enumClass = PreviewPermissionEnum.class)
|
|
||||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
|
||||||
private String permissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频文件 view 值
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "视频文件 view 值不能为空")
|
|
||||||
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
|
|
||||||
private String videoView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属课程ID
|
|
||||||
*/
|
|
||||||
@Min(value = 1L, message = "所属课程ID ID不能小于1")
|
|
||||||
@Schema(description = "所属课程ID", example = "1")
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
@ -4,7 +4,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -3,7 +3,10 @@ package com.greenorange.promotion.model.dto.userInfo;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.greenorange.promotion.model.dto.wxPay;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "微信支付请求体", requiredProperties = {"orderId", "code"})
|
||||||
|
public class WechatPayRequest implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为null")
|
||||||
|
@Min(value = 1L, message = "id不能小于1")
|
||||||
|
@Schema(description = "订单id", example = "1")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登录凭证
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "用户登录凭证不能为空")
|
||||||
|
@Schema(description = "用户登录凭证", example = "23nm5jfds22a2324rr32rr")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
@ -4,49 +4,57 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程章节表
|
* 晋升申请表
|
||||||
* @TableName course_chapter
|
* @TableName advancement_apply
|
||||||
*/
|
*/
|
||||||
@TableName(value ="course_chapter")
|
@TableName(value ="advancement_apply")
|
||||||
@Data
|
@Data
|
||||||
public class CourseChapter implements Serializable {
|
public class AdvancementApply implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 章节ID
|
* 晋升申请id
|
||||||
*/
|
*/
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 章节名称
|
* 申请人姓名
|
||||||
*/
|
*/
|
||||||
private String name;
|
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;
|
private Date updateTime;
|
||||||
|
|
||||||
@Serial
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
@ -28,7 +28,7 @@ public class Course implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
@ -37,11 +37,6 @@ public class Course implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -62,16 +57,6 @@ public class Course implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer orderCount;
|
private Integer orderCount;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一级佣金比例(%)
|
|
||||||
*/
|
|
||||||
private BigDecimal firstLevelRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级佣金比例(%)
|
|
||||||
*/
|
|
||||||
private BigDecimal secondLevelRate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否上架(true:上架,false:下架)
|
* 是否上架(true:上架,false:下架)
|
||||||
*/
|
*/
|
||||||
|
@ -1,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")
|
@TableName(value ="user_info")
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
public class UserInfo implements Serializable {
|
public class UserInfo implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
|
@ -14,8 +14,7 @@ import java.util.stream.Collectors;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum CourseTypeEnum implements BaseEnum {
|
public enum CourseTypeEnum implements BaseEnum {
|
||||||
|
|
||||||
KAOGONGKAOYAN("考公考研"),
|
KAOGONG("考公"),
|
||||||
ZIMEITI("自媒体"),
|
|
||||||
CAIJING("财经");
|
CAIJING("财经");
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
@ -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"),
|
USER("用户", "user"),
|
||||||
ADMIN("管理员", "admin"),
|
ADMIN("管理员", "admin"),
|
||||||
BOSS("Boss", "boss"),
|
BOSS("Boss", "boss"),
|
||||||
BAN("被封号", "ban");
|
BAN("被封号", "ban"),
|
||||||
|
MANAGER("经理", "manager"),
|
||||||
|
SUPERVISOR("主管", "supervisor"),
|
||||||
|
STAFF("员工", "staff");
|
||||||
|
|
||||||
|
|
||||||
private final String text;
|
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;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package com.greenorange.promotion.model.vo.course;
|
package com.greenorange.promotion.model.vo.course;
|
||||||
|
|
||||||
import com.greenorange.promotion.model.vo.courseChapter.CourseChapterVO;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -27,9 +25,9 @@ public class CourseDetailVO implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,12 +36,6 @@ public class CourseDetailVO implements Serializable {
|
|||||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -62,12 +54,6 @@ public class CourseDetailVO implements Serializable {
|
|||||||
@Schema(description = "折扣价格", example = "2499")
|
@Schema(description = "折扣价格", example = "2499")
|
||||||
private BigDecimal discountPrice;
|
private BigDecimal discountPrice;
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节
|
|
||||||
*/
|
|
||||||
@Schema(description = "课程章节")
|
|
||||||
private List<CourseChapterVO> courseChapters;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -27,9 +27,9 @@ public class CourseVO implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程类别[考公考研,自媒体,财经]
|
* 课程类别[考公,财经]
|
||||||
*/
|
*/
|
||||||
@Schema(description = "课程类别[考公考研,自媒体,财经]", example = "自媒体")
|
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,12 +38,6 @@ public class CourseVO implements Serializable {
|
|||||||
@Schema(description = "课程概述(富文本)", example = "富文本")
|
@Schema(description = "课程概述(富文本)", example = "富文本")
|
||||||
private String detail;
|
private String detail;
|
||||||
|
|
||||||
/**
|
|
||||||
* 推广码说明(富文本)
|
|
||||||
*/
|
|
||||||
@Schema(description = "推广码说明(富文本)", example = "富文本")
|
|
||||||
private String promoCodeDesc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程图片URL
|
* 课程图片URL
|
||||||
*/
|
*/
|
||||||
@ -68,18 +62,6 @@ public class CourseVO implements Serializable {
|
|||||||
@Schema(description = "已下单人数", example = "100")
|
@Schema(description = "已下单人数", example = "100")
|
||||||
private Integer orderCount;
|
private Integer orderCount;
|
||||||
|
|
||||||
/**
|
|
||||||
* 一级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@Schema(description = "一级佣金比例(%)", example = "10")
|
|
||||||
private BigDecimal firstLevelRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级佣金比例(%)
|
|
||||||
*/
|
|
||||||
@Schema(description = "二级佣金比例(%)", example = "5")
|
|
||||||
private BigDecimal secondLevelRate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否上架(true:上架,false:下架)
|
* 是否上架(true:上架,false:下架)
|
||||||
*/
|
*/
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
package com.greenorange.promotion.model.vo.courseChapter;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.validation.constraints.Min;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节 视图对象
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Schema(description = "课程章节 视图对象")
|
|
||||||
public class CourseChapterVO implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 课程章节ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "课程章节ID", example = "1")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节名称
|
|
||||||
*/
|
|
||||||
@Schema(description = "章节名称", example = "企业经营管理者为什么必须懂财务?")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 章节时长(单位:秒)
|
|
||||||
*/
|
|
||||||
@Schema(description = "章节时长", example = "600")
|
|
||||||
private Long duration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 试看权限[全集试看,部分试看,关闭,开启]
|
|
||||||
*/
|
|
||||||
@Schema(description = "试看权限[全集试看,部分试看,关闭,开启]", example = "全集试看")
|
|
||||||
private String permissions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频文件 view 值
|
|
||||||
*/
|
|
||||||
@Schema(description = "视频文件 view 值", example = "3E29KDS9")
|
|
||||||
private String videoView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属课程ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "所属课程ID", example = "所属课程ID ID不能小于1")
|
|
||||||
private Long courseId;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
}
|
|
@ -37,7 +37,6 @@ public class UserInfoVO implements Serializable {
|
|||||||
@Schema(description = "手机号", example = "15888610253")
|
@Schema(description = "手机号", example = "15888610253")
|
||||||
private String phoneNumber;
|
private String phoneNumber;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账号
|
* 账号
|
||||||
*/
|
*/
|
||||||
|
@ -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;
|
package com.greenorange.promotion.service.userInfo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.greenorange.promotion.model.dto.userInfo.*;
|
|
||||||
import com.greenorange.promotion.model.entity.UserInfo;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
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;
|
import java.util.List;
|
||||||
|
|
||||||
@ -69,4 +72,27 @@ public interface UserInfoService extends IService<UserInfo> {
|
|||||||
*/
|
*/
|
||||||
List<Long> findPathToRoot(Long userId);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7,19 +7,23 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.greenorange.promotion.common.ErrorCode;
|
import com.greenorange.promotion.common.ErrorCode;
|
||||||
|
import com.greenorange.promotion.config.WxOpenConfig;
|
||||||
import com.greenorange.promotion.constant.CommonConstant;
|
import com.greenorange.promotion.constant.CommonConstant;
|
||||||
import com.greenorange.promotion.constant.SystemConstant;
|
import com.greenorange.promotion.constant.SystemConstant;
|
||||||
import com.greenorange.promotion.constant.UserConstant;
|
import com.greenorange.promotion.constant.UserConstant;
|
||||||
import com.greenorange.promotion.exception.ThrowUtils;
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
import com.greenorange.promotion.mapper.UserInfoMapper;
|
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.projectCommission.ProjectCommissionAddRequest;
|
||||||
import com.greenorange.promotion.model.dto.userInfo.*;
|
import com.greenorange.promotion.model.dto.userInfo.*;
|
||||||
import com.greenorange.promotion.model.entity.*;
|
import com.greenorange.promotion.model.entity.*;
|
||||||
|
import com.greenorange.promotion.model.enums.ReviewStatusEnum;
|
||||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
import com.greenorange.promotion.service.project.ProjectCommissionService;
|
import com.greenorange.promotion.service.project.ProjectCommissionService;
|
||||||
import com.greenorange.promotion.service.project.ProjectDetailService;
|
import com.greenorange.promotion.service.project.ProjectDetailService;
|
||||||
import com.greenorange.promotion.service.project.SubUserProjectCommissionService;
|
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.UserInfoService;
|
||||||
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
||||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||||
@ -28,7 +32,6 @@ import com.greenorange.promotion.utils.RegexUtils;
|
|||||||
import com.greenorange.promotion.utils.SendSmsUtil;
|
import com.greenorange.promotion.utils.SendSmsUtil;
|
||||||
import com.greenorange.promotion.utils.SqlUtils;
|
import com.greenorange.promotion.utils.SqlUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -36,13 +39,11 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 35880
|
* @author 35880
|
||||||
@ -89,6 +90,12 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||||||
private ProjectDetailService projectDetailService;
|
private ProjectDetailService projectDetailService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdvancementApplyService advancementApplyService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,6 +138,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序用户注册
|
* 小程序用户注册
|
||||||
*/
|
*/
|
||||||
@ -138,87 +149,31 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void userInfoMiniRegister(UserInfoRegisterRequest userInfoRegisterRequest) {
|
public void userInfoMiniRegister(UserInfoRegisterRequest userInfoRegisterRequest) {
|
||||||
String phoneNumber = userInfoRegisterRequest.getPhoneNumber();
|
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 verificationCode = userInfoRegisterRequest.getVerificationCode();
|
||||||
String code = redisTemplate.opsForValue().get(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
// 校验用户手机号和验证码
|
||||||
ThrowUtils.throwIf(code == null, ErrorCode.OPERATION_ERROR, "验证码已失效");
|
checkPhoneAndVerificationCode(phoneNumber, verificationCode, UserRoleEnum.USER);
|
||||||
|
|
||||||
// // 移除验证码
|
|
||||||
// redisTemplate.delete(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
|
||||||
|
|
||||||
|
// 根据邀请码获得上级用户信息
|
||||||
String invitationCode = userInfoRegisterRequest.getInvitationCode();
|
String invitationCode = userInfoRegisterRequest.getInvitationCode();
|
||||||
LambdaQueryWrapper<UserInfo> invitedLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
UserInfo parentUserInfo = getParentUserInfoByInvitationCode(invitationCode);
|
||||||
invitedLambdaQueryWrapper.eq(UserInfo::getInvitationCode, invitationCode).eq(UserInfo::getUserRole, UserConstant.DEFAULT_ROLE);
|
|
||||||
UserInfo parentUserInfo = this.getOne(invitedLambdaQueryWrapper);
|
|
||||||
ThrowUtils.throwIf(parentUserInfo == null, ErrorCode.OPERATION_ERROR, "邀请码错误");
|
|
||||||
|
|
||||||
|
// 保存用户
|
||||||
UserInfo myUserInfo = commonService.copyProperties(userInfoRegisterRequest, UserInfo.class);
|
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.setParentUserId(parentUserInfo.getId());
|
||||||
myUserInfo.setInvitationCode(RandomUtil.randomNumbers(6));
|
myUserInfo.setInvitationCode(RandomUtil.randomNumbers(6));
|
||||||
myUserInfo.setUserAccount(phoneNumber);
|
myUserInfo.setUserAccount(phoneNumber);
|
||||||
myUserInfo.setUserRole(UserConstant.DEFAULT_ROLE);
|
myUserInfo.setUserRole(UserConstant.DEFAULT_ROLE);
|
||||||
myUserInfo.setUserAvatar(UserConstant.USER_DEFAULT_AVATAR);
|
myUserInfo.setUserAvatar(UserConstant.USER_DEFAULT_AVATAR);
|
||||||
this.save(myUserInfo);
|
this.save(myUserInfo);
|
||||||
UserMainInfo userMainInfo = new UserMainInfo();
|
|
||||||
userMainInfo.setUserId(myUserInfo.getId());
|
|
||||||
|
|
||||||
// 批量更新父级用户团队人数
|
// 批量更新父级用户团队人数
|
||||||
List<Long> pathToRoot = this.findPathToRoot(myUserInfo.getId());
|
UserMainInfo userMainInfo = updateParentUserInfoTeamCount(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);
|
|
||||||
|
|
||||||
// 生成邀请二维码
|
// 生成邀请二维码
|
||||||
try {
|
generateInvitationQrcode(userMainInfo, myUserInfo.getInvitationCode());
|
||||||
String view = wechatGetQrcodeService.getWxQrCode(myUserInfo.getInvitationCode());
|
|
||||||
userMainInfo.setInviteQrCode(view);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
userMainInfoService.save(userMainInfo);
|
|
||||||
|
|
||||||
// 查询上级用户的项目抽佣记录
|
// 批量保存当前用户的项目明细抽佣记录和下级用户项目明细抽佣记录
|
||||||
List<ProjectCommission> projectCommissionList = commonService.findByFieldEqTargetField(ProjectCommission::getUserId, parentUserInfo.getId(), projectCommissionService);
|
saveBatchProjectCommissionAndSubUserProjectCommission(myUserInfo.getId(), parentUserInfo.getId());
|
||||||
// 封装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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,14 +209,9 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||||||
@Override
|
@Override
|
||||||
public String userInfoMiniLoginByVcd(UserInfoMiniVerifyCodeLoginRequest userInfoMiniVerifyCodeLoginRequest) {
|
public String userInfoMiniLoginByVcd(UserInfoMiniVerifyCodeLoginRequest userInfoMiniVerifyCodeLoginRequest) {
|
||||||
String phoneNumber = userInfoMiniVerifyCodeLoginRequest.getPhoneNumber();
|
String phoneNumber = userInfoMiniVerifyCodeLoginRequest.getPhoneNumber();
|
||||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
|
||||||
|
|
||||||
String verificationCode = userInfoMiniVerifyCodeLoginRequest.getVerificationCode();
|
String verificationCode = userInfoMiniVerifyCodeLoginRequest.getVerificationCode();
|
||||||
String code = redisTemplate.opsForValue().get(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
// 校验用户手机号和验证码
|
||||||
ThrowUtils.throwIf(code == null, ErrorCode.OPERATION_ERROR, "验证码已失效");
|
checkPhoneAndVerificationCode(phoneNumber, verificationCode, null);
|
||||||
|
|
||||||
// // 移除验证码
|
|
||||||
// redisTemplate.delete(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
|
||||||
|
|
||||||
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber);
|
lambdaQueryWrapper.eq(UserInfo::getPhoneNumber, phoneNumber);
|
||||||
@ -282,14 +232,9 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||||||
@Override
|
@Override
|
||||||
public void userInfoMiniResetPwd(UserInfoResetRequest userInfoResetRequest, boolean isInner) {
|
public void userInfoMiniResetPwd(UserInfoResetRequest userInfoResetRequest, boolean isInner) {
|
||||||
String phoneNumber = userInfoResetRequest.getPhoneNumber();
|
String phoneNumber = userInfoResetRequest.getPhoneNumber();
|
||||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
|
||||||
|
|
||||||
String verificationCode = userInfoResetRequest.getVerificationCode();
|
String verificationCode = userInfoResetRequest.getVerificationCode();
|
||||||
String code = redisTemplate.opsForValue().get(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
// 校验用户手机号和验证码
|
||||||
ThrowUtils.throwIf(code == null, ErrorCode.OPERATION_ERROR, "验证码已失效");
|
checkPhoneAndVerificationCode(phoneNumber, verificationCode, null);
|
||||||
|
|
||||||
// // 移除验证码
|
|
||||||
// redisTemplate.delete(SystemConstant.VERIFICATION_CODE + ":" + verificationCode);
|
|
||||||
|
|
||||||
String userPassword = userInfoResetRequest.getUserPassword();
|
String userPassword = userInfoResetRequest.getUserPassword();
|
||||||
String userConfirmPassword = userInfoResetRequest.getUserConfirmPassword();
|
String userConfirmPassword = userInfoResetRequest.getUserConfirmPassword();
|
||||||
@ -340,6 +285,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序用户获取验证码(用于注册)
|
* 小程序用户获取验证码(用于注册)
|
||||||
*/
|
*/
|
||||||
@ -360,6 +306,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 getWxQrCode(String inviteCode) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 微信小程序获取课程码
|
// * 微信小程序获取课程码
|
||||||
*/
|
// */
|
||||||
String getWxCourseQrCode(CommonRequest courseQrcodeAddRequest, HttpServletRequest request) throws Exception;
|
// String getWxCourseQrCode(CommonRequest courseQrcodeAddRequest, HttpServletRequest request) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.greenorange.promotion.service.wechat;
|
||||||
|
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||||
|
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Refund;
|
||||||
|
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 陈新知
|
||||||
|
*/
|
||||||
|
public interface WechatPayService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付
|
||||||
|
*/
|
||||||
|
PrepayWithRequestPaymentResponse createPayment(String orderId, String miniOpenId, BigDecimal amount);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付回调
|
||||||
|
*/
|
||||||
|
boolean paymentCallback(Transaction transaction) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部分退款申请
|
||||||
|
*/
|
||||||
|
Refund refundPartPayment(String orderId, BigDecimal refundAmount);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部分退款回调
|
||||||
|
*/
|
||||||
|
boolean refundPartCallback(RefundNotification refundNotification);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取支付回调信息
|
||||||
|
*/
|
||||||
|
Transaction getTransactionInfo(HttpServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取退款回调信息
|
||||||
|
*/
|
||||||
|
RefundNotification getRefundInfo(HttpServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -17,13 +17,10 @@ import com.greenorange.promotion.exception.BusinessException;
|
|||||||
import com.greenorange.promotion.mapper.UserInfoMapper;
|
import com.greenorange.promotion.mapper.UserInfoMapper;
|
||||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||||
import com.greenorange.promotion.model.entity.Course;
|
import com.greenorange.promotion.model.entity.Course;
|
||||||
import com.greenorange.promotion.model.entity.CourseQrcodeApply;
|
|
||||||
import com.greenorange.promotion.model.entity.FileInfo;
|
import com.greenorange.promotion.model.entity.FileInfo;
|
||||||
import com.greenorange.promotion.model.entity.UserInfo;
|
import com.greenorange.promotion.model.entity.UserInfo;
|
||||||
import com.greenorange.promotion.service.course.CourseQrcodeApplyService;
|
|
||||||
import com.greenorange.promotion.service.course.CourseService;
|
import com.greenorange.promotion.service.course.CourseService;
|
||||||
import com.greenorange.promotion.service.file.FileInfoService;
|
import com.greenorange.promotion.service.file.FileInfoService;
|
||||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
|
||||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||||
import com.greenorange.promotion.utils.QRCodeUtil;
|
import com.greenorange.promotion.utils.QRCodeUtil;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -74,15 +71,6 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
|||||||
@Resource
|
@Resource
|
||||||
private FileInfoService fileInfoService;
|
private FileInfoService fileInfoService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private UserInfoMapper userInfoMapper;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseService courseService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CourseQrcodeApplyService courseQrcodeApplyService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取接口调用凭据
|
* 获取接口调用凭据
|
||||||
@ -207,146 +195,138 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 微信小程序获取课程码
|
// * 微信小程序获取课程码
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public String getWxCourseQrCode(CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
// public String getWxCourseQrCode(CommonRequest commonRequest, HttpServletRequest request) throws Exception {
|
||||||
String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
// String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
||||||
if (accessToken == null) {
|
// if (accessToken == null) {
|
||||||
accessToken = this.getAccessToken().getAccess_token();
|
// accessToken = this.getAccessToken().getAccess_token();
|
||||||
}
|
// }
|
||||||
// 获取用户邀请码
|
// // 获取用户邀请码
|
||||||
Long userId = (Long) request.getAttribute("userId");
|
// Long userId = (Long) request.getAttribute("userId");
|
||||||
UserInfo userInfo = userInfoMapper.selectById(userId);
|
// UserInfo userInfo = userInfoMapper.selectById(userId);
|
||||||
String invitationCode = userInfo.getInvitationCode();
|
// String invitationCode = userInfo.getInvitationCode();
|
||||||
// 获取课程信息
|
// // 获取课程信息
|
||||||
Long courseId = commonRequest.getId();
|
// Long courseId = commonRequest.getId();
|
||||||
Course course = courseService.getById(courseId);
|
// Course course = courseService.getById(courseId);
|
||||||
String courseTitle = course.getName();
|
// String courseTitle = course.getName();
|
||||||
String originalPrice = String.valueOf(course.getOriginPrice());
|
// String originalPrice = String.valueOf(course.getOriginPrice());
|
||||||
String discountPrice = String.valueOf(course.getDiscountPrice());
|
// String discountPrice = String.valueOf(course.getDiscountPrice());
|
||||||
String discountText = "元券后价";
|
// String discountText = "元券后价";
|
||||||
|
//
|
||||||
|
//
|
||||||
Map<String, Object> param = new HashMap<>();
|
// Map<String, Object> param = new HashMap<>();
|
||||||
param.put("page", "pages/loginModule/register/register");
|
// param.put("page", "pages/loginModule/register/register");
|
||||||
param.put("scene", "invitationCode=" + invitationCode + "&courseId=" + courseId);
|
// param.put("scene", "invitationCode=" + invitationCode + "&courseId=" + courseId);
|
||||||
param.put("width", 430);
|
// param.put("width", 430);
|
||||||
param.put("check_path", false);
|
// param.put("check_path", false);
|
||||||
param.put("env_version", "develop");
|
// param.put("env_version", "develop");
|
||||||
String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
|
// String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
|
||||||
String jsonParams = JSONUtil.toJsonStr(param);
|
// String jsonParams = JSONUtil.toJsonStr(param);
|
||||||
byte[] responseBytes = HttpUtil.createPost(url)
|
// byte[] responseBytes = HttpUtil.createPost(url)
|
||||||
.header("Content-Type", "application/json")
|
// .header("Content-Type", "application/json")
|
||||||
.body(jsonParams)
|
// .body(jsonParams)
|
||||||
.execute()
|
// .execute()
|
||||||
.bodyBytes();
|
// .bodyBytes();
|
||||||
|
//
|
||||||
String FontType = "Microsoft YaHei UI";
|
// String FontType = "Microsoft YaHei UI";
|
||||||
int FontStyle = Font.PLAIN;
|
// int FontStyle = Font.PLAIN;
|
||||||
|
//
|
||||||
// 加载一张空白图像
|
// // 加载一张空白图像
|
||||||
String blankUrl = "https://img.picui.cn/free/2025/06/21/6856a072e9eea.png";
|
// String blankUrl = "https://img.picui.cn/free/2025/06/21/6856a072e9eea.png";
|
||||||
ImageCombiner combiner = new ImageCombiner(blankUrl, 341, 391, ZoomMode.WidthHeight, OutputFormat.PNG);
|
// ImageCombiner combiner = new ImageCombiner(blankUrl, 341, 391, ZoomMode.WidthHeight, OutputFormat.PNG);
|
||||||
|
//
|
||||||
// 加载课程图片
|
// // 加载课程图片
|
||||||
String courseUrl = SystemConstant.FILE_COMMON_PREFIX + course.getImage();
|
// String courseUrl = SystemConstant.FILE_COMMON_PREFIX + course.getImage();
|
||||||
BufferedImage courseImage = ImageIO.read(new URL(courseUrl));
|
// BufferedImage courseImage = ImageIO.read(new URL(courseUrl));
|
||||||
|
//
|
||||||
// Graphics2D graphics = courseImage.createGraphics();
|
// // 将二维码数据转换为 BufferedImage
|
||||||
// graphics.setColor(Color.decode("#323232"));
|
// BufferedImage qrImage = ImageIO.read(new ByteArrayInputStream(responseBytes));
|
||||||
// graphics.setFont(new Font("阿里巴巴普惠体", Font.PLAIN, 60));
|
//
|
||||||
// graphics.drawString("测试", 0, 80);
|
// // 缩放图片(不失真)
|
||||||
// graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
|
// Image scaledImage = qrImage.getScaledInstance(134, 134, Image.SCALE_SMOOTH);
|
||||||
// graphics.drawString("测试", 0, 160);
|
// BufferedImage resizedImage = new BufferedImage(134, 134, BufferedImage.TYPE_INT_RGB);
|
||||||
// graphics.dispose();
|
// resizedImage.getGraphics().drawImage(scaledImage, 0, 0, null);
|
||||||
|
//
|
||||||
// 将二维码数据转换为 BufferedImage
|
// combiner.setQuality(1f);
|
||||||
BufferedImage qrImage = ImageIO.read(new ByteArrayInputStream(responseBytes));
|
//
|
||||||
|
// // 将课程图片合并到组合器中
|
||||||
// 缩放图片(不失真)
|
// combiner.addImageElement(courseImage, 18, 16, 306, 158, ZoomMode.WidthHeight).setRoundCorner(5).setCenter(true);
|
||||||
Image scaledImage = qrImage.getScaledInstance(134, 134, Image.SCALE_SMOOTH);
|
// // 将二维码图片合并到组合器中
|
||||||
BufferedImage resizedImage = new BufferedImage(134, 134, BufferedImage.TYPE_INT_RGB);
|
// combiner.addImageElement(resizedImage, 190, 240);
|
||||||
resizedImage.getGraphics().drawImage(scaledImage, 0, 0, null);
|
//
|
||||||
|
// // 绘制文本
|
||||||
combiner.setQuality(1f);
|
// TextElement courseTitleElement = new TextElement(courseTitle, FontType, FontStyle, 18, 20, 186);
|
||||||
|
// courseTitleElement.setColor(Color.decode("#323232"))
|
||||||
// 将课程图片合并到组合器中
|
// .setCenter(true)
|
||||||
combiner.addImageElement(courseImage, 18, 16, 306, 158, ZoomMode.WidthHeight).setRoundCorner(5).setCenter(true);
|
// .setAutoBreakLine(306);
|
||||||
// 将二维码图片合并到组合器中
|
// combiner.addElement(courseTitleElement);
|
||||||
combiner.addImageElement(resizedImage, 190, 240);
|
//
|
||||||
|
// TextElement originalPriceElement = new TextElement(originalPrice, FontType, FontStyle, 24, 56, 275);
|
||||||
// 绘制文本
|
// originalPriceElement.setColor(Color.decode("#8C8C8C")).setStrikeThrough(true);
|
||||||
TextElement courseTitleElement = new TextElement(courseTitle, FontType, FontStyle, 18, 20, 186);
|
// combiner.addElement(originalPriceElement);
|
||||||
courseTitleElement.setColor(Color.decode("#323232"))
|
//
|
||||||
.setCenter(true)
|
// TextElement discountedPriceElement = new TextElement(discountPrice, FontType, Font.BOLD, 28, 31, 343);
|
||||||
.setAutoBreakLine(306);
|
// discountedPriceElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base).setSpace(0.01f);
|
||||||
combiner.addElement(courseTitleElement);
|
// combiner.addElement(discountedPriceElement);
|
||||||
|
//
|
||||||
TextElement originalPriceElement = new TextElement(originalPrice, FontType, FontStyle, 24, 56, 275);
|
// TextElement discountedTextElement = new TextElement(discountText, FontType, FontStyle, 16, discountedPriceElement.getX() + discountedPriceElement.getWidth(), 341);
|
||||||
originalPriceElement.setColor(Color.decode("#8C8C8C")).setStrikeThrough(true);
|
// discountedTextElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base);
|
||||||
combiner.addElement(originalPriceElement);
|
// combiner.addElement(discountedTextElement);
|
||||||
|
//
|
||||||
TextElement discountedPriceElement = new TextElement(discountPrice, FontType, Font.BOLD, 28, 31, 343);
|
// combiner.combine();
|
||||||
discountedPriceElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base).setSpace(0.01f);
|
//
|
||||||
combiner.addElement(discountedPriceElement);
|
// InputStream resultStream = combiner.getCombinedImageStream();
|
||||||
|
// byte[] resultBytes = resultStream.readAllBytes();
|
||||||
TextElement discountedTextElement = new TextElement(discountText, FontType, FontStyle, 16, discountedPriceElement.getX() + discountedPriceElement.getWidth(), 341);
|
// // 创建上传目录,如果不存在
|
||||||
discountedTextElement.setColor(Color.decode("#F84947")).setBaseLine(BaseLine.Base);
|
// String biz = "default";
|
||||||
combiner.addElement(discountedTextElement);
|
// String fileName = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "." + "png";
|
||||||
|
// // 获取文件类型
|
||||||
combiner.combine();
|
// String fileType = FileUtil.getSuffix(fileName);
|
||||||
|
// // 获取view值
|
||||||
InputStream resultStream = combiner.getCombinedImageStream();
|
// String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
||||||
byte[] resultBytes = resultStream.readAllBytes();
|
// File file = new File(uploadDir + fileName);
|
||||||
// 创建上传目录,如果不存在
|
// if (!file.getParentFile().exists()) {
|
||||||
String biz = "default";
|
// file.getParentFile().mkdirs();// 如果路径不存在则创建
|
||||||
String fileName = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "." + "png";
|
// }
|
||||||
// 获取文件类型
|
// // 将文件上传到目标位置
|
||||||
String fileType = FileUtil.getSuffix(fileName);
|
// try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE)) {
|
||||||
// 获取view值
|
// bos.write(resultBytes);
|
||||||
String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
// } catch (IOException e) {
|
||||||
File file = new File(uploadDir + fileName);
|
// throw new BusinessException(ErrorCode.OPERATION_ERROR, "文件上传失败,失败原因:" + e.getMessage());
|
||||||
if (!file.getParentFile().exists()) {
|
// }
|
||||||
file.getParentFile().mkdirs();// 如果路径不存在则创建
|
//
|
||||||
}
|
// // 获取文件大小
|
||||||
// 将文件上传到目标位置
|
// Double fileSize = file.length() / 1024.0;
|
||||||
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE)) {
|
// fileSize = Double.valueOf(String.format("%.2f", fileSize));
|
||||||
bos.write(resultBytes);
|
// // 获取文件哈希值
|
||||||
} catch (IOException e) {
|
// InputStream inputStream = new FileInputStream(file);
|
||||||
throw new BusinessException(ErrorCode.OPERATION_ERROR, "文件上传失败,失败原因:" + e.getMessage());
|
// String hashValue = DigestUtils.sha256Hex(inputStream);
|
||||||
}
|
// // 保存文件
|
||||||
|
// FileInfo fileInfo = FileInfo.builder()
|
||||||
// 获取文件大小
|
// .name(fileName)
|
||||||
Double fileSize = file.length() / 1024.0;
|
// .type(fileType)
|
||||||
fileSize = Double.valueOf(String.format("%.2f", fileSize));
|
// .size(fileSize)
|
||||||
// 获取文件哈希值
|
// .fileView(view)
|
||||||
InputStream inputStream = new FileInputStream(file);
|
// .biz(biz)
|
||||||
String hashValue = DigestUtils.sha256Hex(inputStream);
|
// .hashValue(hashValue)
|
||||||
// 保存文件
|
// .build();
|
||||||
FileInfo fileInfo = FileInfo.builder()
|
// fileInfoService.save(fileInfo);
|
||||||
.name(fileName)
|
//
|
||||||
.type(fileType)
|
// String viewValue = biz + "-" + view;
|
||||||
.size(fileSize)
|
// // 保存课程推广码申请记录
|
||||||
.fileView(view)
|
// CourseQrcodeApply courseQrcodeApply = CourseQrcodeApply.builder()
|
||||||
.biz(biz)
|
// .userId(userId)
|
||||||
.hashValue(hashValue)
|
// .courseId(courseId)
|
||||||
.build();
|
// .courseQrcode(viewValue)
|
||||||
fileInfoService.save(fileInfo);
|
// .build();
|
||||||
|
// courseQrcodeApplyService.save(courseQrcodeApply);
|
||||||
String viewValue = biz + "-" + view;
|
// return viewValue;
|
||||||
// 保存课程推广码申请记录
|
// }
|
||||||
CourseQrcodeApply courseQrcodeApply = CourseQrcodeApply.builder()
|
|
||||||
.userId(userId)
|
|
||||||
.courseId(courseId)
|
|
||||||
.courseQrcode(viewValue)
|
|
||||||
.build();
|
|
||||||
courseQrcodeApplyService.save(courseQrcodeApply);
|
|
||||||
return viewValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,252 @@
|
|||||||
|
package com.greenorange.promotion.service.wechat.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.greenorange.promotion.common.ErrorCode;
|
||||||
|
import com.greenorange.promotion.config.WxPayConfig;
|
||||||
|
import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||||
|
import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
|
import com.greenorange.promotion.model.entity.Course;
|
||||||
|
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||||
|
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||||
|
import com.greenorange.promotion.service.course.CourseService;
|
||||||
|
import com.greenorange.promotion.service.wechat.WechatPayService;
|
||||||
|
import com.greenorange.promotion.utils.RefundUtils;
|
||||||
|
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||||
|
import com.wechat.pay.java.core.notification.RequestParam;
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.model.Payer;
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest;
|
||||||
|
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||||
|
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||||
|
import com.wechat.pay.java.service.refund.model.AmountReq;
|
||||||
|
import com.wechat.pay.java.service.refund.model.CreateRequest;
|
||||||
|
import com.wechat.pay.java.service.refund.model.Refund;
|
||||||
|
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 陈新知
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WechatPayServiceImpl implements WechatPayService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxPayConfig wxPayConfig;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CourseOrderService courseOrderService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CourseService courseService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求参数
|
||||||
|
*/
|
||||||
|
public static RequestParam requestParam = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PrepayWithRequestPaymentResponse createPayment(String orderId, String miniOpenId, BigDecimal amount) {
|
||||||
|
// request.setXxx(val)设置所需参数,具体参数可见Request定义
|
||||||
|
PrepayRequest request = new PrepayRequest();
|
||||||
|
// 金额
|
||||||
|
Amount WxAmount = new Amount();
|
||||||
|
WxAmount.setTotal(amount.movePointRight(2).intValue());
|
||||||
|
WxAmount.setCurrency("CNY");
|
||||||
|
request.setAmount(WxAmount);
|
||||||
|
// 公众号id
|
||||||
|
request.setAppid(wxPayConfig.getAppId());
|
||||||
|
// 商户号
|
||||||
|
request.setMchid(wxPayConfig.getMerchantId());
|
||||||
|
// 支付者信息
|
||||||
|
Payer payer = new Payer();
|
||||||
|
payer.setOpenid(miniOpenId);
|
||||||
|
request.setPayer(payer);
|
||||||
|
// 获取订单号
|
||||||
|
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||||
|
String orderNumber = courseOrder.getOrderNumber();
|
||||||
|
// 描述
|
||||||
|
request.setDescription("订单号:" + orderNumber);
|
||||||
|
// 微信回调地址
|
||||||
|
request.setNotifyUrl(wxPayConfig.getNotifyUrl() + "/wxPay/payment/callback");
|
||||||
|
// 商户订单号
|
||||||
|
request.setOutTradeNo(orderNumber);
|
||||||
|
//返回数据,前端调起支付
|
||||||
|
return wxPayConfig.getJsapiServiceExtension().prepayWithRequestPayment(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付回调
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean paymentCallback(Transaction transaction) throws IOException {
|
||||||
|
System.out.println("---------------------------微信支付回调(开始)-------------------------------");
|
||||||
|
// 获取订单信息
|
||||||
|
String orderNumber = transaction.getOutTradeNo();
|
||||||
|
LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CourseOrder::getOrderNumber, orderNumber);
|
||||||
|
CourseOrder courseOrder = courseOrderService.getOne(queryWrapper);
|
||||||
|
|
||||||
|
// 修改订单状态
|
||||||
|
LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(CourseOrder::getId, courseOrder.getId())
|
||||||
|
.set(CourseOrder::getOrderStatus, OrderStatusConstant.SUCCESS);
|
||||||
|
courseOrderService.update(updateWrapper);
|
||||||
|
|
||||||
|
// 修改当前课程下单人数
|
||||||
|
Long courseId = courseOrder.getCourseId();
|
||||||
|
Course course = courseService.getById(courseId);
|
||||||
|
if (course != null) {
|
||||||
|
course.setOrderCount(course.getOrderCount() + 1);
|
||||||
|
courseService.updateById(course);
|
||||||
|
}
|
||||||
|
System.out.println("---------------------------微信支付回调(结束)-------------------------------");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部分退款申请
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Refund refundPartPayment(String orderId, BigDecimal refundAmount) {
|
||||||
|
// 获取订单
|
||||||
|
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||||
|
ThrowUtils.throwIf(courseOrder == null, ErrorCode.OPERATION_ERROR, "订单不存在");
|
||||||
|
// 判断该订单是否已经退款
|
||||||
|
ThrowUtils.throwIf(courseOrder.getOrderStatus().equals(OrderStatusConstant.REFUNDED), ErrorCode.OPERATION_ERROR, "订单已退款");
|
||||||
|
|
||||||
|
String orderNumber = courseOrder.getOrderNumber();
|
||||||
|
// 退款请求
|
||||||
|
CreateRequest createRequest = new CreateRequest();
|
||||||
|
// 商户订单号
|
||||||
|
createRequest.setOutTradeNo(orderNumber);
|
||||||
|
// 商户退款单号
|
||||||
|
String outRefundNo = RefundUtils.generateRefundNo();
|
||||||
|
createRequest.setOutRefundNo(outRefundNo);
|
||||||
|
// 退款结果回调
|
||||||
|
createRequest.setNotifyUrl(wxPayConfig.getNotifyUrl() + "/wxPay/refund/part/callback");
|
||||||
|
// 退款金额
|
||||||
|
AmountReq amountReq = new AmountReq();
|
||||||
|
|
||||||
|
amountReq.setRefund(refundAmount.movePointRight(2).longValue());
|
||||||
|
amountReq.setTotal(courseOrder.getTotalAmount().movePointRight(2).longValue());
|
||||||
|
amountReq.setCurrency("CNY");
|
||||||
|
createRequest.setAmount(amountReq);
|
||||||
|
|
||||||
|
//TODO 生成退款记录
|
||||||
|
|
||||||
|
// 申请退款
|
||||||
|
System.out.println("退款请求:" + createRequest);
|
||||||
|
Refund refund = wxPayConfig.getRefundService().create(createRequest);
|
||||||
|
System.out.println("退款申请结果:" + refund);
|
||||||
|
|
||||||
|
return refund;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部分退款回调
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean refundPartCallback(RefundNotification refundNotification) {
|
||||||
|
System.out.println("---------------------------微信退款回调(开始)-------------------------------");
|
||||||
|
// 获取订单信息
|
||||||
|
String orderNumber = refundNotification.getOutTradeNo();
|
||||||
|
LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CourseOrder::getOrderNumber, orderNumber);
|
||||||
|
CourseOrder courseOrder = courseOrderService.getOne(queryWrapper);
|
||||||
|
|
||||||
|
// 修改订单状态
|
||||||
|
LambdaUpdateWrapper<CourseOrder> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(CourseOrder::getId, courseOrder.getId())
|
||||||
|
.set(CourseOrder::getOrderStatus, OrderStatusConstant.REFUNDED);
|
||||||
|
courseOrderService.update(updateWrapper);
|
||||||
|
|
||||||
|
// 修改课程下单人数
|
||||||
|
Long courseId = courseOrder.getCourseId();
|
||||||
|
Course course = courseService.getById(courseId);
|
||||||
|
if (course != null) {
|
||||||
|
course.setOrderCount(course.getOrderCount() - 1);
|
||||||
|
courseService.updateById(course);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("---------------------------微信退款回调(结束)-------------------------------");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取支付回调信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Transaction getTransactionInfo(HttpServletRequest request) {
|
||||||
|
NotificationParser notificationParser = getNotificationParser(request);
|
||||||
|
return notificationParser.parse(requestParam, Transaction.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取退款回调信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RefundNotification getRefundInfo(HttpServletRequest request) {
|
||||||
|
NotificationParser notificationParser = getNotificationParser(request);
|
||||||
|
return notificationParser.parse(requestParam, RefundNotification.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据微信官方发送的请求获取信息
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public NotificationParser getNotificationParser(HttpServletRequest request) {
|
||||||
|
System.out.println("---------------------------获取信息-------------------------------");
|
||||||
|
// 获取RSA配置
|
||||||
|
NotificationParser notificationParser = new NotificationParser(wxPayConfig.getRSAConfig());
|
||||||
|
// 构建请求
|
||||||
|
StringBuilder bodyBuilder = new StringBuilder();
|
||||||
|
BufferedReader reader = request.getReader();
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
bodyBuilder.append(line);
|
||||||
|
}
|
||||||
|
String body = bodyBuilder.toString();
|
||||||
|
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||||
|
String nonce = request.getHeader("Wechatpay-Nonce");
|
||||||
|
String signature = request.getHeader("Wechatpay-Signature");
|
||||||
|
String singType = request.getHeader("Wechatpay-Signature-Type");
|
||||||
|
String wechatPayCertificateSerialNumber = request.getHeader("Wechatpay-Serial");
|
||||||
|
requestParam = new RequestParam.Builder()
|
||||||
|
.serialNumber(wechatPayCertificateSerialNumber)
|
||||||
|
.nonce(nonce)
|
||||||
|
.signature(signature)
|
||||||
|
.timestamp(timestamp)
|
||||||
|
.signType(singType)
|
||||||
|
.body(body)
|
||||||
|
.build();
|
||||||
|
System.out.println(requestParam.toString());
|
||||||
|
System.out.println("---------------------------信息获取完毕-------------------------------");
|
||||||
|
return notificationParser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.greenorange.promotion.utils;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MultiDelayMessage<T> implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息体
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录延时时间的集合
|
||||||
|
*/
|
||||||
|
private List<Long> delayMillis;
|
||||||
|
|
||||||
|
public MultiDelayMessage(T data, List<Long> delayMillis) {
|
||||||
|
this.data = data;
|
||||||
|
this.delayMillis = delayMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiDelayMessage(T data, Long...delayMillis) {
|
||||||
|
this.data = data;
|
||||||
|
this.delayMillis = new ArrayList<>(Arrays.asList(delayMillis));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取并移除下一个延迟时间
|
||||||
|
* @return 集合中第一个延迟时间
|
||||||
|
*/
|
||||||
|
public Long removeNextDelay() {
|
||||||
|
return delayMillis.remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有下一个延迟时间
|
||||||
|
*/
|
||||||
|
public boolean hasNextDelay() {
|
||||||
|
return !delayMillis.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.greenorange.promotion.utils;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class RefundUtils {
|
||||||
|
|
||||||
|
// 生成唯一的全额退款单号,格式为 yyyyMMddHHmmssSSS + 随机数
|
||||||
|
public static String generateRefundNo() {
|
||||||
|
// 获取当前时间的时间戳
|
||||||
|
String timestamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
|
||||||
|
|
||||||
|
// 生成一个 4 位随机数,保证每次退款单号不同
|
||||||
|
int randomNum = new Random().nextInt(9000) + 1000; // 生成1000到9999之间的随机数
|
||||||
|
|
||||||
|
// 拼接退款单号
|
||||||
|
return timestamp + randomNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
src/main/resources/apiclient_key.pem
Normal file
28
src/main/resources/apiclient_key.pem
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDQvDoLQ9+041aV
|
||||||
|
lLvDgIdhenuq54wx+UeuIWd2Zc4E4Io+47PCr6kzpbkLhq47//dKAG1Fobb2vCRu
|
||||||
|
HG+CUfhkOzYLxt9qC4k9TOAtQPWp3Hc3dTldw42C/pGzh8aro7rHtpRHDzQYdJgB
|
||||||
|
w4dPQ0+RoZ2U9meiGWsy2DVOydPVxabxN9gFeeP5FRKjZP2JUAoKJRgWrBD9Fgyn
|
||||||
|
mX/crOa8z5HTBK/LY+jBy57Bp9ZpUS9nDIpXSgdI7mZn3xvLmGfjki8WG9X8Ad99
|
||||||
|
jvyTzD0HDcm7XoGo+Rp2Evh0pqQQf33R/OkH1WIFtcrqfwGUugTLDfIrFvDr3Qgc
|
||||||
|
KE2Z2U7pAgMBAAECggEAXgIn8iLjgchRmpSd6/LbBh/vyoz2KxumGNqaikxXeQLX
|
||||||
|
wHM05p3OiqA8suA5YHRrnzyJ+i5XBNC/Z4gPAJaCVEIGmU88F7qSWLVi0X7MJXBR
|
||||||
|
kPyOlZgZB8I3RLAF3g+jc4bbSRWj1M/OFh1Ft4ENOP2cxxYinnLsQL33ZECp00Cc
|
||||||
|
IXlX4lqjkoFbBaeCZLEV5tzZ3R/NsYZ5HTtvEh+vX7WdIqmgfL/cndfC+fIlWqbi
|
||||||
|
kKITyfI//Ik02/07qbFaZOwCLAQccUBT/0K8v7b0rqr0XeiqN3a+lXkVY6DpFxXx
|
||||||
|
aplsZ8rljBZ51AcAw8bS/JpwMkAQ5tYbgN2luEq3MQKBgQD/x2yk6YECbutRDsFA
|
||||||
|
EOlZK1cwMbJSkCMgVxIrfzv0Ubj937CCzZ7StxiHCxAa3+Oj8uX3aL57ZEatudyU
|
||||||
|
PsbZP6WWMqD3HiWUZoD1qcqRbp57FR9a3sFkgXoN9o93xdLiUS8LVAVLaqGSfO76
|
||||||
|
o7euReXlK+hNAFmkAwFsPnVdawKBgQDQ6mWSaefUfDVddw8mPdgCtjCIKMBWTNs9
|
||||||
|
U0ygVEsDs2FDxcC8175GQBbCNvtgh7DxWfOs847TVjH2CpZk74vSyt0Y59295Xx+
|
||||||
|
t4Vn3CHCBxvYGIRCTOXjBRRUOxQLXjb+X6XN3y9pxhkhVdwr5m5q49JIWcNyNuAJ
|
||||||
|
LTqq6CLl+wKBgAjaAeyDGC/ZXtNjS1TIQQsQ8Od+EMnCqzSHTt2qfYyq91fx0c31
|
||||||
|
B7YLGBI0U85aSSp3UXYKbe0fP0Lr17JZqdAC39wezGtA49QK6BOYWKZHybxAsuEW
|
||||||
|
LGMqB+tLyRNACVhDrvkZY0WE3yqOoEaUO9sQGDCiIFvp0zBV2krArpcZAoGAHiwM
|
||||||
|
GVY0RireJi6AwJwj61hWsAN6q7wT2cqDAZDK+LDadkhEKsHZ2Bl/b/My4OEX+/Nq
|
||||||
|
zuqqEPmc45Tp3Y//GKV1wxgRnVBcZ4yntrVDJtuR+Oapi03B0cS1B+k0XuPve1Nj
|
||||||
|
BdWa6mLS1E6rKqfwAH4Aq7RTFta4Cns+wtod2CsCgYAu7gHrFJfB6C/Dl93ZXTiL
|
||||||
|
HQdxpk0+L0hmXYaHFVK+0L2lswd7jlx6NLE3CNKEbUVr2fdhi8Qr2PLqiK/sAUCD
|
||||||
|
yRN6z17oSZ6eUfax5wKO5yXkuKq9DAoWpLitLgQmrxV1xfBx/q8ojVnFAG17q3F+
|
||||||
|
lN+FSz/IRCR9pAaVuVKw0w==
|
||||||
|
-----END PRIVATE KEY-----
|
@ -19,7 +19,7 @@ spring:
|
|||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
port: 6379
|
port: 6379
|
||||||
host: 27.30.77.229
|
host: 160.202.242.36
|
||||||
database: 7
|
database: 7
|
||||||
password: Cksys6509
|
password: Cksys6509
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://27.30.77.229:3306/qingcheng_dev?serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://160.202.242.36:3306/qingcheng_dev?serverTimezone=Asia/Shanghai
|
||||||
username: qingcheng
|
username: qingcheng
|
||||||
password: Qc@8ls2jf
|
password: Qc@8ls2jf
|
||||||
hikari:
|
hikari:
|
||||||
@ -9,11 +9,21 @@ spring:
|
|||||||
max-lifetime: 120000
|
max-lifetime: 120000
|
||||||
|
|
||||||
|
|
||||||
|
rabbitmq:
|
||||||
|
host: 160.202.242.36
|
||||||
|
port: 5672
|
||||||
|
username: qingcheng
|
||||||
|
password: cksys6509
|
||||||
|
virtual-host: vhost
|
||||||
|
listener:
|
||||||
|
simple:
|
||||||
|
prefetch: 1
|
||||||
|
|
||||||
|
|
||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
port: 6379
|
port: 6379
|
||||||
host: 27.30.77.229
|
host: 160.202.242.36
|
||||||
database: 9
|
database: 9
|
||||||
password: Cksys6509
|
password: Cksys6509
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://27.30.77.229:3306/qingcheng_practice?serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://160.202.242.36:3306/qingcheng_practice?serverTimezone=Asia/Shanghai
|
||||||
username: yyt&jwh
|
username: yyt&jwh
|
||||||
password: Qc@A8k3M5q2
|
password: Qc@A8k3M5q2
|
||||||
hikari:
|
hikari:
|
||||||
@ -13,7 +13,7 @@ spring:
|
|||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
port: 6379
|
port: 6379
|
||||||
host: 27.30.77.229
|
host: 160.202.242.36
|
||||||
database: 10
|
database: 10
|
||||||
password: Cksys6509
|
password: Cksys6509
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://27.30.77.229:3306/qingcheng_test?serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://160.202.242.36:3306/qingcheng_test?serverTimezone=Asia/Shanghai
|
||||||
username: qingcheng
|
username: qingcheng
|
||||||
password: Qc@8ls2jf
|
password: Qc@8ls2jf
|
||||||
hikari:
|
hikari:
|
||||||
@ -13,7 +13,7 @@ spring:
|
|||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
port: 6379
|
port: 6379
|
||||||
host: 27.30.77.229
|
host: 160.202.242.36
|
||||||
database: 8
|
database: 8
|
||||||
password: Cksys6509
|
password: Cksys6509
|
||||||
|
|
||||||
@ -75,12 +75,12 @@ wx:
|
|||||||
appId: wx61b63e27bddf4ea2
|
appId: wx61b63e27bddf4ea2
|
||||||
#商户号
|
#商户号
|
||||||
merchantId: 1700326544
|
merchantId: 1700326544
|
||||||
# #商户API私钥
|
#商户API私钥
|
||||||
# privateKeyPath: apiclient_key.pem
|
privateKeyPath: apiclient_key.pem
|
||||||
#商户证书序列号
|
#商户证书序列号
|
||||||
merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
merchantSerialNumber: 6DC8953AB741D309920DA650B92F837BE38A2757
|
||||||
# #商户APIv3密钥
|
#商户APIv3密钥
|
||||||
# apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
apiV3Key: fbemuj4Xql7CYlQJAoTEPYxvPSNgYT2t
|
||||||
#通知地址
|
#通知地址
|
||||||
notifyUrl: https://winning-mouse-internally.ngrok-free.app
|
notifyUrl: https://winning-mouse-internally.ngrok-free.app
|
||||||
#微信服务器地址
|
#微信服务器地址
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: practice
|
active: test
|
||||||
|
|
||||||
|
@ -2,23 +2,22 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"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"/>
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
<result property="duration" column="duration" jdbcType="VARCHAR"/>
|
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||||
<result property="permissions" column="permissions" jdbcType="OTHER"/>
|
<result property="resume" column="resume" jdbcType="VARCHAR"/>
|
||||||
<result property="videoView" column="videoView" jdbcType="VARCHAR"/>
|
<result property="reviewStatus" column="reviewStatus" jdbcType="OTHER"/>
|
||||||
<result property="courseId" column="courseId" jdbcType="BIGINT"/>
|
|
||||||
<result property="isDelete" column="isDelete" jdbcType="TINYINT"/>
|
<result property="isDelete" column="isDelete" jdbcType="TINYINT"/>
|
||||||
<result property="createTime" column="createTime" jdbcType="TIMESTAMP"/>
|
<result property="createTime" column="createTime" jdbcType="TIMESTAMP"/>
|
||||||
<result property="updateTime" column="updateTime" jdbcType="TIMESTAMP"/>
|
<result property="updateTime" column="updateTime" jdbcType="TIMESTAMP"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id,name,duration,
|
id,name,phone,
|
||||||
permissions,videoView,courseId,
|
resume,reviewStatus,isDelete,
|
||||||
isDelete,createTime,updateTime
|
createTime,updateTime
|
||||||
</sql>
|
</sql>
|
||||||
</mapper>
|
</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