Compare commits
45 Commits
097bbb9b55
...
dev
Author | SHA1 | Date | |
---|---|---|---|
6b2bce2b61 | |||
f38160c3f6 | |||
6e31701403 | |||
1ad79f600d | |||
c87006e721 | |||
6985cf39aa | |||
5b4d2afc5a | |||
3daffdf323 | |||
927fab3bdd | |||
f0f2b779f8 | |||
b2335d34a5 | |||
62ce63249c | |||
f699b49c0f | |||
f450a785f4 | |||
bb0066dc45 | |||
1e1a031f64 | |||
104a2b573e | |||
c386ba4bd8 | |||
92febde186 | |||
d30a3d1bcb | |||
4a5082413a | |||
4a3eac9066 | |||
02ad26dcdd | |||
3a27a4d091 | |||
acddaf8dbc | |||
538147ffda | |||
74976f5085 | |||
fd0504f477 | |||
66793d69f6 | |||
d53ba21026 | |||
6f1b3b0cc6 | |||
a341565fd4 | |||
6ac8765b39 | |||
455802ee9f | |||
e8a3317c70 | |||
c2972e7d9f | |||
d13bd60a84 | |||
dbf924d9e9 | |||
e1631895ee | |||
64eebd980e | |||
453f53c763 | |||
3b8f62cc7f | |||
bd0a481b94 | |||
8e578a9542 | |||
bca95d683d |
@ -5,7 +5,9 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.greenorange.promotion.mapper")
|
||||
public class GreenOrangeApplication {
|
||||
|
@ -4,6 +4,7 @@ import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
@ -20,6 +21,8 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@ -55,32 +58,56 @@ public class PermissionCheck {
|
||||
ThrowUtils.throwIf(interfaceRoleEnum == null, ErrorCode.NO_AUTH_ERROR);
|
||||
// 获取用户权限
|
||||
String token = request.getHeader("Authorization");
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(token), ErrorCode.NO_AUTH_ERROR, "JWT为空");
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(token), ErrorCode.NO_AUTH_ERROR, "token为空");
|
||||
// 解析token
|
||||
DecodedJWT decodedJWT = jwtUtils.verify(token);
|
||||
DecodedJWT decodedJWT;
|
||||
try {
|
||||
decodedJWT = jwtUtils.verify(token);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(ErrorCode.NO_AUTH_ERROR, "token已过期");
|
||||
}
|
||||
String userAccount = decodedJWT.getClaim("userAccount").asString();
|
||||
String userPassword = decodedJWT.getClaim("userPassword").asString();
|
||||
String userRole = decodedJWT.getClaim("userRole").asString();
|
||||
// 查询用户信息
|
||||
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserInfo::getUserAccount, userAccount).eq(UserInfo::getUserPassword, userPassword);
|
||||
// 如果是小程序用户, 就加上权限条件
|
||||
lambdaQueryWrapper.eq(StringUtils.isNotBlank(userRole), UserInfo::getUserRole, userRole);
|
||||
UserInfo userInfo = userInfoService.getOne(lambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(userInfo == null, ErrorCode.OPERATION_ERROR, "用户不存在");
|
||||
// 将用户id存入request,用于记录日志
|
||||
// 将用户id存入request,方便后续在接口中使用
|
||||
request.setAttribute("userId", userInfo.getId());
|
||||
|
||||
// 获取用户权限的枚举类
|
||||
String userRole = userInfo.getUserRole();
|
||||
if (userRole == null) userRole = userInfo.getUserRole();
|
||||
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
|
||||
// 接口权限只能是 USER,ADMIN,BOSS,用户权限是 ADMIN,BOSS,USER,BAN,MANAGER,SUPERVISOR,STAFF
|
||||
// 校验角色
|
||||
ThrowUtils.throwIf(UserRoleEnum.BOSS.equals(userRoleEnum) && UserRoleEnum.USER.equals(interfaceRoleEnum), ErrorCode.NO_AUTH_ERROR);
|
||||
ThrowUtils.throwIf(UserRoleEnum.ADMIN.equals(userRoleEnum) && !UserRoleEnum.ADMIN.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);
|
||||
Map<UserRoleEnum, Integer> userRoleMap = new HashMap<>();
|
||||
userRoleMap.put(UserRoleEnum.USER, 1);
|
||||
userRoleMap.put(UserRoleEnum.STAFF, 2);
|
||||
userRoleMap.put(UserRoleEnum.SUPERVISOR, 3);
|
||||
userRoleMap.put(UserRoleEnum.MANAGER, 4);
|
||||
userRoleMap.put(UserRoleEnum.ADMIN, 5);
|
||||
userRoleMap.put(UserRoleEnum.BOSS, 6);
|
||||
|
||||
Integer userRoleNumber = userRoleMap.get(userRoleEnum);
|
||||
Integer interfaceRoleNumber = userRoleMap.get(interfaceRoleEnum);
|
||||
if (userRoleNumber == 1) {
|
||||
ThrowUtils.throwIf(interfaceRoleNumber > 1, ErrorCode.NO_AUTH_ERROR);
|
||||
} else if (userRoleNumber == 2) {
|
||||
ThrowUtils.throwIf(interfaceRoleNumber > 2, ErrorCode.NO_AUTH_ERROR);
|
||||
} else if (userRoleNumber == 3) {
|
||||
ThrowUtils.throwIf(interfaceRoleNumber > 3, ErrorCode.NO_AUTH_ERROR);
|
||||
} else if (userRoleNumber == 4) {
|
||||
ThrowUtils.throwIf(interfaceRoleNumber > 4, ErrorCode.NO_AUTH_ERROR);
|
||||
} else if (userRoleNumber == 5) {
|
||||
ThrowUtils.throwIf(interfaceRoleNumber != 5, ErrorCode.NO_AUTH_ERROR);
|
||||
} else {
|
||||
ThrowUtils.throwIf(interfaceRoleNumber < 5, ErrorCode.NO_AUTH_ERROR);
|
||||
}
|
||||
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
|
@ -16,15 +16,27 @@ public class CorsConfig {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<CorsFilter> corsFilter() {
|
||||
// 1. 准备一个“规则源”,用于给不同路径配置 CORS 规则
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
// 2. 创建一个“跨域配置”对象,往里填各种允许/不允许的选项
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 携带cookie
|
||||
// 【允许携带 Cookie 这类 “凭证”】
|
||||
config.setAllowCredentials(true);
|
||||
// 放行哪些域名(必须用 patterns,否则 * 会和 allowCredentials 冲突)
|
||||
// 【允许的来源域名】
|
||||
// 用通配符 "*",表示不管从哪个域来的,都允许。
|
||||
// 这里用的是 addAllowedOriginPattern,而不是 addAllowedOrigin,
|
||||
// 是为了和 allowCredentials(true) 一起使用时不报错。
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 【允许的请求头】
|
||||
// 客户端可以带哪些自定义的 HTTP 头,比如 Content-Type、X-Token…
|
||||
config.addAllowedHeader("*");
|
||||
// 【允许的请求方法】
|
||||
// GET、POST、PUT、DELETE、OPTIONS……所有都放行
|
||||
config.addAllowedMethod("*");
|
||||
// 把上面这套“跨域规则”注册到所有接口路径(/**)
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
// 3.用这套规则,创建一个 CorsFilter 过滤器,
|
||||
// 4.并把它交给 Spring 管理,优先级设为最高
|
||||
FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));
|
||||
bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||
return bean;
|
||||
|
@ -18,8 +18,13 @@ public class RedisConfig {
|
||||
|
||||
// 指定kv的序列化方式
|
||||
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
|
||||
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
|
||||
// 普通 KV 用 JSON 序列化 value,用字符串序列化 key
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
|
||||
|
||||
// Hash 类型:hashKey 用字符串序列化,hashValue 也用字符串
|
||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.setHashValueSerializer(new StringRedisSerializer());
|
||||
|
||||
return redisTemplate;
|
||||
}
|
||||
|
@ -1,44 +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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//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;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
@ -1,78 +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();
|
||||
}
|
||||
|
||||
}
|
||||
//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();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
@ -13,6 +13,6 @@ public interface CommonConstant {
|
||||
/**
|
||||
* 降序
|
||||
*/
|
||||
String SORT_ORDER_DESC = " descend";
|
||||
|
||||
String SORT_ORDER_DESC = "descend";
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.greenorange.promotion.constant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MqConstant {
|
||||
|
||||
List<Long> DELAY_MILLIS = List.of(10000L, 10000L, 10000L, 15000L, 15000L, 30000L, 30000L, 60000L, 60000L, 120000L, 120000L, 120000L, 300000L);
|
||||
|
||||
// List<Long> DELAY_MILLIS = List.of(10000L, 10000L, 10000L, 15000L, 15000L);
|
||||
|
||||
String DELAY_EXCHANGE = "delay.topic";
|
||||
|
||||
String DELAY_ORDER_QUEUE = "order.delay.queue";
|
||||
|
||||
String DELAY_ORDER_ROUTING_KEY = "order.key";
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.greenorange.promotion.constant;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public interface SystemConstant {
|
||||
|
||||
/**
|
||||
@ -11,6 +13,36 @@ public interface SystemConstant {
|
||||
/**
|
||||
* 文件公共前缀
|
||||
*/
|
||||
String FILE_COMMON_PREFIX = "http://27.30.77.229:9091/file/download/";
|
||||
String FILE_COMMON_PREFIX = "http://160.202.242.36:9091/file/download/";
|
||||
|
||||
|
||||
/**
|
||||
* 默认头像view值
|
||||
*/
|
||||
String DEFAULT_AVATAR_VIEW = "default-QU7P9SD5";
|
||||
|
||||
|
||||
/**
|
||||
* 一级抽成比例
|
||||
*/
|
||||
BigDecimal FIRST_LEVEL_COMMISSION_RATE = new BigDecimal("0.02");
|
||||
|
||||
|
||||
/**
|
||||
* 二级抽成比例
|
||||
*/
|
||||
BigDecimal SECOND_LEVEL_COMMISSION_RATE = new BigDecimal("0.03");
|
||||
|
||||
|
||||
/**
|
||||
* 退款比例
|
||||
*/
|
||||
BigDecimal REFUND_RATE = new BigDecimal("0.8");
|
||||
|
||||
|
||||
/**
|
||||
* 手续费比例
|
||||
*/
|
||||
BigDecimal FEE_RATE = new BigDecimal("0.2");
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public interface UserConstant {
|
||||
/**
|
||||
* 用户默认头像
|
||||
*/
|
||||
String USER_DEFAULT_AVATAR = "";
|
||||
String USER_DEFAULT_AVATAR = SystemConstant.DEFAULT_AVATAR_VIEW;
|
||||
|
||||
|
||||
/**
|
||||
@ -58,4 +58,13 @@ public interface UserConstant {
|
||||
*/
|
||||
String STAFF_ROLE = "staff";
|
||||
|
||||
/**
|
||||
* 员工申请须知
|
||||
*/
|
||||
String APPLY_NOTICE_KEY = "applyNotice";
|
||||
|
||||
/**
|
||||
* 课程购买须知
|
||||
*/
|
||||
String COURSE_DESC_KEY = "courseDesc";
|
||||
}
|
||||
|
@ -0,0 +1,149 @@
|
||||
package com.greenorange.promotion.controller.course;
|
||||
|
||||
|
||||
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.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
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.data.redis.core.RedisTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 轮播图 控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("banner")
|
||||
@Slf4j
|
||||
@Tag(name = "轮播图模块")
|
||||
@Transactional
|
||||
public class BannerController {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
|
||||
private static final String BANNER_KEY = "banners:list";
|
||||
|
||||
private static final String TOMBSTONE = "\u0000__DEL__\u0000"; // 删除占位符,极低冲突
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员添加轮播图
|
||||
* @param commonStringRequest 图片view值
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "web端管理员添加轮播图", description = "参数:图片view值,权限:管理员,方法名:addBanner")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> addBanner(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String view = commonStringRequest.getTemplateString();
|
||||
redisTemplate.opsForList().rightPush(BANNER_KEY, view);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除轮播图(根据索引)
|
||||
* @param index 索引
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("del")
|
||||
@Operation(summary = "删除轮播图(根据索引)", description = "参数:图片view值,权限:管理员,方法名:delBanner")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> delBanner(@RequestParam long index) {
|
||||
long len = getLenOrThrow();
|
||||
long idx = normalizeIndex(index, len);
|
||||
try {
|
||||
// 先把该位置设置为占位符
|
||||
redisTemplate.opsForList().set(BANNER_KEY, idx, TOMBSTONE);
|
||||
// 再删除第一个占位符
|
||||
Long removed = redisTemplate.opsForList().remove(BANNER_KEY, 1, TOMBSTONE);
|
||||
boolean ok = removed != null && removed > 0;
|
||||
log.info("按索引删除轮播图:index={}, removed={}", idx, ok);
|
||||
return ResultUtils.success(ok);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "索引越界或参数错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改轮播图(根据索引)
|
||||
* @param index 索引
|
||||
* @param newView 新的图片view值
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("modify")
|
||||
@Operation(summary = "修改轮播图(根据索引)", description = "参数:图片view值,权限:管理员,方法名:delBanner")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> modifyBanner(@RequestParam long index, @RequestParam String newView) {
|
||||
long len = getLenOrThrow();
|
||||
long idx = normalizeIndex(index, len); // 支持 -1
|
||||
try {
|
||||
redisTemplate.opsForList().set(BANNER_KEY, idx, newView);
|
||||
log.info("更新轮播图:index={} -> {}", idx, newView);
|
||||
return ResultUtils.success(true);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "索引越界或参数错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端获取所有轮播图(按添加顺序)
|
||||
*/
|
||||
@GetMapping("web/list")
|
||||
@Operation(summary = "web端获取所有轮播图(按添加顺序)", description = "按添加顺序返回")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<List<String>> webListBanners() {
|
||||
List<String> banners = redisTemplate.opsForList().range(BANNER_KEY, 0, -1);
|
||||
return ResultUtils.success(banners);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端获取所有轮播图(按添加顺序)
|
||||
*/
|
||||
@GetMapping("mini/list")
|
||||
@Operation(summary = "小程序端获取所有轮播图(按添加顺序)", description = "按添加顺序返回")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<List<String>> miniListBanners() {
|
||||
List<String> banners = redisTemplate.opsForList().range(BANNER_KEY, 0, -1);
|
||||
return ResultUtils.success(banners);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ===== 工具方法 ===== */
|
||||
|
||||
/** 获取列表长度,不存在或为空时抛错 */
|
||||
private long getLenOrThrow() {
|
||||
Long len = redisTemplate.opsForList().size(BANNER_KEY);
|
||||
if (len == null || len == 0) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "轮播图列表为空");
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/** 归一化索引(支持负索引),并做范围校验 */
|
||||
private long normalizeIndex(long index, long len) {
|
||||
long idx = index < 0 ? len + index : index; // -1 -> len-1
|
||||
if (idx < 0 || idx >= len) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "索引越界:" + index);
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
}
|
@ -30,6 +30,7 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -48,6 +49,7 @@ import java.util.stream.Collectors;
|
||||
@RequestMapping("course")
|
||||
@Slf4j
|
||||
@Tag(name = "课程模块")
|
||||
@Transactional
|
||||
public class CourseController {
|
||||
|
||||
@Resource
|
||||
@ -95,6 +97,26 @@ public class CourseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据名称搜索课程
|
||||
* @param commonStringRequest 搜索关键词
|
||||
* @return 课程信息列表
|
||||
*/
|
||||
@PostMapping("query/keyword")
|
||||
@Operation(summary = "小程序端用户根据类别查看课程列表", description = "参数:搜索关键词,权限:管理员,方法名:miniQueryCourseByKeyword")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "课程管理", content = "小程序端用户根据名称搜索课程")
|
||||
public BaseResponse<List<CourseCardVO>> miniQueryCourseByKeyword(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String keyword = commonStringRequest.getTemplateString();
|
||||
LambdaQueryWrapper<Course> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Course::getIsShelves, 1);
|
||||
lambdaQueryWrapper.like(Course::getName, keyword);
|
||||
List<Course> courseList = courseService.list(lambdaQueryWrapper);
|
||||
List<CourseCardVO> courseCardVOS = commonService.convertList(courseList, CourseCardVO.class);
|
||||
return ResultUtils.success(courseCardVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据id查询课程详情
|
||||
* @param commonRequest 课程id
|
||||
|
@ -10,6 +10,7 @@ import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
import com.greenorange.promotion.constant.SystemConstant;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
@ -17,14 +18,20 @@ import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.courseOrder.CourseOrderAddRequest;
|
||||
import com.greenorange.promotion.model.dto.courseOrder.CourseOrderQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.courseOrder.CourseOrderUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.Course;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.model.entity.*;
|
||||
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.model.vo.course.CourseCardVO;
|
||||
import com.greenorange.promotion.model.vo.course.CourseVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderBaseInfoVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderCardVO;
|
||||
import com.greenorange.promotion.model.vo.courseOrder.CourseOrderVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||
import com.greenorange.promotion.service.course.CourseService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserPerformanceSummaryService;
|
||||
import com.greenorange.promotion.utils.OrderNumberUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -32,13 +39,17 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
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.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
/**
|
||||
@ -48,6 +59,7 @@ import java.util.List;
|
||||
@RequestMapping("courseOrder")
|
||||
@Slf4j
|
||||
@Tag(name = "课程订单模块")
|
||||
@Transactional
|
||||
public class CourseOrderController {
|
||||
|
||||
@Resource
|
||||
@ -59,6 +71,15 @@ public class CourseOrderController {
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Resource
|
||||
private UserPerformanceSummaryService userPerformanceSummaryService;
|
||||
|
||||
@Resource
|
||||
private CoursePromotionCommissionPendingService coursePromotionCommissionPendingService;
|
||||
|
||||
/**
|
||||
* 小程序端用户生成课程订单
|
||||
* @param courseOrderAddRequest 课程id
|
||||
@ -70,18 +91,173 @@ public class CourseOrderController {
|
||||
@SysLog(title = "课程订单管理", content = "小程序端用户生成课程订单")
|
||||
public BaseResponse<Long> addCourseOrder(@Valid @RequestBody CourseOrderAddRequest courseOrderAddRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
String userRole = userInfo.getUserRole();
|
||||
UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
ThrowUtils.throwIf(!UserRoleEnum.USER.equals(userRoleEnum), ErrorCode.NO_AUTH_ERROR, "只有普通用户才能创建订单");
|
||||
Long courseId = courseOrderAddRequest.getCourseId();
|
||||
Course course = courseService.getById(courseId);
|
||||
ThrowUtils.throwIf(course == null, ErrorCode.OPERATION_ERROR, "该课程不存在");
|
||||
CourseOrder courseOrder = commonService.copyProperties(course, CourseOrder.class);
|
||||
CourseVO courseVO = commonService.copyProperties(course, CourseVO.class);
|
||||
CourseOrder courseOrder = commonService.copyProperties(courseVO, CourseOrder.class);
|
||||
courseOrder.setId(null);
|
||||
courseOrder.setCourseId(courseId);
|
||||
courseOrder.setOrderNumber(OrderNumberUtils.generateOrderId());
|
||||
courseOrder.setTotalAmount(course.getDiscountPrice());
|
||||
courseOrder.setUserId(userId);
|
||||
courseOrderService.save(courseOrder);
|
||||
// 向消息队列中发送订单创建的消息
|
||||
courseOrderService.sendCreateOrderMessage(courseOrder.getId());
|
||||
return ResultUtils.success(courseOrder.getId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 模拟订单支付回调
|
||||
*/
|
||||
@PostMapping("payment")
|
||||
@Operation(summary = "模拟订单支付回调", description = "参数:订单id,权限:管理员,方法名:paymentCourse")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<Boolean> paymentCourse(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
|
||||
System.out.println("---------------------------微信支付回调(开始)-------------------------------");
|
||||
// 获取订单信息
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
|
||||
// 修改订单状态
|
||||
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);
|
||||
}
|
||||
|
||||
// 更新主管和员工的绩效记录
|
||||
Long userId = courseOrder.getUserId();
|
||||
List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
||||
List<Long> subPathToRoot = pathToRoot.subList(1, 3);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetFieldWithSpecificFields(
|
||||
subPathToRoot, userPerformanceSummaryService, Function.identity(), UserPerformanceSummary::getUserId,
|
||||
List.of(UserPerformanceSummary::getTotalAmount, UserPerformanceSummary::getNetAmount, UserPerformanceSummary::getOrderCount,
|
||||
UserPerformanceSummary::getToRelease, UserPerformanceSummary::getToSettle));
|
||||
BigDecimal rate;
|
||||
Map<String, BigDecimal> rateMap = userPerformanceSummaryService.queryRakeRewardsRate();
|
||||
for (int i = 0; i < userPerformanceSummaryList.size(); i ++ ) {
|
||||
if (i == 0) rate = rateMap.get("first");
|
||||
else rate = rateMap.get("second");
|
||||
// 计算理论上获得的最大提成奖励
|
||||
BigDecimal rakeRewards = courseOrder.getTotalAmount().multiply(rate);
|
||||
UserPerformanceSummary userPerformanceSummary = userPerformanceSummaryList.get(i);
|
||||
|
||||
userPerformanceSummary.setTotalAmount(userPerformanceSummary.getTotalAmount().add(courseOrder.getTotalAmount()));
|
||||
userPerformanceSummary.setNetAmount(userPerformanceSummary.getNetAmount().add(courseOrder.getTotalAmount().multiply(SystemConstant.FEE_RATE)));
|
||||
userPerformanceSummary.setOrderCount(userPerformanceSummary.getOrderCount() + 1);
|
||||
userPerformanceSummary.setToRelease(userPerformanceSummary.getToRelease().add(rakeRewards.multiply(SystemConstant.REFUND_RATE)));
|
||||
userPerformanceSummary.setToSettle(userPerformanceSummary.getToSettle().add(rakeRewards.multiply(SystemConstant.FEE_RATE)));
|
||||
}
|
||||
userPerformanceSummaryService.updateBatchById(userPerformanceSummaryList);
|
||||
|
||||
|
||||
// 添加课程推广待提成记录
|
||||
Long firstUserId = subPathToRoot.get(0);
|
||||
Long secondUserId = subPathToRoot.get(1);
|
||||
CoursePromotionCommissionPending coursePromotionCommissionPending = CoursePromotionCommissionPending.builder()
|
||||
.firstUserId(firstUserId)
|
||||
.secondUserId(secondUserId)
|
||||
.courseId(courseId)
|
||||
.name(courseOrder.getName())
|
||||
.type(courseOrder.getType())
|
||||
.image(courseOrder.getImage())
|
||||
.orderId(courseOrder.getId())
|
||||
.userId(userId)
|
||||
.firstRate(rateMap.get("first"))
|
||||
.secondRate(rateMap.get("second"))
|
||||
.firstReward(courseOrder.getTotalAmount().multiply(rateMap.get("first")))
|
||||
.secondReward(courseOrder.getTotalAmount().multiply(rateMap.get("second")))
|
||||
.totalAmount(courseOrder.getTotalAmount())
|
||||
.commissionStatus(CommissionStatusEnum.PENDING.getValue())
|
||||
.orderCreateTime(courseOrder.getCreateTime())
|
||||
.build();
|
||||
coursePromotionCommissionPendingService.save(coursePromotionCommissionPending);
|
||||
|
||||
|
||||
System.out.println("---------------------------微信支付回调(结束)-------------------------------");
|
||||
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 模拟订单退款回调
|
||||
*/
|
||||
@PostMapping("refund")
|
||||
@Operation(summary = "模拟订单退款回调", description = "参数:订单id,权限:管理员,方法名:refundCourse")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> refundCourse(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
System.out.println("---------------------------微信退款回调(开始)-------------------------------");
|
||||
// 获取订单信息
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
|
||||
// 修改订单状态
|
||||
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);
|
||||
}
|
||||
|
||||
// 更新主管和员工的绩效记录
|
||||
Long userId = courseOrder.getUserId();
|
||||
List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
||||
List<Long> superUserIdList = pathToRoot.subList(1, 3);
|
||||
List<UserPerformanceSummary> userPerformanceSummaryList = commonService.findByFieldInTargetFieldWithSpecificFields(
|
||||
superUserIdList, userPerformanceSummaryService, Function.identity(), UserPerformanceSummary::getUserId,
|
||||
List.of(UserPerformanceSummary::getTotalAmount, UserPerformanceSummary::getToRelease, UserPerformanceSummary::getRefunded));
|
||||
BigDecimal rate;
|
||||
LambdaQueryWrapper<CoursePromotionCommissionPending> coursePromotionQueryWrapper = new LambdaQueryWrapper<>();
|
||||
coursePromotionQueryWrapper.eq(CoursePromotionCommissionPending::getOrderId, courseOrder.getId());
|
||||
CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getOne(coursePromotionQueryWrapper);
|
||||
for (int i = 0; i < userPerformanceSummaryList.size(); i ++ ) {
|
||||
if (i == 0) rate = coursePromotionCommissionPending.getFirstRate();
|
||||
else rate = coursePromotionCommissionPending.getSecondRate();
|
||||
// 计算理论上获得的最大提成奖励
|
||||
BigDecimal rakeRewards = courseOrder.getTotalAmount().multiply(rate);
|
||||
UserPerformanceSummary userPerformanceSummary = userPerformanceSummaryList.get(i);
|
||||
|
||||
userPerformanceSummary.setTotalAmount(userPerformanceSummary.getTotalAmount().subtract(courseOrder.getTotalAmount().multiply(SystemConstant.REFUND_RATE)));
|
||||
userPerformanceSummary.setToRelease(userPerformanceSummary.getToRelease().subtract(rakeRewards.multiply(SystemConstant.REFUND_RATE)));
|
||||
userPerformanceSummary.setRefunded(userPerformanceSummary.getRefunded().add(rakeRewards.multiply(SystemConstant.REFUND_RATE)));
|
||||
}
|
||||
userPerformanceSummaryService.updateBatchById(userPerformanceSummaryList);
|
||||
|
||||
// 修改课程推广待提成状态为"已失效"
|
||||
LambdaUpdateWrapper<CoursePromotionCommissionPending> coursePromotionUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
coursePromotionUpdateWrapper.eq(CoursePromotionCommissionPending::getOrderId, courseOrder.getId())
|
||||
.set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.EXPIRED.getValue());
|
||||
coursePromotionCommissionPendingService.update(coursePromotionUpdateWrapper);
|
||||
|
||||
System.out.println("---------------------------微信退款回调(结束)-------------------------------");
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户取消课程订单
|
||||
* @param courseOrderAddRequest 课程id
|
||||
@ -139,43 +315,43 @@ public class CourseOrderController {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据id删除课程订单
|
||||
* @param commonRequest 课程订单删除请求体
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@PostMapping("delete")
|
||||
@Operation(summary = "web端管理员根据id删除课程订单", description = "参数:课程订单删除请求体,权限:管理员,方法名:delCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "web端管理员根据id删除课程订单")
|
||||
public BaseResponse<Boolean> delCourseOrder(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
ThrowUtils.throwIf(courseOrder == null || !courseOrder.getOrderStatus().equals(OrderStatusConstant.CLOSED),
|
||||
ErrorCode.OPERATION_ERROR, "该课程订单不存在或订单状态错误");
|
||||
courseOrderService.removeById(id);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* web端管理员批量删除课程订单
|
||||
* @param commonBatchRequest 课程订单批量删除请求体
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@PostMapping("delBatch")
|
||||
@Operation(summary = "web端管理员批量删除课程订单", description = "参数:课程订单批量删除请求体,权限:管理员,方法名:delBatchCourseOrder")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "web端管理员批量删除课程订单")
|
||||
public BaseResponse<Boolean> delBatchCourseOrder(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
List<Long> ids = commonBatchRequest.getIds();
|
||||
LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(CourseOrder::getOrderStatus, OrderStatusConstant.CLOSED);
|
||||
long count = courseOrderService.count(queryWrapper);
|
||||
ThrowUtils.throwIf(count > 0, ErrorCode.OPERATION_ERROR, "存在未关闭的课程订单");
|
||||
courseOrderService.removeByIds(ids);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id删除课程订单
|
||||
// * @param commonRequest 课程订单删除请求体
|
||||
// * @return 是否删除成功
|
||||
// */
|
||||
// @PostMapping("delete")
|
||||
// @Operation(summary = "web端管理员根据id删除课程订单", description = "参数:课程订单删除请求体,权限:管理员,方法名:delCourseOrder")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "课程订单管理", content = "web端管理员根据id删除课程订单")
|
||||
// public BaseResponse<Boolean> delCourseOrder(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long id = commonRequest.getId();
|
||||
// CourseOrder courseOrder = courseOrderService.getById(id);
|
||||
// ThrowUtils.throwIf(courseOrder == null || !courseOrder.getOrderStatus().equals(OrderStatusConstant.CLOSED),
|
||||
// ErrorCode.OPERATION_ERROR, "该课程订单不存在或订单状态错误");
|
||||
// courseOrderService.removeById(id);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * web端管理员批量删除课程订单
|
||||
// * @param commonBatchRequest 课程订单批量删除请求体
|
||||
// * @return 是否删除成功
|
||||
// */
|
||||
// @PostMapping("delBatch")
|
||||
// @Operation(summary = "web端管理员批量删除课程订单", description = "参数:课程订单批量删除请求体,权限:管理员,方法名:delBatchCourseOrder")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "课程订单管理", content = "web端管理员批量删除课程订单")
|
||||
// public BaseResponse<Boolean> delBatchCourseOrder(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
||||
// List<Long> ids = commonBatchRequest.getIds();
|
||||
// LambdaQueryWrapper<CourseOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.ne(CourseOrder::getOrderStatus, OrderStatusConstant.CLOSED);
|
||||
// long count = courseOrderService.count(queryWrapper);
|
||||
// ThrowUtils.throwIf(count > 0, ErrorCode.OPERATION_ERROR, "存在未关闭的课程订单");
|
||||
// courseOrderService.removeByIds(ids);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
|
||||
/**
|
||||
* web端管理员根据id查询课程订单
|
||||
@ -202,15 +378,15 @@ public class CourseOrderController {
|
||||
@Operation(summary = "Web端管理员分页查询课程订单", description = "参数:课程订单查询请求体,权限:管理员,方法名:listCourseOrderByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "课程订单管理", content = "Web端管理员分页查询课程订单")
|
||||
public BaseResponse<Page<CourseOrderVO>> listCourseOrderByPage(@Valid @RequestBody CourseOrderQueryRequest courseOrderQueryRequest) {
|
||||
public BaseResponse<Page<CourseOrderBaseInfoVO>> listCourseOrderByPage(@Valid @RequestBody CourseOrderQueryRequest courseOrderQueryRequest) {
|
||||
long current = courseOrderQueryRequest.getCurrent();
|
||||
long pageSize = courseOrderQueryRequest.getPageSize();
|
||||
QueryWrapper<CourseOrder> queryWrapper = courseOrderService.getQueryWrapper(courseOrderQueryRequest);
|
||||
Page<CourseOrder> page = courseOrderService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<CourseOrder> courseOrderList = page.getRecords();
|
||||
List<CourseOrderVO> courseOrderVOList = commonService.convertList(courseOrderList, CourseOrderVO.class);
|
||||
Page<CourseOrderVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(courseOrderVOList);
|
||||
List<CourseOrderBaseInfoVO> courseOrderBaseInfoVOS = commonService.convertList(courseOrderList, CourseOrderBaseInfoVO.class);
|
||||
Page<CourseOrderBaseInfoVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(courseOrderBaseInfoVOS);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
|
@ -0,0 +1,161 @@
|
||||
package com.greenorange.promotion.controller.course;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingAddRequest;
|
||||
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.entity.UserPerformanceSummary;
|
||||
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.model.vo.coursePromotionCommissionPending.CoursePromotionCommissionPendingVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
///**
|
||||
// * 课程推广待提成记录 控制器
|
||||
// */
|
||||
//@RestController
|
||||
//@RequestMapping("coursePromo")
|
||||
//@Slf4j
|
||||
//@Tag(name = "课程推广待提成记录模块")
|
||||
//@Transactional
|
||||
//public class CoursePromotionCommissionPendingController {
|
||||
//
|
||||
// @Resource
|
||||
// private CoursePromotionCommissionPendingService coursePromotionCommissionPendingService;
|
||||
//
|
||||
// @Resource
|
||||
// private CommonService commonService;
|
||||
//
|
||||
// @Resource
|
||||
// private UserInfoService userInfoService;
|
||||
//
|
||||
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 小程序端根据(一级)(二级)用户id查询课程推广待提成记录
|
||||
// * @return 是否修改成功
|
||||
// */
|
||||
// @PostMapping("query/userId")
|
||||
// @Operation(summary = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录", description = "参数:无,权限:管理员,方法名:queryCoursePromotionCommissionPendingByUserId")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "课程推广待提成记录管理", content = "小程序端根据(一级)(二级)用户id查询课程推广待提成记录")
|
||||
// public BaseResponse<List<CoursePromotionCommissionPendingVO>> queryCoursePromotionCommissionPendingByUserId(HttpServletRequest request) {
|
||||
// Long userId = (Long) request.getAttribute("userId");
|
||||
// UserInfo userInfo = userInfoService.getById(userId);
|
||||
// String userRole = userInfo.getUserRole();
|
||||
// UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
// LambdaQueryWrapper<CoursePromotionCommissionPending> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// if (UserRoleEnum.SUPERVISOR.equals(userRoleEnum)) {
|
||||
// lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getFirstUserId, userId);
|
||||
// }else if (UserRoleEnum.STAFF.equals(userRoleEnum)) {
|
||||
// lambdaQueryWrapper.eq(CoursePromotionCommissionPending::getSecondUserId, userId);
|
||||
// } else {
|
||||
// throw new BusinessException(ErrorCode.NO_AUTH_ERROR);
|
||||
// }
|
||||
// List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = coursePromotionCommissionPendingService.list(lambdaQueryWrapper);
|
||||
// List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOS = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||
// return ResultUtils.success(coursePromotionCommissionPendingVOS);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id查询课程推广待提成记录
|
||||
// * @param commonRequest 课程推广待提成记录id
|
||||
// * @return 是否修改成功
|
||||
// */
|
||||
// @PostMapping("query/id")
|
||||
// @Operation(summary = "web端管理员根据id查询课程推广待提成记录", description = "参数:课程推广待提成记录id,权限:管理员,方法名:queryCoursePromotionCommissionPendingById")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id查询课程推广待提成记录")
|
||||
// public BaseResponse<CoursePromotionCommissionPendingVO> queryCoursePromotionCommissionPendingById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long id = commonRequest.getId();
|
||||
// CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||
// CoursePromotionCommissionPendingVO coursePromotionCommissionPendingVO = commonService.copyProperties(coursePromotionCommissionPending, CoursePromotionCommissionPendingVO.class);
|
||||
// return ResultUtils.success(coursePromotionCommissionPendingVO);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * web端管理员根据id修改课程推广待提成记录状态
|
||||
// * @param commonRequest 课程推广待提成记录id
|
||||
// * @return 是否修改成功
|
||||
// */
|
||||
// @PostMapping("update")
|
||||
// @Operation(summary = "web端管理员根据id修改课程推广待提成记录状态", description = "参数:课程推广待提成记录id,权限:管理员,方法名:modifyCoursePromotionCommissionPendingStatus")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "课程推广待提成记录管理", content = "web端管理员根据id修改课程推广待提成记录状态")
|
||||
// public BaseResponse<Boolean> modifyCoursePromotionCommissionPendingStatus(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long id = commonRequest.getId();
|
||||
// CoursePromotionCommissionPending coursePromotionCommissionPending = coursePromotionCommissionPendingService.getById(id);
|
||||
// String commissionStatus = coursePromotionCommissionPending.getCommissionStatus();
|
||||
// ThrowUtils.throwIf(!commissionStatus.equals(CommissionStatusEnum.PENDING.getValue()), ErrorCode.OPERATION_ERROR, "课程推广待提成记录状态错误");
|
||||
// LambdaUpdateWrapper<CoursePromotionCommissionPending> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
// updateWrapper.eq(CoursePromotionCommissionPending::getId, id).set(CoursePromotionCommissionPending::getCommissionStatus, CommissionStatusEnum.COMPLETED.getValue());
|
||||
// coursePromotionCommissionPendingService.update(updateWrapper);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Web端管理员分页查询课程推广待提成记录
|
||||
// * @param coursePromotionCommissionPendingQueryRequest 课程推广待提成记录查询请求体
|
||||
// * @return 课程推广待提成记录列表
|
||||
// */
|
||||
// @PostMapping("page")
|
||||
// @Operation(summary = "Web端管理员分页查询课程推广待提成记录", description = "参数:课程推广待提成记录查询请求体,权限:管理员,方法名:listCoursePromotionCommissionPendingByPage")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "课程推广待提成记录管理", content = "Web端管理员分页查询课程推广待提成记录")
|
||||
// public BaseResponse<Page<CoursePromotionCommissionPendingVO>> listCoursePromotionCommissionPendingByPage(@Valid @RequestBody CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest) {
|
||||
// long current = coursePromotionCommissionPendingQueryRequest.getCurrent();
|
||||
// long pageSize = coursePromotionCommissionPendingQueryRequest.getPageSize();
|
||||
// QueryWrapper<CoursePromotionCommissionPending> queryWrapper = coursePromotionCommissionPendingService.getQueryWrapper(coursePromotionCommissionPendingQueryRequest);
|
||||
// Page<CoursePromotionCommissionPending> page = coursePromotionCommissionPendingService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
// List<CoursePromotionCommissionPending> coursePromotionCommissionPendingList = page.getRecords();
|
||||
// List<CoursePromotionCommissionPendingVO> coursePromotionCommissionPendingVOList = commonService.convertList(coursePromotionCommissionPendingList, CoursePromotionCommissionPendingVO.class);
|
||||
// Page<CoursePromotionCommissionPendingVO> voPage = new Page<>(current, pageSize);
|
||||
// voPage.setRecords(coursePromotionCommissionPendingVOList);
|
||||
// voPage.setPages(page.getPages());
|
||||
// voPage.setTotal(page.getTotal());
|
||||
// return ResultUtils.success(voPage);
|
||||
// }
|
||||
//}
|
@ -0,0 +1,72 @@
|
||||
//package com.greenorange.promotion.controller.course;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
//import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
//import com.greenorange.promotion.annotation.SysLog;
|
||||
//import com.greenorange.promotion.common.BaseResponse;
|
||||
//import com.greenorange.promotion.common.ResultUtils;
|
||||
//import com.greenorange.promotion.constant.UserConstant;
|
||||
//import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
//import com.greenorange.promotion.model.dto.refundRecord.RefundRecordAddRequest;
|
||||
//import com.greenorange.promotion.model.dto.refundRecord.RefundRecordQueryRequest;
|
||||
//import com.greenorange.promotion.model.dto.refundRecord.RefundRecordUpdateRequest;
|
||||
//import com.greenorange.promotion.model.entity.RefundRecord;
|
||||
//import com.greenorange.promotion.model.vo.refundRecord.RefundRecordVO;
|
||||
//import com.greenorange.promotion.service.common.CommonService;
|
||||
//import com.greenorange.promotion.service.refund.RefundRecordService;
|
||||
//import io.swagger.v3.oas.annotations.Operation;
|
||||
//import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
//import jakarta.annotation.Resource;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestBody;
|
||||
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
//import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
//import jakarta.validation.Valid;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * 退款记录 控制器
|
||||
// */
|
||||
//@RestController
|
||||
//@RequestMapping("refundRecord")
|
||||
//@Slf4j
|
||||
//@Tag(name = "退款记录模块")
|
||||
//@Transactional
|
||||
//public class RefundRecordController {
|
||||
//
|
||||
// @Resource
|
||||
// private RefundRecordService refundRecordService;
|
||||
//
|
||||
// @Resource
|
||||
// private CommonService commonService;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Web端管理员分页查询退款记录
|
||||
// * @param refundRecordQueryRequest 退款记录查询请求体
|
||||
// * @return 退款记录列表
|
||||
// */
|
||||
// @PostMapping("page")
|
||||
// @Operation(summary = "Web端管理员分页查询退款记录", description = "参数:退款记录查询请求体,权限:管理员,方法名:listRefundRecordByPage")
|
||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
// @SysLog(title = "退款记录管理", content = "Web端管理员分页查询退款记录")
|
||||
// public BaseResponse<Page<RefundRecordVO>> listRefundRecordByPage(@Valid @RequestBody RefundRecordQueryRequest refundRecordQueryRequest) {
|
||||
// long current = refundRecordQueryRequest.getCurrent();
|
||||
// long pageSize = refundRecordQueryRequest.getPageSize();
|
||||
// QueryWrapper<RefundRecord> queryWrapper = refundRecordService.getQueryWrapper(refundRecordQueryRequest);
|
||||
// Page<RefundRecord> page = refundRecordService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
// List<RefundRecord> refundRecordList = page.getRecords();
|
||||
// List<RefundRecordVO> refundRecordVOList = commonService.convertList(refundRecordList, RefundRecordVO.class);
|
||||
// Page<RefundRecordVO> voPage = new Page<>(current, pageSize);
|
||||
// voPage.setRecords(refundRecordVOList);
|
||||
// voPage.setPages(page.getPages());
|
||||
// voPage.setTotal(page.getTotal());
|
||||
// return ResultUtils.success(voPage);
|
||||
// }
|
||||
//}
|
@ -10,6 +10,7 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@ -23,6 +24,7 @@ import java.io.IOException;
|
||||
@RequestMapping("file")
|
||||
@Slf4j
|
||||
@Tag(name = "文件管理")
|
||||
@Transactional
|
||||
public class FileInfoController {
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.GenericDeclaration;
|
||||
@ -51,6 +52,7 @@ import java.util.stream.Collectors;
|
||||
@RequestMapping("projectCommission")
|
||||
@Slf4j
|
||||
@Tag(name = "项目明细抽佣管理")
|
||||
@Transactional
|
||||
public class ProjectCommissionController {
|
||||
|
||||
@Resource
|
||||
|
@ -33,6 +33,7 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -51,6 +52,7 @@ import java.util.Map;
|
||||
@RequestMapping("project")
|
||||
@Slf4j
|
||||
@Tag(name = "项目管理")
|
||||
@Transactional
|
||||
public class ProjectController {
|
||||
|
||||
@Resource
|
||||
|
@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
@ -47,6 +48,7 @@ import java.util.stream.Collectors;
|
||||
@RequestMapping("projectDetail")
|
||||
@Slf4j
|
||||
@Tag(name = "项目明细管理")
|
||||
@Transactional
|
||||
public class ProjectDetailController {
|
||||
|
||||
@Resource
|
||||
|
@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -41,6 +42,7 @@ import java.util.List;
|
||||
@RequestMapping("projectNotification")
|
||||
@Slf4j
|
||||
@Tag(name = "项目通知管理")
|
||||
@Transactional
|
||||
public class ProjectNotificationController {
|
||||
|
||||
@Resource
|
||||
|
@ -30,6 +30,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -49,6 +50,7 @@ import java.util.Map;
|
||||
@RequestMapping("promoCodeApply")
|
||||
@Slf4j
|
||||
@Tag(name = "推广码申请记录管理")
|
||||
@Transactional
|
||||
public class PromoCodeApplyController {
|
||||
|
||||
@Resource
|
||||
|
@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -42,6 +43,7 @@ import java.util.List;
|
||||
@RequestMapping("promoCode")
|
||||
@Slf4j
|
||||
@Tag(name = "推广码管理")
|
||||
@Transactional
|
||||
public class PromoCodeController {
|
||||
|
||||
@Resource
|
||||
|
@ -47,6 +47,7 @@ import java.util.function.Function;
|
||||
@RequestMapping("projectSettlement")
|
||||
@Slf4j
|
||||
@Tag(name = "项目结算记录管理")
|
||||
@Transactional
|
||||
public class ProjectSettlementController {
|
||||
|
||||
@Resource
|
||||
|
@ -31,6 +31,7 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -48,6 +49,7 @@ import java.util.List;
|
||||
@RequestMapping("withdrawalApply")
|
||||
@Slf4j
|
||||
@Tag(name = "提现申请记录管理")
|
||||
@Transactional
|
||||
public class WithdrawalApplyController {
|
||||
|
||||
@Resource
|
||||
|
@ -7,8 +7,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
import com.greenorange.promotion.model.dto.advancementApply.*;
|
||||
@ -19,6 +21,7 @@ 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.model.vo.userInfo.SupervisorUserInfoVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.userInfo.AdvancementApplyService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
@ -27,13 +30,14 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -43,6 +47,7 @@ import java.util.UUID;
|
||||
@RequestMapping("advancementApply")
|
||||
@Slf4j
|
||||
@Tag(name = "晋升申请模块")
|
||||
@Transactional
|
||||
public class AdvancementApplyController {
|
||||
|
||||
@Resource
|
||||
@ -55,22 +60,30 @@ public class AdvancementApplyController {
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
/**
|
||||
* 小程序段用户添加晋升申请记录
|
||||
* 小程序端用户申请晋升
|
||||
* @param advancementApplyAddRequest 晋升申请记录添加请求体
|
||||
* @return 申请记录查询凭据
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序段用户添加晋升申请记录", description = "参数:晋升申请添加请求体,权限:管理员,方法名:addAdvancementApply")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序段用户添加晋升申请记录")
|
||||
public BaseResponse<String> addAdvancementApply(@Valid @RequestBody AdvancementApplyAddRequest advancementApplyAddRequest) {
|
||||
@Operation(summary = "小程序端用户申请晋升", description = "参数:晋升申请添加请求体,权限:管理员,方法名:addAdvancementApply")
|
||||
@SysLog(title = "晋升申请管理", content = "小程序端用户申请晋升")
|
||||
public BaseResponse<Long> addAdvancementApply(@Valid @RequestBody AdvancementApplyAddRequest advancementApplyAddRequest) {
|
||||
String phone = advancementApplyAddRequest.getPhone();
|
||||
String verificationCode = advancementApplyAddRequest.getVerificationCode();
|
||||
// 校验用户手机号和验证码
|
||||
userInfoService.checkPhoneAndVerificationCode(phone, verificationCode, UserRoleEnum.STAFF);
|
||||
// 校验当前身份证号是否申请过
|
||||
String idCard = advancementApplyAddRequest.getIdCard();
|
||||
LambdaQueryWrapper<AdvancementApply> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AdvancementApply::getIdCard, idCard)
|
||||
.or()
|
||||
.eq(AdvancementApply::getPhone, phone)
|
||||
.and(w -> w.in(AdvancementApply::getReviewStatus, ReviewStatusEnum.APPROVED.getValue(), ReviewStatusEnum.PENDING.getValue()));
|
||||
long count = advancementApplyService.count(queryWrapper);
|
||||
ThrowUtils.throwIf(count > 0, ErrorCode.OPERATION_ERROR, "当前手机号或身份证号已申请过");
|
||||
AdvancementApply advancementApply = commonService.copyProperties(advancementApplyAddRequest, AdvancementApply.class);
|
||||
advancementApply.setCredential(UUID.randomUUID().toString());
|
||||
advancementApplyService.save(advancementApply);
|
||||
return ResultUtils.success(advancementApply.getCredential());
|
||||
return ResultUtils.success(advancementApply.getId());
|
||||
}
|
||||
|
||||
|
||||
@ -90,39 +103,39 @@ public class AdvancementApplyController {
|
||||
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);
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 小程序端用户根据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)查询晋升申请记录")
|
||||
@Operation(summary = "小程序端用户根据身份证号查询晋升申请记录", description = "参数:晋升申请更新请求体,权限:管理员,方法名:queryAdvancementApplyByCredential")
|
||||
public BaseResponse<AdvancementApplyApproveVO> queryAdvancementApplyByCredential(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String credential = commonStringRequest.getTemplateString();
|
||||
String idCard = commonStringRequest.getTemplateString();
|
||||
LambdaQueryWrapper<AdvancementApply> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(AdvancementApply::getCredential, credential);
|
||||
lambdaQueryWrapper.eq(AdvancementApply::getIdCard, idCard);
|
||||
AdvancementApply advancementApply = advancementApplyService.getOne(lambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(advancementApply == null, ErrorCode.OPERATION_ERROR, "未找到该申请记录");
|
||||
AdvancementApplyApproveVO advancementApplyApproveVO = commonService.copyProperties(advancementApply, AdvancementApplyApproveVO.class);
|
||||
String reviewStatus = advancementApply.getReviewStatus();
|
||||
ReviewStatusEnum reviewStatusEnum = ReviewStatusEnum.getEnumByValue(reviewStatus);
|
||||
@ -130,8 +143,8 @@ public class AdvancementApplyController {
|
||||
if (ReviewStatusEnum.APPROVED.equals(reviewStatusEnum)) {
|
||||
Long userId = advancementApply.getUserId();
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
advancementApplyApproveVO.setUserAccount(userInfo.getUserAccount());
|
||||
advancementApplyApproveVO.setUserPassword(userInfo.getUserPassword());
|
||||
advancementApplyApproveVO.setUserRole(userInfo.getUserRole());
|
||||
}
|
||||
// 如果审核拒绝,填充拒绝理由
|
||||
if (ReviewStatusEnum.REJECTED.equals(reviewStatusEnum)) {
|
||||
@ -216,4 +229,19 @@ public class AdvancementApplyController {
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员查询主管信息列表
|
||||
* @return 主管信息列表
|
||||
*/
|
||||
@PostMapping("query/supervisor")
|
||||
@Operation(summary = "Web端管理员查询主管信息列表", description = "参数:无,权限:管理员,方法名:listSupervisorUserInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "晋升申请管理", content = "Web端管理员分页查询晋升申请")
|
||||
public BaseResponse<List<SupervisorUserInfoVO>> listSupervisorUserInfo() {
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserConstant.SUPERVISOR_ROLE, userInfoService);
|
||||
List<SupervisorUserInfoVO> supervisorUserInfoVOS = commonService.convertList(userInfoList, SupervisorUserInfoVO.class);
|
||||
return ResultUtils.success(supervisorUserInfoVOS);
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("userAccount")
|
||||
@Slf4j
|
||||
@Tag(name = "用户账户管理")
|
||||
@Transactional
|
||||
public class UserAccountController {
|
||||
|
||||
@Resource
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.greenorange.promotion.controller.userInfo;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaQrcode;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
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;
|
||||
@ -17,12 +20,13 @@ import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
import com.greenorange.promotion.model.dto.userInfo.*;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.entity.UserMainInfo;
|
||||
import com.greenorange.promotion.model.vo.userInfo.SuperUserInfoVO;
|
||||
import com.greenorange.promotion.model.vo.userInfo.UserInfoVO;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.model.vo.userInfo.*;
|
||||
import com.greenorange.promotion.model.vo.userMainInfo.UserMainInfoVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||
import com.greenorange.promotion.utils.JWTUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -30,10 +34,16 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@ -43,6 +53,7 @@ import java.util.concurrent.TimeUnit;
|
||||
@RequestMapping("userInfo")
|
||||
@Slf4j
|
||||
@Tag(name = "用户管理")
|
||||
@Transactional
|
||||
public class UserInfoController {
|
||||
|
||||
|
||||
@ -66,32 +77,165 @@ public class UserInfoController {
|
||||
private JWTUtils jwtUtils;
|
||||
|
||||
|
||||
@Resource
|
||||
private WechatGetQrcodeService wechatGetQrcodeService;
|
||||
|
||||
|
||||
|
||||
// @PostMapping("test")
|
||||
// public BaseResponse<Boolean> test() throws IOException {
|
||||
// List<UserInfo> list = userInfoService.list();
|
||||
// Map<Long, UserInfo> map = new HashMap<>();
|
||||
// for (UserInfo userInfo : list) {
|
||||
// map.put(userInfo.getId(), userInfo);
|
||||
// }
|
||||
// List<UserMainInfo> userMainInfoList = userMainInfoService.list();
|
||||
// for (UserMainInfo userMainInfo : userMainInfoList) {
|
||||
// Long userId = userMainInfo.getUserId();
|
||||
// UserInfo userInfo = map.get(userId);
|
||||
// String userRole = userInfo.getUserRole();
|
||||
// UserRoleEnum userRoleEnum = UserRoleEnum.getEnumByValue(userRole);
|
||||
// String view = wechatGetQrcodeService.getWxQrCode(userInfo.getInvitationCode(), userRoleEnum);
|
||||
// userMainInfo.setInviteQrCode(view);
|
||||
// }
|
||||
// userMainInfoService.saveOrUpdateBatch(userMainInfoList);
|
||||
// return ResultUtils.success(true);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户校验token
|
||||
* @return 是否校验成功
|
||||
*/
|
||||
@PostMapping("verify/token")
|
||||
@Operation(summary = "小程序端用户校验token", description = "参数:token, 权限:管理员(boss, admin),方法名:verifyToken")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<Boolean> verifyToken() {
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端修改员工申请须知
|
||||
* @param commonStringRequest 修改内容
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("modify/applyNotice")
|
||||
@Operation(summary = "web端修改员工申请须知", description = "参数:修改内容,权限:管理员(boss, admin),方法名:modifyApplyNotice")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> modifyApplyNotice(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String applyNotice = commonStringRequest.getTemplateString();
|
||||
redisTemplate.opsForValue().set(UserConstant.APPLY_NOTICE_KEY, applyNotice);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (Web端)小程序端查询员工申请须知
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("query/applyNotice")
|
||||
@Operation(summary = "(Web端)小程序端查询员工申请须知", description = "参数:无,权限:管理员(boss, admin),方法名:queryApplyNotice")
|
||||
public BaseResponse<String> queryApplyNotice() {
|
||||
String applyNotice = redisTemplate.opsForValue().get(UserConstant.APPLY_NOTICE_KEY);
|
||||
return ResultUtils.success(applyNotice);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端修改课程购买须知
|
||||
* @param commonStringRequest 修改内容
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("modify/courseDesc")
|
||||
@Operation(summary = "web端修改课程购买须知", description = "参数:修改内容,权限:管理员(boss, admin),方法名:modifyCourseDesc")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<Boolean> modifyCourseDesc(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String courseDesc = commonStringRequest.getTemplateString();
|
||||
redisTemplate.opsForValue().set(UserConstant.COURSE_DESC_KEY, courseDesc);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (Web端)小程序端查询课程购买须知
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("query/courseDesc")
|
||||
@Operation(summary = "(Web端)小程序端查询课程购买须知", description = "参数:无,权限:管理员(boss, admin),方法名:queryApplyNotice")
|
||||
public BaseResponse<String> queryCourseDesc() {
|
||||
String courseDesc = redisTemplate.opsForValue().get(UserConstant.COURSE_DESC_KEY);
|
||||
return ResultUtils.success(courseDesc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户修改用户昵称
|
||||
* @param commonStringRequest 昵称
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("modify/nickname")
|
||||
@Operation(summary = "小程序端用户修改用户昵称", description = "参数:昵称,权限:管理员(boss, admin),方法名:modifyNickname")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<Boolean> modifyNickname(@Valid @RequestBody CommonStringRequest commonStringRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
String nickName = commonStringRequest.getTemplateString();
|
||||
LambdaQueryWrapper<UserInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserInfo::getNickName, nickName);
|
||||
queryWrapper.ne(UserInfo::getId, userId);
|
||||
ThrowUtils.throwIf(userInfoService.count(queryWrapper) > 0, ErrorCode.PARAMS_ERROR, "昵称已存在");
|
||||
|
||||
LambdaUpdateWrapper<UserInfo> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(UserInfo::getId, userId).set(UserInfo::getNickName, nickName);
|
||||
userInfoService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户修改用户头像
|
||||
* @param commonStringRequest 头像view值
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("modify/avatar")
|
||||
@Operation(summary = "小程序端用户修改用户头像", description = "参数:头像view值,权限:管理员(boss, admin),方法名:modifyUserAvatar")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<Boolean> modifyUserAvatar(@Valid @RequestBody CommonStringRequest commonStringRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
String view = commonStringRequest.getTemplateString();
|
||||
LambdaUpdateWrapper<UserInfo> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(UserInfo::getId, userId).set(UserInfo::getUserAvatar, view);
|
||||
userInfoService.update(updateWrapper);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户获取验证码(用于注册)
|
||||
* @param commonStringRequest 手机号
|
||||
* @param verificationCodeGetRequest 验证码获取请求体
|
||||
* @return 验证码
|
||||
*/
|
||||
@PostMapping("code/register")
|
||||
@Operation(summary = "小程序端用户获取验证码(用于注册)", description = "参数:手机号,权限:管理员(boss, admin),方法名:getVerificationCodeForRegister")
|
||||
// @SysLog(title = "用户管理", content = "小程序端用户获取验证码")
|
||||
public BaseResponse<String> getVerificationCodeForRegister(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String phoneNumber = commonStringRequest.getTemplateString();
|
||||
String verificationCode = userInfoService.getVerificationCodeForRegister(phoneNumber);
|
||||
public BaseResponse<String> getVerificationCodeForRegister(@Valid @RequestBody VerificationCodeGetRequest verificationCodeGetRequest) {
|
||||
String verificationCode = userInfoService.getVerificationCodeForRegister(verificationCodeGetRequest);
|
||||
return ResultUtils.success(verificationCode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户获取验证码(用于密码登录和忘记密码)
|
||||
* @param commonStringRequest 手机号
|
||||
* @param verificationCodeGetRequest 验证码获取请求体
|
||||
* @return 验证码
|
||||
*/
|
||||
@PostMapping("code/pwd")
|
||||
@Operation(summary = "小程序端用户获取验证码(用于密码登录和忘记密码)", description = "参数:手机号,权限:管理员(boss, admin),方法名:getVerificationCode")
|
||||
// @SysLog(title = "用户管理", content = "小程序端用户获取验证码")
|
||||
public BaseResponse<String> getVerificationCode(@Valid @RequestBody CommonStringRequest commonStringRequest) {
|
||||
String phoneNumber = commonStringRequest.getTemplateString();
|
||||
String verificationCode = userInfoService.getVerificationCodeForPwdLogin(phoneNumber);
|
||||
public BaseResponse<String> getVerificationCode(@Valid @RequestBody VerificationCodeGetRequest verificationCodeGetRequest) {
|
||||
String verificationCode = userInfoService.getVerificationCodeForPwdLogin(verificationCodeGetRequest);
|
||||
return ResultUtils.success(verificationCode);
|
||||
}
|
||||
|
||||
@ -103,7 +247,6 @@ public class UserInfoController {
|
||||
*/
|
||||
@PostMapping("inviteCode")
|
||||
@Operation(summary = "小程序端用户根据id获取上级邀请码", description = "参数:用户id,权限:管理员(boss, admin),方法名:getParentUserInviteCode")
|
||||
// @SysLog(title = "用户管理", content = "小程序端用户根据id获取上级邀请码")
|
||||
public BaseResponse<String> getParentUserInviteCode(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
UserInfo userInfo = userInfoService.getById(id);
|
||||
@ -119,7 +262,6 @@ public class UserInfoController {
|
||||
*/
|
||||
@PostMapping("register")
|
||||
@Operation(summary = "小程序端用户注册", description = "参数:小程序用户注册请求体,权限:管理员(boss, admin),方法名:userInfoMiniRegister")
|
||||
// @SysLog(title = "用户管理", content = "小程序端用户注册")
|
||||
public BaseResponse<Boolean> userInfoMiniRegister(@Valid @RequestBody UserInfoRegisterRequest userInfoRegisterRequest) {
|
||||
userInfoService.userInfoMiniRegister(userInfoRegisterRequest);
|
||||
return ResultUtils.success(true);
|
||||
@ -134,13 +276,13 @@ public class UserInfoController {
|
||||
*/
|
||||
@PostMapping("mini/pwd/login")
|
||||
@Operation(summary = "小程序端用户密码登录", description = "参数:小程序用户密码登录请求体,权限:管理员(boss, admin),方法名:userInfoMiniLogin")
|
||||
// @SysLog(title = "用户管理", content = "小程序端用户密码登录")
|
||||
public BaseResponse<String> userInfoMiniLoginByPwd(@Valid @RequestBody UserInfoMiniPasswordLoginRequest userInfoMiniPasswordLoginRequest) {
|
||||
String token = userInfoService.userInfoMiniLoginByPwd(userInfoMiniPasswordLoginRequest);
|
||||
return ResultUtils.success(token);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户验证码登录
|
||||
* @param userInfoMiniVerifyCodeLoginRequest 小程序用户验证码登录请求体
|
||||
@ -162,7 +304,6 @@ public class UserInfoController {
|
||||
*/
|
||||
@PostMapping("mini/out/reset/pwd")
|
||||
@Operation(summary = "小程序用户重置密码(外部)", description = "参数:小程序用户密码重置请求体,权限:管理员(boss, admin),方法名:userInfoMiniOuterResetPwd")
|
||||
// @SysLog(title = "用户管理", content = "小程序用户重置密码(外部)")
|
||||
public BaseResponse<Boolean> userInfoMiniOuterResetPwd(@Valid @RequestBody UserInfoResetRequest userInfoResetRequest) {
|
||||
userInfoService.userInfoMiniResetPwd(userInfoResetRequest, false);
|
||||
return ResultUtils.success(true);
|
||||
@ -184,6 +325,9 @@ public class UserInfoController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端用户根据jwt获取用户信息
|
||||
* @return 用户信息
|
||||
@ -243,7 +387,6 @@ public class UserInfoController {
|
||||
@GetMapping("mini/logout")
|
||||
@Operation(summary = "小程序端用户退出登录", description = "参数:JWT,权限:管理员(boss, admin),方法名:userInfoMiniLogout")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "用户管理", content = "小程序端用户退出登录")
|
||||
public BaseResponse<Boolean> userInfoMiniLogout(@RequestHeader("Authorization") String token) {
|
||||
// 获取token的过期时间
|
||||
DecodedJWT decodedJWT = jwtUtils.verify(token);
|
||||
@ -408,24 +551,6 @@ public class UserInfoController {
|
||||
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * (小程序端)查询当前用户到根节点的userId路径
|
||||
// * @param commonRequest 用户id
|
||||
// * @return 用户表列表
|
||||
// */
|
||||
// @PostMapping("query/path")
|
||||
// @Operation(summary = "查询当前用户到根节点的userId路径", description = "参数:用户id,权限:管理员(boss, admin),方法名:findPathToRootUserIdList")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "用户管理", content = "查询当前用户到根节点的userId路径")
|
||||
// public BaseResponse<List<Long>> findPathToRootUserIdList(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
// Long userId = commonRequest.getId();
|
||||
// List<Long> pathToRoot = userInfoService.findPathToRoot(userId);
|
||||
// return ResultUtils.success(pathToRoot);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户获取上级用户信息
|
||||
* @return 上级用户信息
|
||||
@ -446,4 +571,90 @@ public class UserInfoController {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员查询主管列表
|
||||
* @return 主管列表
|
||||
*/
|
||||
@PostMapping("query/supervisor")
|
||||
@Operation(summary = "web端管理员查询主管列表", description = "参数:无,权限:管理员(boss, admin),方法名:querySupervisorList")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<List<SupervisorUserVO>> querySupervisorList() {
|
||||
// 获取用户基本信息和主要信息表
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getUserRole, UserRoleEnum.SUPERVISOR.getValue(), userInfoService);
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
|
||||
// 封装Map, 键: 用户id,值:用户信息
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) {
|
||||
userInfoMap.put(userInfo.getId(), userInfo);
|
||||
}
|
||||
List<SupervisorUserVO> supervisorUserVOS = new ArrayList<>();
|
||||
for (UserMainInfo userMainInfo : userMainInfoList) {
|
||||
SupervisorUserVO supervisorUserVO = commonService.copyProperties(userMainInfo, SupervisorUserVO.class);
|
||||
UserInfo userInfo = userInfoMap.get(userMainInfo.getUserId());
|
||||
BeanUtils.copyProperties(userInfo, supervisorUserVO);
|
||||
supervisorUserVOS.add(supervisorUserVO);
|
||||
}
|
||||
return ResultUtils.success(supervisorUserVOS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员根据主管id查询员工列表
|
||||
* @param commonRequest 主管id
|
||||
* @return 员工列表
|
||||
*/
|
||||
@PostMapping("query/staff")
|
||||
@Operation(summary = "web端管理员根据主管id查询员工列表", description = "参数:主管id,权限:管理员(boss, admin),方法名:queryStaffListBySupervisorId")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<List<StaffUserVO>> queryStaffListBySupervisorId(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
List<UserInfo> userInfoList = commonService.findByFieldEqTargetField(UserInfo::getParentUserId, id, userInfoService);
|
||||
List<UserMainInfo> userMainInfoList = commonService.findByFieldInTargetField(userInfoList, userMainInfoService, UserInfo::getId, UserMainInfo::getUserId);
|
||||
// 封装Map, 键: 用户id,值:用户信息
|
||||
Map<Long, UserInfo> userInfoMap = new HashMap<>();
|
||||
for (UserInfo userInfo : userInfoList) {
|
||||
userInfoMap.put(userInfo.getId(), userInfo);
|
||||
}
|
||||
List<StaffUserVO> staffUserVOS = new ArrayList<>();
|
||||
for (UserMainInfo userMainInfo : userMainInfoList) {
|
||||
StaffUserVO staffUserVO = commonService.copyProperties(userMainInfo, StaffUserVO.class);
|
||||
UserInfo userInfo = userInfoMap.get(userMainInfo.getUserId());
|
||||
BeanUtils.copyProperties(userInfo, staffUserVO);
|
||||
staffUserVOS.add(staffUserVO);
|
||||
}
|
||||
return ResultUtils.success(staffUserVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员查看经理信息
|
||||
* @return 经理信息
|
||||
*/
|
||||
@PostMapping("query/manager")
|
||||
@Operation(summary = "web端管理员查看经理信息", description = "参数:无,权限:管理员(boss, admin),方法名:queryManagerInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
public BaseResponse<ManagerUserInfoVO> queryManagerInfo() {
|
||||
LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserInfo::getUserRole, UserConstant.MANAGER_ROLE, userInfoService);
|
||||
UserInfo managerUserInfo = userInfoService.getOne(userInfoLambdaQueryWrapper);
|
||||
ManagerUserInfoVO managerUserInfoVO = commonService.copyProperties(managerUserInfo, ManagerUserInfoVO.class);
|
||||
return ResultUtils.success(managerUserInfoVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员修改经理信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@PostMapping("modify/manager")
|
||||
@Operation(summary = "web端管理员修改经理信息", description = "参数:无,权限:管理员(boss, admin),方法名:modifyManagerInfo")
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
public BaseResponse<Boolean> modifyManagerInfo(@Valid @RequestBody ManagerUserInfoUpdateRequest managerUserInfoUpdateRequest) {
|
||||
UserInfo userInfo = commonService.copyProperties(managerUserInfoUpdateRequest, UserInfo.class);
|
||||
userInfoService.updateById(userInfo);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
@ -45,6 +46,7 @@ import java.util.Map;
|
||||
@RequestMapping("userMainInfo")
|
||||
@Slf4j
|
||||
@Tag(name = "用户主要信息管理")
|
||||
@Transactional
|
||||
public class UserMainInfoController {
|
||||
|
||||
@Resource
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@ import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.config.WxAccessToken;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonStringRequest;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import com.greenorange.promotion.service.wechat.WechatGetQrcodeService;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -15,6 +16,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.*;
|
||||
@ -24,6 +26,7 @@ import java.io.*;
|
||||
@RestController
|
||||
@Tag(name = "获取二维码模块")
|
||||
@RequestMapping("/qrcode")
|
||||
@Transactional
|
||||
public class WechatGetQrcodeController {
|
||||
|
||||
|
||||
@ -54,13 +57,12 @@ public class WechatGetQrcodeController {
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@Hidden
|
||||
@PostMapping("/get/qrcode")
|
||||
@Operation(summary = "微信小程序获取二维码", description = "参数:无, 权限:所有人, 方法名:getQrcode")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<String> getQrcode(@Valid @RequestBody CommonStringRequest commonStringRequest) throws IOException {
|
||||
String inviteCode = commonStringRequest.getTemplateString();
|
||||
String view = wechatGetQrcodeService.getWxQrCode(inviteCode);
|
||||
String view = wechatGetQrcodeService.getWxQrCode(inviteCode, UserRoleEnum.SUPERVISOR);
|
||||
return ResultUtils.success(view);
|
||||
}
|
||||
|
||||
|
@ -1,150 +1,153 @@
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//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.transaction.annotation.Transactional;
|
||||
//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;
|
||||
//
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@Tag(name = "微信支付")
|
||||
//@RequestMapping("/wxPay")
|
||||
//@Transactional
|
||||
//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);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -23,6 +24,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@Tag(name = "微信提现模块")
|
||||
@RequestMapping("/payouts")
|
||||
@Transactional
|
||||
public class WechatPayoutsController {
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ import java.util.*;
|
||||
public class Generator {
|
||||
|
||||
// 数据源配置
|
||||
private static final String DATASOURCE_URL = "jdbc:mysql://27.30.77.229:3306/qingcheng_dev?serverTimezone=Asia/Shanghai";
|
||||
private static final String DATASOURCE_URL = "jdbc:mysql://160.202.242.36:3306/qingcheng_dev?serverTimezone=Asia/Shanghai";
|
||||
private static final String USERNAME = "qingcheng";
|
||||
private static final String PASSWORD = "Qc@8ls2jf";
|
||||
|
||||
@ -27,13 +27,13 @@ public class Generator {
|
||||
// 作者
|
||||
private static final String AUTHOR = "chenxinzhi";
|
||||
// 表注释
|
||||
private static final String TABLE_COMMENT = "晋升申请";
|
||||
private static final String TABLE_COMMENT = "用户绩效汇总";
|
||||
// 实体类名
|
||||
private static final String ENTITY_NAME = "AdvancementApply";
|
||||
private static final String ENTITY_NAME = "UserPerformanceSummary";
|
||||
// 表名
|
||||
private static final String TABLE_NAME = "advancement_apply";
|
||||
private static final String TABLE_NAME = "user_performance_summary";
|
||||
// 实体类属性名
|
||||
private static final String ENTITY_NAME_LOWER = "advancementApply";
|
||||
private static final String ENTITY_NAME_LOWER = "userPerformanceSummary";
|
||||
|
||||
// 父包名
|
||||
private static final String PARENT_PATH = "com.greenorange.promotion";
|
||||
|
@ -0,0 +1,66 @@
|
||||
package com.greenorange.promotion.listener;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.greenorange.promotion.constant.MqConstant;
|
||||
import com.greenorange.promotion.constant.OrderStatusConstant;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.utils.MultiDelayMessage;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OrderStatusListener {
|
||||
|
||||
|
||||
@Resource
|
||||
private CourseOrderService courseOrderService;
|
||||
|
||||
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(MqConstant.DELAY_ORDER_QUEUE),
|
||||
exchange = @Exchange(name = MqConstant.DELAY_EXCHANGE, delayed = "true"),
|
||||
key = MqConstant.DELAY_ORDER_ROUTING_KEY
|
||||
))
|
||||
public void listenDelayMessage(MultiDelayMessage<Long> msg) {
|
||||
System.out.println("\n\n\n\n\nOrderStatusListener.listenerDelayMessage msg-------------------------------->:" + msg);
|
||||
// 1.获取消息中的订单id
|
||||
Long orderId = msg.getData();
|
||||
// 2.查询订单,判断状态是否为待支付
|
||||
CourseOrder courseOrder = courseOrderService.getById(orderId);
|
||||
// 订单不存在或者订单已经支付
|
||||
if (courseOrder == null || !courseOrder.getOrderStatus().equals(OrderStatusConstant.PENDING)) {
|
||||
return ;
|
||||
}
|
||||
// 3.订单未支付,判断是否还有剩余延时时间
|
||||
if (msg.hasNextDelay()) {
|
||||
// 有延迟时间,需要重发延迟消息,先获取延迟时间的int值
|
||||
// 发送延时消息
|
||||
Long delayValue = msg.removeNextDelay();
|
||||
rabbitTemplate.convertAndSend(MqConstant.DELAY_EXCHANGE,
|
||||
MqConstant.DELAY_ORDER_ROUTING_KEY, msg, message -> {
|
||||
// 添加延迟消息属性
|
||||
message.getMessageProperties().setDelayLong(delayValue);
|
||||
return message;
|
||||
});
|
||||
return ;
|
||||
}
|
||||
// 没有剩余延时时间,说明订单超时未支付,需取消订单
|
||||
LambdaUpdateWrapper<CourseOrder> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(CourseOrder::getId, orderId)
|
||||
.set(CourseOrder::getOrderStatus, OrderStatusConstant.CLOSED);
|
||||
courseOrderService.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.greenorange.promotion.mapper;
|
||||
|
||||
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【course_promotion_commission_pending(课程推广待提成记录)】的数据库操作Mapper
|
||||
* @createDate 2025-07-01 09:22:57
|
||||
* @Entity com.greenorange.promotion.model.entity.CoursePromotionCommissionPending
|
||||
*/
|
||||
public interface CoursePromotionCommissionPendingMapper extends BaseMapper<CoursePromotionCommissionPending> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.greenorange.promotion.mapper;
|
||||
|
||||
import com.greenorange.promotion.model.entity.EmployeePromotionRecords;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【employee_promotion_records(员工推广记录表)】的数据库操作Mapper
|
||||
* @createDate 2025-07-12 22:27:51
|
||||
* @Entity com.greenorange.promotion.model.entity.EmployeePromotionRecords
|
||||
*/
|
||||
public interface EmployeePromotionRecordsMapper extends BaseMapper<EmployeePromotionRecords> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.greenorange.promotion.mapper;
|
||||
|
||||
import com.greenorange.promotion.model.entity.RefundRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【refund_record(退款记录表)】的数据库操作Mapper
|
||||
* @createDate 2025-07-01 08:18:44
|
||||
* @Entity com.greenorange.promotion.model.entity.RefundRecord
|
||||
*/
|
||||
public interface RefundRecordMapper extends BaseMapper<RefundRecord> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -20,6 +20,12 @@ public interface UserInfoMapper extends BaseMapper<UserInfo> {
|
||||
List<Long> findPathToRoot(Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前用户的所有下级用户(包括间接)
|
||||
*/
|
||||
List<Long> findAllSubUser(Long userId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.greenorange.promotion.mapper;
|
||||
|
||||
import com.greenorange.promotion.model.entity.UserPerformanceSummary;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【user_performance_summary(用户绩效汇总表)】的数据库操作Mapper
|
||||
* @createDate 2025-07-10 20:38:41
|
||||
* @Entity com.greenorange.promotion.model.entity.UserPerformanceSummary
|
||||
*/
|
||||
public interface UserPerformanceSummaryMapper extends BaseMapper<UserPerformanceSummary> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -40,6 +40,13 @@ public class AdvancementApplyAddRequest implements Serializable {
|
||||
@Schema(description = "验证码", example = "666999")
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@NotBlank(message = "身份证号不能为空")
|
||||
@Schema(description = "身份证号", example = "320123199901010001")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 简历(view值)
|
||||
*/
|
||||
|
@ -16,8 +16,7 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@Schema(description = "晋升申请批准请求体", requiredProperties = {
|
||||
"applyId",
|
||||
"invitationCode",
|
||||
"userRole"
|
||||
"invitationCode"
|
||||
})
|
||||
public class AdvancementApplyApproveRequest implements Serializable {
|
||||
|
||||
@ -29,19 +28,11 @@ public class AdvancementApplyApproveRequest implements Serializable {
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 邀请码
|
||||
* 用户id
|
||||
*/
|
||||
@NotBlank(message = "邀请码不能为空")
|
||||
@Schema(description = "邀请码", example = "666999")
|
||||
private String invitationCode;
|
||||
|
||||
/**
|
||||
* 用户角色
|
||||
*/
|
||||
@NotBlank(message = "用户角色不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "用户角色", example = "user")
|
||||
private String userRole;
|
||||
@Min(value = 1, message = "用户id不能小于1")
|
||||
@Schema(description = "用户id", example = "666999")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Serial
|
||||
|
@ -37,7 +37,7 @@ public class CourseAddRequest implements Serializable {
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@EnumValue(enumClass = CourseTypeEnum.class)
|
||||
@Schema(description = "课程类别[考公,财经]", example = "自媒体")
|
||||
@Schema(description = "课程类别[考公,财经]", example = "财经")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,114 @@
|
||||
package com.greenorange.promotion.model.dto.coursePromotionCommissionPending;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 课程推广待提成记录添加请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "课程推广待提成记录添加请求体", requiredProperties = {
|
||||
"firstUserId",
|
||||
"secondUserId",
|
||||
"courseId",
|
||||
"name",
|
||||
"type",
|
||||
"image",
|
||||
"orderId",
|
||||
"userId",
|
||||
"totalAmount",
|
||||
"commissionStatus",
|
||||
"orderCreateTime",
|
||||
})
|
||||
public class CoursePromotionCommissionPendingAddRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 一级用户
|
||||
*/
|
||||
@Min(value = 1L, message = "一级用户 ID不能小于1")
|
||||
@Schema(description = "一级用户", example = "1")
|
||||
private Long firstUserId;
|
||||
|
||||
/**
|
||||
* 二级用户
|
||||
*/
|
||||
@Min(value = 1L, message = "二级用户 ID不能小于1")
|
||||
@Schema(description = "二级用户", example = "2")
|
||||
private Long secondUserId;
|
||||
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
@Min(value = 1L, message = "课程id ID不能小于1")
|
||||
@Schema(description = "课程id", example = "1")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@NotBlank(message = "课程名称不能为空")
|
||||
@Schema(description = "课程名称", example = "财务管理")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@Schema(description = "课程类别", example = "财经")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@NotBlank(message = "课程图片不能为空")
|
||||
@Schema(description = "课程图片", example = "3JD32NDS")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 课程订单id
|
||||
*/
|
||||
@Min(value = 1L, message = "课程订单id ID不能小于1")
|
||||
@Schema(description = "课程订单id", example = "1")
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 下单用户id
|
||||
*/
|
||||
@Min(value = 1L, message = "下单用户id ID不能小于1")
|
||||
@Schema(description = "下单用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "50.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 提成状态
|
||||
*/
|
||||
@NotBlank(message = "提成状态不能为空")
|
||||
@EnumValue(enumClass = CommissionStatusEnum.class)
|
||||
@Schema(description = "提成状态", example = "待提成")
|
||||
private String commissionStatus;
|
||||
|
||||
/**
|
||||
* 订单创建时间
|
||||
*/
|
||||
@Schema(description = "订单创建时间", example = "2025-05-02 12:23:00")
|
||||
private LocalDate orderCreateTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
package com.greenorange.promotion.model.dto.coursePromotionCommissionPending;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.model.enums.CommissionStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
|
||||
/**
|
||||
* 课程推广待提成记录查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "课程推广待提成记录查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class CoursePromotionCommissionPendingQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Schema(description = "课程名称", example = "财务管理")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@Schema(description = "课程类别", example = "财经")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 提成状态
|
||||
*/
|
||||
@EnumValue(enumClass = CommissionStatusEnum.class)
|
||||
@Schema(description = "提成状态", example = "待提成")
|
||||
private String commissionStatus;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,118 @@
|
||||
package com.greenorange.promotion.model.dto.coursePromotionCommissionPending;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 课程推广待提成记录更新请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "课程推广待提成记录更新请求体", requiredProperties = {
|
||||
"id",
|
||||
"firstUserId",
|
||||
"secondUserId",
|
||||
"courseId",
|
||||
"name",
|
||||
"type",
|
||||
"image",
|
||||
"orderId",
|
||||
"userId",
|
||||
"totalAmount",
|
||||
"commissionStatus",
|
||||
"orderCreateTime",
|
||||
})
|
||||
public class CoursePromotionCommissionPendingUpdateRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Min(value = 1L, message = "id ID不能小于1")
|
||||
@Schema(description = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 一级用户
|
||||
*/
|
||||
@Min(value = 1L, message = "一级用户 ID不能小于1")
|
||||
@Schema(description = "一级用户", example = "")
|
||||
private Long firstUserId;
|
||||
|
||||
/**
|
||||
* 二级用户
|
||||
*/
|
||||
@Min(value = 1L, message = "二级用户 ID不能小于1")
|
||||
@Schema(description = "二级用户", example = "")
|
||||
private Long secondUserId;
|
||||
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
@Min(value = 1L, message = "课程id ID不能小于1")
|
||||
@Schema(description = "课程id", example = "")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@NotBlank(message = "课程名称不能为空")
|
||||
@Schema(description = "课程名称", example = "")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@Schema(description = "课程类别", example = "")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@NotBlank(message = "课程图片不能为空")
|
||||
@Schema(description = "课程图片", example = "")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 课程订单id
|
||||
*/
|
||||
@Min(value = 1L, message = "课程订单id ID不能小于1")
|
||||
@Schema(description = "课程订单id", example = "")
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 下单用户id
|
||||
*/
|
||||
@Min(value = 1L, message = "下单用户id ID不能小于1")
|
||||
@Schema(description = "下单用户id", example = "")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 提成状态
|
||||
*/
|
||||
@NotBlank(message = "提成状态不能为空")
|
||||
@Schema(description = "提成状态", example = "")
|
||||
private String commissionStatus;
|
||||
|
||||
/**
|
||||
* 订单创建时间
|
||||
*/
|
||||
@Schema(description = "订单创建时间", example = "")
|
||||
private LocalDate orderCreateTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.greenorange.promotion.model.dto.refundRecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 退款记录添加请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "退款记录添加请求体", requiredProperties = {
|
||||
"outTradeNo",
|
||||
"outRefundNo",
|
||||
"name",
|
||||
"type",
|
||||
"image",
|
||||
"totalAmount",
|
||||
"refundAmount",
|
||||
"userId",
|
||||
})
|
||||
public class RefundRecordAddRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@NotBlank(message = "订单号不能为空")
|
||||
@Schema(description = "订单号", example = "")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
@NotBlank(message = "退款单号不能为空")
|
||||
@Schema(description = "退款单号", example = "")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@NotBlank(message = "课程名称不能为空")
|
||||
@Schema(description = "课程名称", example = "")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@Schema(description = "课程类别", example = "")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@NotBlank(message = "课程图片不能为空")
|
||||
@Schema(description = "课程图片", example = "")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
@Schema(description = "退款金额", example = "")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Min(value = 1L, message = "用户id ID不能小于1")
|
||||
@Schema(description = "用户id", example = "")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.greenorange.promotion.model.dto.refundRecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
|
||||
/**
|
||||
* 退款记录查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "退款记录查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class RefundRecordQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
@Schema(description = "退款单号", example = "42250701082233444328323233")
|
||||
private String outRefundNo;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
package com.greenorange.promotion.model.dto.refundRecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 退款记录更新请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "退款记录更新请求体", requiredProperties = {
|
||||
"id",
|
||||
"orderNumber",
|
||||
"outRefundNo",
|
||||
"name",
|
||||
"type",
|
||||
"image",
|
||||
"totalAmount",
|
||||
"refundAmount",
|
||||
"userId",
|
||||
})
|
||||
public class RefundRecordUpdateRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 退款记录id
|
||||
*/
|
||||
@Min(value = 1L, message = "退款记录id ID不能小于1")
|
||||
@Schema(description = "退款记录id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@NotBlank(message = "订单号不能为空")
|
||||
@Schema(description = "订单号", example = "")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
@NotBlank(message = "退款单号不能为空")
|
||||
@Schema(description = "退款单号", example = "")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@NotBlank(message = "课程名称不能为空")
|
||||
@Schema(description = "课程名称", example = "")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@NotBlank(message = "课程类别不能为空")
|
||||
@Schema(description = "课程类别", example = "")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@NotBlank(message = "课程图片不能为空")
|
||||
@Schema(description = "课程图片", example = "")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
@Schema(description = "退款金额", example = "")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Min(value = 1L, message = "用户id ID不能小于1")
|
||||
@Schema(description = "用户id", example = "")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.greenorange.promotion.model.dto.userInfo;
|
||||
|
||||
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 = {"id", "nickName", "userAvatar",
|
||||
"phoneNumber", "userPassword"})
|
||||
public class ManagerUserInfoUpdateRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户表 ID
|
||||
*/
|
||||
@Min(value = 1L, message = "用户ID不能小于1")
|
||||
@Schema(description = "用户ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@NotBlank(message = "用户昵称不能为空")
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像URL
|
||||
*/
|
||||
@NotBlank(message = "用户头像URL不能为空")
|
||||
@Schema(description = "用户头像URL", example = "http://xxx.png")
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 密码(建议加密存储)
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.greenorange.promotion.model.dto.userInfo;
|
||||
|
||||
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.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
@ -30,6 +32,15 @@ public class UserInfoMiniPasswordLoginRequest implements Serializable {
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@NotBlank(message = "权限不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "权限", example = "user")
|
||||
private String userRole;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.greenorange.promotion.model.dto.userInfo;
|
||||
|
||||
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.NotBlank;
|
||||
import lombok.Data;
|
||||
@ -29,6 +31,14 @@ public class UserInfoMiniVerifyCodeLoginRequest implements Serializable {
|
||||
@Schema(description = "验证码", example = "666999")
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@NotBlank(message = "权限不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "权限", example = "user")
|
||||
private String userRole;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -1,7 +1,11 @@
|
||||
package com.greenorange.promotion.model.dto.userInfo;
|
||||
|
||||
import com.greenorange.promotion.annotation.BaseEnum;
|
||||
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;
|
||||
@ -28,6 +32,15 @@ public class UserInfoQueryRequest extends PageRequest implements Serializable {
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@NotBlank(message = "权限不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "权限", example = "admin")
|
||||
private String userRole;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.greenorange.promotion.model.dto.userInfo;
|
||||
|
||||
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.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
@ -56,6 +58,14 @@ public class UserInfoRegisterRequest implements Serializable {
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@NotBlank(message = "权限不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "权限", example = "user")
|
||||
private String userRole;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.greenorange.promotion.model.dto.userInfo;
|
||||
|
||||
import com.greenorange.promotion.annotation.EnumValue;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.model.enums.UserRoleEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
@ -16,7 +19,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "小程序用户信息重置请求体", requiredProperties =
|
||||
{"phoneNumber", "verificationCode", "userPassword", "userConfirmPassword"})
|
||||
{"phoneNumber", "verificationCode", "userPassword", "userConfirmPassword, userRole"})
|
||||
public class UserInfoResetRequest implements Serializable {
|
||||
|
||||
/**
|
||||
@ -55,6 +58,14 @@ public class UserInfoResetRequest implements Serializable {
|
||||
@Schema(description = "token(内部重置使用)", example = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTY5MjE5MzE5NywiZXhwIjoxNjkyMTk3Nzk3fQ.Q_5Y5Z")
|
||||
private String sourceToken;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@NotBlank(message = "权限不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "权限", example = "user")
|
||||
private String userRole;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.greenorange.promotion.model.dto.userInfo;
|
||||
|
||||
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.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 验证码发送请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "验证码发送请求体", requiredProperties = {"phoneNumber", "userRole"})
|
||||
public class VerificationCodeGetRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@NotBlank(message = "权限不能为空")
|
||||
@EnumValue(enumClass = UserRoleEnum.class)
|
||||
@Schema(description = "权限", example = "user")
|
||||
private String userRole;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 客户下单汇总查询请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "客户下单汇总查询请求体", requiredProperties = {"nickName", "phoneNumber"})
|
||||
public class MiniUserCourseOrderQueryRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202502345023453428745832")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
@NotNull(message = "主管用户id不能为null")
|
||||
@Schema(description = "员工id", example = "1")
|
||||
private Long staffUserId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 主管绩效汇总查询请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "主管绩效汇总查询请求体", requiredProperties = {"nickName", "phoneNumber"})
|
||||
public class MiniUserPerformanceSummaryQueryRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import com.greenorange.promotion.constant.CommonConstant;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 小程序端绩效排名查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Schema(description = "小程序端绩效排名查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class MiniUserPerformanceSummaryRankQueryRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 起始日期
|
||||
*/
|
||||
@Schema(description = "起始日期", example = "2025-02-29 10:00:00")
|
||||
private String startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@Schema(description = "结束日期", example = "2025-02-29 10:00:00")
|
||||
private String endDate;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
@Schema(description = "排序字段", example = "id")
|
||||
private String sortField;
|
||||
|
||||
/**
|
||||
* 排序顺序(默认升序)
|
||||
*/
|
||||
@Schema(description = "排序顺序((升:ascend;降:descend", example = "ascend")
|
||||
private String sortOrder = CommonConstant.SORT_ORDER_ASC;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
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 = {"nickName", "phoneNumber"})
|
||||
public class MiniUserPerformanceSummaryStaffQueryRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 主管用户id
|
||||
*/
|
||||
@NotNull(message = "主管用户id不能为null")
|
||||
@Schema(description = "主管用户id", example = "1")
|
||||
private Long supervisorUserId;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 抽成比例查询请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "抽成比例查询请求体", requiredProperties = {"level"})
|
||||
public class RakeRewardsQueryRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
@NotBlank(message = "级别不能为空")
|
||||
@Pattern(regexp = "first|second", message = "级别只能是first或second")
|
||||
@Schema(description = "级别", example = "first")
|
||||
private String level;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 抽成比例更新请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "抽成比例更新请求体", requiredProperties = {"level", "rate"})
|
||||
public class RakeRewardsUpdateRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 级别
|
||||
*/
|
||||
@NotBlank(message = "级别不能为空")
|
||||
@Pattern(regexp = "first|second", message = "级别只能是first或second")
|
||||
@Schema(description = "级别", example = "first")
|
||||
private String level;
|
||||
|
||||
|
||||
/**
|
||||
* 抽成比例
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "抽成比例不能小于0.0")
|
||||
@DecimalMax(value = "1.0", message = "抽成比例不能大于1.0")
|
||||
@Schema(description = "抽成比例", example = "0.1")
|
||||
private BigDecimal rate;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 客户下单汇总查询请求体
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "客户下单汇总查询请求体", requiredProperties = {"nickName", "phoneNumber"})
|
||||
public class UserCourseOrderQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202502345023453428745832")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 起始日期
|
||||
*/
|
||||
@Schema(description = "起始日期", example = "2025-02-29 10:00:00")
|
||||
private String startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@Schema(description = "结束日期", example = "2025-02-29 10:00:00")
|
||||
private String endDate;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
@NotNull(message = "主管用户id不能为null")
|
||||
@Schema(description = "员工id", example = "1")
|
||||
private Long staffUserId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
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 UserPerformanceSummaryQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 绩效排名查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "绩效排名查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class UserPerformanceSummaryRankQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 起始日期
|
||||
*/
|
||||
@Schema(description = "起始日期", example = "2025-02-29 10:00:00")
|
||||
private String startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@Schema(description = "结束日期", example = "2025-02-29 10:00:00")
|
||||
private String endDate;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 员工绩效汇总查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "员工绩效汇总查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class UserPerformanceSummaryStaffQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 主管用户id
|
||||
*/
|
||||
@NotNull(message = "主管用户id不能为null")
|
||||
@Schema(description = "主管用户id", example = "1")
|
||||
private Long supervisorUserId;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.greenorange.promotion.model.dto.userPerformanceSummary;
|
||||
|
||||
import com.greenorange.promotion.common.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 主管绩效汇总查询请求体,继承自分页请求 PageRequest
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "主管绩效汇总查询请求体", requiredProperties = {"current", "pageSize"})
|
||||
public class UserPerformanceSummarySupervisorQueryRequest extends PageRequest implements Serializable {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Schema(description = "姓名", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -37,9 +37,9 @@ public class AdvancementApply implements Serializable {
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 查询凭证
|
||||
* 身份证号
|
||||
*/
|
||||
private String credential;
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
|
@ -0,0 +1,124 @@
|
||||
package com.greenorange.promotion.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 课程推广待提成记录
|
||||
* @TableName course_promotion_commission_pending
|
||||
*/
|
||||
@TableName(value ="course_promotion_commission_pending")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CoursePromotionCommissionPending implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 一级用户
|
||||
*/
|
||||
private Long firstUserId;
|
||||
|
||||
/**
|
||||
* 二级用户
|
||||
*/
|
||||
private Long secondUserId;
|
||||
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 课程订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 下单用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 一级抽佣比例
|
||||
*/
|
||||
private BigDecimal firstRate;
|
||||
|
||||
/**
|
||||
* 二级抽佣比例
|
||||
*/
|
||||
private BigDecimal secondRate;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 提成状态
|
||||
*/
|
||||
private String commissionStatus;
|
||||
|
||||
/**
|
||||
* 订单创建时间
|
||||
*/
|
||||
private Date orderCreateTime;
|
||||
|
||||
/**
|
||||
* 一级抽成奖励
|
||||
*/
|
||||
private BigDecimal firstReward;
|
||||
|
||||
/**
|
||||
* 二级抽成奖励
|
||||
*/
|
||||
private BigDecimal secondReward;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
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 jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 员工推广记录表
|
||||
* @TableName employee_promotion_records
|
||||
*/
|
||||
@TableName(value ="employee_promotion_records")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class EmployeePromotionRecords implements Serializable {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 主管ID
|
||||
*/
|
||||
private Long firstUserId;
|
||||
|
||||
/**
|
||||
* 员工ID
|
||||
*/
|
||||
private Long secondUserId;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.greenorange.promotion.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 退款记录表
|
||||
* @TableName refund_record
|
||||
*/
|
||||
@TableName(value ="refund_record")
|
||||
@Data
|
||||
public class RefundRecord implements Serializable {
|
||||
/**
|
||||
* 退款记录id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -7,7 +7,12 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 用户主要信息表
|
||||
@ -15,6 +20,9 @@ import lombok.Data;
|
||||
*/
|
||||
@TableName(value ="user_main_info")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class UserMainInfo implements Serializable {
|
||||
/**
|
||||
* 主键ID
|
||||
|
@ -0,0 +1,102 @@
|
||||
package com.greenorange.promotion.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 用户绩效汇总表
|
||||
* @TableName user_performance_summary
|
||||
*/
|
||||
@TableName(value ="user_performance_summary")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class UserPerformanceSummary implements Serializable {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 净成交
|
||||
*/
|
||||
private BigDecimal netAmount;
|
||||
|
||||
/**
|
||||
* 推广人数
|
||||
*/
|
||||
private Integer promoCount;
|
||||
|
||||
/**
|
||||
* 员工数量
|
||||
*/
|
||||
private Integer empCount;
|
||||
|
||||
/**
|
||||
* 下单数量
|
||||
*/
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 待释放
|
||||
*/
|
||||
private BigDecimal toRelease;
|
||||
|
||||
/**
|
||||
* 可结算
|
||||
*/
|
||||
private BigDecimal toSettle;
|
||||
|
||||
/**
|
||||
* 已结算
|
||||
*/
|
||||
private BigDecimal settled;
|
||||
|
||||
/**
|
||||
* 已回退
|
||||
*/
|
||||
private BigDecimal refunded;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
@Serial
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.greenorange.promotion.model.enums;
|
||||
|
||||
import com.greenorange.promotion.annotation.BaseEnum;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 提成状态枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum CommissionStatusEnum implements BaseEnum {
|
||||
|
||||
PENDING("待提成"),
|
||||
COMPLETED("已提成"),
|
||||
EXPIRED("已失效");
|
||||
|
||||
private final String value;
|
||||
|
||||
CommissionStatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* BaseEnum 要求的方法:返回枚举对应的校验值
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有枚举值列表
|
||||
*/
|
||||
public static List<String> getValues() {
|
||||
return Arrays.stream(values())
|
||||
.map(CommissionStatusEnum::getValue)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据值获取对应的枚举对象
|
||||
*/
|
||||
public static CommissionStatusEnum getEnumByValue(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
for (CommissionStatusEnum status : CommissionStatusEnum.values()) {
|
||||
if (status.value.equals(value)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -15,7 +15,8 @@ import java.util.stream.Collectors;
|
||||
public enum CourseTypeEnum implements BaseEnum {
|
||||
|
||||
KAOGONG("考公"),
|
||||
CAIJING("财经");
|
||||
KAOBIAN("考编"),
|
||||
KAOZHENG("考证");
|
||||
|
||||
private final String value;
|
||||
|
||||
|
@ -13,6 +13,12 @@ import java.io.Serializable;
|
||||
@Schema(description = "晋升申请审核结果 视图对象")
|
||||
public class AdvancementApplyApproveVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 晋升id
|
||||
*/
|
||||
@Schema(description = "晋升id", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请人姓名
|
||||
*/
|
||||
@ -37,12 +43,6 @@ public class AdvancementApplyApproveVO implements Serializable {
|
||||
@Schema(description = "拒绝理由", example = "无")
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@Schema(description = "账号", example = "qingcheng")
|
||||
private String userAccount;
|
||||
|
||||
|
||||
/**
|
||||
* 密码(建议加密存储)
|
||||
@ -51,6 +51,13 @@ public class AdvancementApplyApproveVO implements Serializable {
|
||||
private String userPassword;
|
||||
|
||||
|
||||
/**
|
||||
* 用户权限
|
||||
*/
|
||||
@Schema(description = "用户权限", example = "user")
|
||||
private String userRole;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -41,10 +41,10 @@ public class AdvancementApplyVO implements Serializable {
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 查询凭证
|
||||
* 身份证号
|
||||
*/
|
||||
@Schema(description = "查询凭证", example = "cef281c7-578f-4cc9-aca9-f1b5f6bcacb1")
|
||||
private String credential;
|
||||
@Schema(description = "身份证号", example = "320123199901010001")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
|
@ -38,10 +38,10 @@ public class AdvancementApplyVOPlus implements Serializable {
|
||||
private String resume;
|
||||
|
||||
/**
|
||||
* 查询凭证
|
||||
* 身份证号
|
||||
*/
|
||||
@Schema(description = "查询凭证", example = "cef281c7-578f-4cc9-aca9-f1b5f6bcacb1")
|
||||
private String credential;
|
||||
@Schema(description = "身份证号", example = "33100402232434324243")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
|
@ -0,0 +1,65 @@
|
||||
package com.greenorange.promotion.model.vo.courseOrder;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CourseOrderBaseInfoVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程订单ID
|
||||
*/
|
||||
@Schema(description = "课程订单ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202506241339232334d234234243")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "100.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
@Schema(description = "订单状态[交易关闭,交易成功,待支付,已退款]", example = "交易成功")
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -3,6 +3,7 @@ package com.greenorange.promotion.model.vo.courseOrder;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -57,4 +58,7 @@ public class CourseOrderCardVO implements Serializable {
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
package com.greenorange.promotion.model.vo.courseOrder;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CourseOrderDetailInfoVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程订单ID
|
||||
*/
|
||||
@Schema(description = "课程订单ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202506241339232334d234234243")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "100.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 订单状态[交易关闭,交易成功,待支付,已退款]
|
||||
*/
|
||||
@Schema(description = "订单状态[交易关闭,交易成功,待支付,已退款]", example = "交易成功")
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 一级抽佣比例
|
||||
*/
|
||||
@Schema(description = "一级抽佣比例", example = "0.05")
|
||||
private BigDecimal firstRate;
|
||||
|
||||
/**
|
||||
* 二级抽佣比例
|
||||
*/
|
||||
@Schema(description = "二级抽佣比例", example = "0.05")
|
||||
private BigDecimal secondRate;
|
||||
|
||||
/**
|
||||
* 一级抽成奖励
|
||||
*/
|
||||
@Schema(description = "一级抽成奖励", example = "5.00")
|
||||
private BigDecimal firstReward;
|
||||
|
||||
/**
|
||||
* 二级抽成奖励
|
||||
*/
|
||||
@Schema(description = "二级抽成奖励", example = "5.00")
|
||||
private BigDecimal secondReward;
|
||||
|
||||
/**
|
||||
* 提成状态
|
||||
*/
|
||||
@Schema(description = "提成状态", example = "待提成")
|
||||
private String commissionStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2025-06-24 13:39:23")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.greenorange.promotion.model.vo.coursePromotionCommissionPending;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 课程推广待提成记录 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "课程推广待提成记录 视图对象")
|
||||
public class CoursePromotionCommissionPendingVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 课程推广待提成记录ID
|
||||
*/
|
||||
@Schema(description = "课程推广待提成记录ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 一级用户
|
||||
*/
|
||||
@Schema(description = "一级用户", example = "1")
|
||||
private Long firstUserId;
|
||||
|
||||
/**
|
||||
* 二级用户
|
||||
*/
|
||||
@Schema(description = "二级用户", example = "2")
|
||||
private Long secondUserId;
|
||||
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
@Schema(description = "课程id", example = "1")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Schema(description = "课程名称", example = "财务管理")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@Schema(description = "课程类别", example = "财经")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@Schema(description = "课程图片", example = "3DIKE323")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 课程订单id
|
||||
*/
|
||||
@Schema(description = "课程订单id", example = "1")
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 下单用户id
|
||||
*/
|
||||
@Schema(description = "下单用户id", example = "3")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "50.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 提成状态
|
||||
*/
|
||||
@Schema(description = "提成状态", example = "待提成")
|
||||
private String commissionStatus;
|
||||
|
||||
/**
|
||||
* 订单创建时间
|
||||
*/
|
||||
@Schema(description = "订单创建时间", example = "2025-07-01 12:00:00")
|
||||
private LocalDate orderCreateTime;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package com.greenorange.promotion.model.vo.dashboard;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class WebQueryDashboardVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "1000.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 净成交
|
||||
*/
|
||||
@Schema(description = "净成交", example = "800.00")
|
||||
private BigDecimal netAmount;
|
||||
|
||||
/**
|
||||
* 客户数量
|
||||
*/
|
||||
@Schema(description = "客户数量", example = "10")
|
||||
private Integer promoCount;
|
||||
|
||||
/**
|
||||
* 主管数量
|
||||
*/
|
||||
@Schema(description = "主管数量", example = "15")
|
||||
private Integer superCount;
|
||||
|
||||
/**
|
||||
* 员工数量
|
||||
*/
|
||||
@Schema(description = "员工数量", example = "15")
|
||||
private Integer empCount;
|
||||
|
||||
/**
|
||||
* 下单数量
|
||||
*/
|
||||
@Schema(description = "下单数量", example = "25")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 待释放
|
||||
*/
|
||||
@Schema(description = "待释放", example = "1000.00")
|
||||
private BigDecimal toRelease;
|
||||
|
||||
/**
|
||||
* 可结算
|
||||
*/
|
||||
@Schema(description = "可结算", example = "600.00")
|
||||
private BigDecimal toSettle;
|
||||
|
||||
/**
|
||||
* 已结算
|
||||
*/
|
||||
@Schema(description = "已结算", example = "200.00")
|
||||
private BigDecimal settled;
|
||||
|
||||
/**
|
||||
* 已回退
|
||||
*/
|
||||
@Schema(description = "已回退", example = "100.00")
|
||||
private BigDecimal refunded;
|
||||
|
||||
/**
|
||||
* 今日下单数量
|
||||
*/
|
||||
@Schema(description = "今日下单数量", example = "10")
|
||||
private Integer todayOrderCount;
|
||||
|
||||
/**
|
||||
* 今日下单总金额
|
||||
*/
|
||||
@Schema(description = "今日下单总金额", example = "100.00")
|
||||
private BigDecimal todayOrderAmount;
|
||||
|
||||
/**
|
||||
* 今日退款数量
|
||||
*/
|
||||
@Schema(description = "今日退款数量", example = "10")
|
||||
private Integer todayRefundCount;
|
||||
|
||||
/**
|
||||
* 今日下单退款金额
|
||||
*/
|
||||
@Schema(description = "今日下单退款金额", example = "90.00")
|
||||
private BigDecimal todayRefundAmount;
|
||||
|
||||
/**
|
||||
* 今日推广数量
|
||||
*/
|
||||
@Schema(description = "今日推广数量", example = "10")
|
||||
private Integer todayPromotionCount;
|
||||
|
||||
/**
|
||||
* 本月下单数量
|
||||
*/
|
||||
@Schema(description = "本月下单数量", example = "100")
|
||||
private Integer monthOrderCount;
|
||||
|
||||
/**
|
||||
* 本月下单金额
|
||||
*/
|
||||
@Schema(description = "本月下单金额", example = "1000.00")
|
||||
private BigDecimal monthOrderAmount;
|
||||
|
||||
/**
|
||||
* 本月退款数量
|
||||
*/
|
||||
@Schema(description = "本月退款数量", example = "10")
|
||||
private Integer monthRefundCount;
|
||||
|
||||
/**
|
||||
* 本月退款金额
|
||||
*/
|
||||
@Schema(description = "本月退款金额", example = "1000.00")
|
||||
private BigDecimal monthRefundAmount;
|
||||
|
||||
/**
|
||||
* 本月推广数量
|
||||
*/
|
||||
@Schema(description = "本月推广数量", example = "10")
|
||||
private Integer monthPromotionCount;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.greenorange.promotion.model.vo.refundRecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 退款记录 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "退款记录 视图对象")
|
||||
public class RefundRecordVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 退款记录ID
|
||||
*/
|
||||
@Schema(description = "退款记录ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Schema(description = "订单号", example = "202507011522234822953432323")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
@Schema(description = "退款单号", example = "402507011522234822953432323")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
@Schema(description = "课程名称", example = "数据分析工程师训练营")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
@Schema(description = "课程类别", example = "财经")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程图片
|
||||
*/
|
||||
@Schema(description = "课程图片", example = "32DE33ND")
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 订单价格
|
||||
*/
|
||||
@Schema(description = "订单价格", example = "50.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
@Schema(description = "退款金额", example = "40.00")
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2025-07-01 15:22:23")
|
||||
private Date createTime;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.greenorange.promotion.model.vo.userInfo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 经理信息 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "经理信息 视图对象")
|
||||
public class ManagerUserInfoVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户表 ID
|
||||
*/
|
||||
@Schema(description = "用户ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像URL
|
||||
*/
|
||||
@Schema(description = "用户头像URL", example = "http://xxx.png")
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 密码(建议加密存储)
|
||||
*/
|
||||
@Schema(description = "密码(建议加密存储)", example = "qingcheng")
|
||||
private String userPassword;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.greenorange.promotion.model.vo.userInfo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 员工用户 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "员工用户 视图对象")
|
||||
public class StaffUserVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户表 ID
|
||||
*/
|
||||
@Schema(description = "用户ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像URL
|
||||
*/
|
||||
@Schema(description = "用户头像URL", example = "http://xxx.png")
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@Schema(description = "账号", example = "qingcheng")
|
||||
private String userAccount;
|
||||
|
||||
|
||||
/**
|
||||
* 邀请码
|
||||
*/
|
||||
@Schema(description = "邀请码", example = "666999")
|
||||
private String invitationCode;
|
||||
|
||||
|
||||
/**
|
||||
* 团队人数(不包括自己)
|
||||
*/
|
||||
@Schema(description = "团队人数(不包括自己)", example = "8")
|
||||
private Integer teamSize;
|
||||
|
||||
|
||||
/**
|
||||
* 团队收益
|
||||
*/
|
||||
@Schema(description = "团队收益", example = "25.00")
|
||||
private BigDecimal teamEarnings;
|
||||
|
||||
|
||||
/**
|
||||
* 给上级带来的收益
|
||||
*/
|
||||
@Schema(description = "给上级带来的收益", example = "8.00")
|
||||
private BigDecimal parentEarnings;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.greenorange.promotion.model.vo.userInfo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 主管列表信息 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "主管列表信息 视图对象")
|
||||
public class SupervisorUserInfoVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户表 ID
|
||||
*/
|
||||
@Schema(description = "用户ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.greenorange.promotion.model.vo.userInfo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 主管用户 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "主管用户 视图对象")
|
||||
public class SupervisorUserVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户表 ID
|
||||
*/
|
||||
@Schema(description = "用户ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像URL
|
||||
*/
|
||||
@Schema(description = "用户头像URL", example = "http://xxx.png")
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@Schema(description = "账号", example = "qingcheng")
|
||||
private String userAccount;
|
||||
|
||||
|
||||
/**
|
||||
* 邀请码
|
||||
*/
|
||||
@Schema(description = "邀请码", example = "666999")
|
||||
private String invitationCode;
|
||||
|
||||
|
||||
/**
|
||||
* 团队人数(不包括自己)
|
||||
*/
|
||||
@Schema(description = "团队人数(不包括自己)", example = "8")
|
||||
private Integer teamSize;
|
||||
|
||||
|
||||
/**
|
||||
* 团队收益
|
||||
*/
|
||||
@Schema(description = "团队收益", example = "25.00")
|
||||
private BigDecimal teamEarnings;
|
||||
|
||||
|
||||
/**
|
||||
* 给上级带来的收益
|
||||
*/
|
||||
@Schema(description = "给上级带来的收益", example = "8.00")
|
||||
private BigDecimal parentEarnings;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.greenorange.promotion.model.vo.userPerformanceSummary;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 员工绩效排名信息 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "员工绩效排名信息 视图对象")
|
||||
public class StaffPerformanceSummaryVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 推广人数
|
||||
*/
|
||||
@Schema(description = "推广人数", example = "300")
|
||||
private Integer promoCount;
|
||||
|
||||
/**
|
||||
* 下单数量
|
||||
*/
|
||||
@Schema(description = "下单数量", example = "100")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "15.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 净成交
|
||||
*/
|
||||
@Schema(description = "净成交", example = "20.00")
|
||||
private BigDecimal netAmount;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.greenorange.promotion.model.vo.userPerformanceSummary;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 主管绩效排名信息 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "主管绩效排名信息 视图对象")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SupervisorPerformanceSummaryVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 员工数量
|
||||
*/
|
||||
@Schema(description = "员工数量", example = "150")
|
||||
private Integer empCount;
|
||||
|
||||
/**
|
||||
* 推广人数
|
||||
*/
|
||||
@Schema(description = "推广人数", example = "300")
|
||||
private Integer promoCount;
|
||||
|
||||
/**
|
||||
* 下单数量
|
||||
*/
|
||||
@Schema(description = "下单数量", example = "100")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "15.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 净成交
|
||||
*/
|
||||
@Schema(description = "净成交", example = "20.00")
|
||||
private BigDecimal netAmount;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package com.greenorange.promotion.model.vo.userPerformanceSummary;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 用户详细信息绩效汇总 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "用户详细信息绩效汇总 视图对象")
|
||||
public class UserPerformanceSummaryDetailVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户绩效汇总ID
|
||||
*/
|
||||
@Schema(description = "用户绩效汇总ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Schema(description = "用户昵称", example = "chenxinzhi")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号", example = "15888610253")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "15.00")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 净成交
|
||||
*/
|
||||
@Schema(description = "净成交", example = "20.00")
|
||||
private BigDecimal netAmount;
|
||||
|
||||
/**
|
||||
* 推广人数
|
||||
*/
|
||||
@Schema(description = "推广人数", example = "300")
|
||||
private Integer promoCount;
|
||||
|
||||
/**
|
||||
* 员工数量
|
||||
*/
|
||||
@Schema(description = "员工数量", example = "20")
|
||||
private Integer empCount;
|
||||
|
||||
/**
|
||||
* 下单数量
|
||||
*/
|
||||
@Schema(description = "下单数量", example = "100")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 待释放
|
||||
*/
|
||||
@Schema(description = "待释放", example = "10.00")
|
||||
private BigDecimal toRelease;
|
||||
|
||||
/**
|
||||
* 可结算
|
||||
*/
|
||||
@Schema(description = "可结算", example = "30.00")
|
||||
private BigDecimal toSettle;
|
||||
|
||||
/**
|
||||
* 已结算
|
||||
*/
|
||||
@Schema(description = "已结算", example = "40.00")
|
||||
private BigDecimal settled;
|
||||
|
||||
/**
|
||||
* 已回退
|
||||
*/
|
||||
@Schema(description = "已回退", example = "20.00")
|
||||
private BigDecimal refunded;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "1")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 抽成比例
|
||||
*/
|
||||
@Schema(description = "抽成比例", example = "0.05")
|
||||
private BigDecimal rakeRewardsRate;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.greenorange.promotion.model.vo.userPerformanceSummary;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 用户绩效汇总 视图对象
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "用户绩效汇总 视图对象")
|
||||
public class UserPerformanceSummaryVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户绩效汇总ID
|
||||
*/
|
||||
@Schema(description = "用户绩效汇总ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
@Schema(description = "订单总金额", example = "")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 净成交
|
||||
*/
|
||||
@Schema(description = "净成交", example = "")
|
||||
private BigDecimal netAmount;
|
||||
|
||||
/**
|
||||
* 推广人数
|
||||
*/
|
||||
@Schema(description = "推广人数", example = "")
|
||||
private Integer promoCount;
|
||||
|
||||
/**
|
||||
* 员工数量
|
||||
*/
|
||||
@Schema(description = "员工数量", example = "")
|
||||
private Integer empCount;
|
||||
|
||||
/**
|
||||
* 下单数量
|
||||
*/
|
||||
@Schema(description = "下单数量", example = "")
|
||||
private Integer orderCount;
|
||||
|
||||
/**
|
||||
* 待释放
|
||||
*/
|
||||
@Schema(description = "待释放", example = "")
|
||||
private BigDecimal toRelease;
|
||||
|
||||
/**
|
||||
* 可结算
|
||||
*/
|
||||
@Schema(description = "可结算", example = "")
|
||||
private BigDecimal toSettle;
|
||||
|
||||
/**
|
||||
* 已结算
|
||||
*/
|
||||
@Schema(description = "已结算", example = "")
|
||||
private BigDecimal settled;
|
||||
|
||||
/**
|
||||
* 已回退
|
||||
*/
|
||||
@Schema(description = "已回退", example = "")
|
||||
private BigDecimal refunded;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id", example = "")
|
||||
private Long userId;
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -12,19 +12,6 @@ import java.util.function.Function;
|
||||
public interface CommonService {
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 从源集合中提取指定属性并作为查询条件查询目标集合
|
||||
// * @param sourceList 源集合(List<T>),包含需要提取属性的元素
|
||||
// * @param service 执行查询的 Service
|
||||
// * @param getField 提取源集合中每个元素的属性值的函数
|
||||
// * @param targetField 目标集合中查询字段的字段名
|
||||
// * @param <T> 源集合元素类型
|
||||
// * @param <R> 目标集合中元素类型
|
||||
// * @return 查询结果集合
|
||||
// */
|
||||
// <T, R> List<R> findByFieldInTargetField(List<T> sourceList, IService<R> service, Function<T, Object> getField, String targetField);
|
||||
|
||||
/**
|
||||
* 从源集合中提取指定属性并作为查询条件查询目标集合
|
||||
*
|
||||
@ -45,19 +32,6 @@ public interface CommonService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 根据指定字段名和值,使用给定的服务对象构建查询条件。
|
||||
// * @param <T> 实体类类型
|
||||
// * @param fieldName 查询字段的名称
|
||||
// * @param fieldValue 查询字段的值
|
||||
// * @param service 用于执行查询的服务层对象
|
||||
// *
|
||||
// * @return 返回构建的 QueryWrapper 对象,用于进一步查询或修改
|
||||
// */
|
||||
// <T> QueryWrapper<T> buildQueryWrapperByField(String fieldName, Object fieldValue, IService<T> service);
|
||||
|
||||
/**
|
||||
* 根据指定字段和值,使用给定的服务对象构建查询条件。
|
||||
*
|
||||
@ -74,16 +48,6 @@ public interface CommonService {
|
||||
);
|
||||
|
||||
|
||||
// /**
|
||||
// * 根据指定字段名和值,使用给定的服务对象查询对应的实体类列表。
|
||||
// * @param <T> 实体类类型
|
||||
// * @param fieldName 查询字段的名称
|
||||
// * @param fieldValue 查询字段的值
|
||||
// * @param service 用于执行查询的服务层对象
|
||||
// * @return 返回符合条件的实体类列表(`List<T>`)。如果没有符合条件的记录,返回空列表。
|
||||
// */
|
||||
// <T> List<T> findByFieldEqTargetField(String fieldName, Object fieldValue, IService<T> service);
|
||||
|
||||
/**
|
||||
* 根据指定字段和值,使用给定的服务对象查询对应的实体类列表。
|
||||
*
|
||||
@ -100,19 +64,6 @@ public interface CommonService {
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 根据多个字段和对应的值进行查询。
|
||||
// * 该方法可以动态构建查询条件并执行查询。
|
||||
// *
|
||||
// * @param fieldConditions 查询条件的字段和值,使用Map存储
|
||||
// * @param service 执行查询操作的服务对象(通常是MyBatis-Plus的 IService)
|
||||
// * @return 返回查询结果的列表
|
||||
// */
|
||||
// <T> List<T> findByFieldEqTargetFields(Map<String, Object> fieldConditions, IService<T> service);
|
||||
|
||||
|
||||
/**
|
||||
* 根据多个字段和对应的值进行查询。
|
||||
* 该方法可以动态构建查询条件并执行查询。
|
||||
@ -143,8 +94,6 @@ public interface CommonService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 复制属性并返回新的目标对象
|
||||
*
|
||||
@ -157,4 +106,63 @@ public interface CommonService {
|
||||
<S, T> T copyProperties(S source, Class<T> targetClass);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 从源集合中提取指定属性并作为查询条件查询目标集合,同时只返回指定的属性。
|
||||
* 通过 MyBatis-Plus 的 `select` 方法,限制查询时返回的字段,避免查询不必要的字段,从而提高性能。
|
||||
*
|
||||
* @param sourceList 源集合(List<T>),包含需要提取属性的元素
|
||||
* @param service 执行查询的 MyBatis-Plus IService<R> 实例,用于调用数据库查询方法
|
||||
* @param sourceField 提取源集合中每个元素的属性值的函数(如 T::getId),用于获取源集合中元素的属性值
|
||||
* @param targetField 目标集合中查询字段的函数引用(如 R::getForeignId),用于指定查询条件
|
||||
* @param targetFields 需要返回的目标字段列表,包含希望从目标集合中查询的字段(如 R::getId, R::getName)
|
||||
* @param <T> 源集合元素类型
|
||||
* @param <R> 目标集合中元素类型
|
||||
* @return 查询结果集合,包含指定字段的数据,其他字段为 null
|
||||
*/
|
||||
<T, R> List<R> findByFieldInTargetFieldWithSpecificFields(
|
||||
List<T> sourceList,
|
||||
IService<R> service,
|
||||
Function<T, ?> sourceField,
|
||||
SFunction<R, ?> targetField,
|
||||
List<SFunction<R, ?>> targetFields
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 根据指定字段和值,使用给定的服务对象查询对应的实体类列表,并且只返回指定的字段。
|
||||
*
|
||||
* @param <T> 实体类类型
|
||||
* @param field 目标查询字段的函数引用(如 User::getUsername)
|
||||
* @param fieldValue 查询字段的值
|
||||
* @param service 用于执行查询的服务层对象
|
||||
* @param targetFields 需要返回的目标字段列表
|
||||
* @return 返回符合条件的实体类列表(List<T>)。如果没有符合条件的记录,返回空列表。
|
||||
*/
|
||||
<T> List<T> findByFieldEqTargetFieldWithSpecificFields(
|
||||
SFunction<T, ?> field,
|
||||
Object fieldValue,
|
||||
IService<T> service,
|
||||
List<SFunction<T, ?>> targetFields
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 根据多个字段和对应的值进行查询,同时只返回指定的字段。
|
||||
* 该方法可以动态构建查询条件并执行查询。
|
||||
*
|
||||
* @param <T> 实体类类型
|
||||
* @param fieldConditions 查询条件的字段引用和值,使用 Map 存储
|
||||
* (key:R::getXxx,value:对应的查询值)
|
||||
* @param service 执行查询操作的服务对象(MyBatis-Plus 的 IService)
|
||||
* @param targetFields 需要返回的目标字段列表
|
||||
* @return 返回查询结果的列表,只包含指定的字段
|
||||
*/
|
||||
<T> List<T> findByFieldEqTargetFieldsWithSpecificColumns(
|
||||
Map<SFunction<T, ?>, Object> fieldConditions,
|
||||
IService<T> service,
|
||||
List<SFunction<T, ?>> targetFields
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,37 +18,6 @@ public class CommonServiceImpl implements CommonService {
|
||||
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 从源集合中提取指定属性并作为查询条件查询目标集合
|
||||
// * @param sourceList 源集合(List<T>),包含需要提取属性的元素
|
||||
// * @param service 执行查询的 Service
|
||||
// * @param getField 提取源集合中每个元素的属性值的函数
|
||||
// * @param targetField 目标集合中查询字段的字段名
|
||||
// * @param <T> 源集合元素类型
|
||||
// * @param <R> 目标集合中元素类型
|
||||
// * @return 查询结果集合
|
||||
// */
|
||||
// public <T, R> List<R> findByFieldInTargetField(List<T> sourceList, IService<R> service, Function<T, Object> getField, String targetField) {
|
||||
// // 提取源集合中每个元素的字段值
|
||||
// List<Object> fieldValues = sourceList.stream()
|
||||
// .map(getField) // 提取每个元素的字段值
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 如果 fieldValues 为空,直接返回空集合
|
||||
// if (fieldValues.isEmpty()) {
|
||||
// return List.of(); // 返回空集合
|
||||
// }
|
||||
//
|
||||
// // 创建查询条件
|
||||
// QueryWrapper<R> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.in(targetField, fieldValues); // 根据字段值进行查询
|
||||
//
|
||||
// // 执行查询并返回结果
|
||||
// return service.list(queryWrapper);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 从源集合中提取指定属性并作为查询条件查询目标集合
|
||||
*
|
||||
@ -86,26 +55,6 @@ public class CommonServiceImpl implements CommonService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 根据指定字段名和值,使用给定的服务对象构建查询条件。
|
||||
// * @param <T> 实体类类型
|
||||
// * @param fieldName 查询字段的名称
|
||||
// * @param fieldValue 查询字段的值
|
||||
// * @param service 用于执行查询的服务层对象
|
||||
// *
|
||||
// * @return 返回构建的 QueryWrapper 对象,用于进一步查询或修改
|
||||
// */
|
||||
// @Override
|
||||
// public <T> QueryWrapper<T> buildQueryWrapperByField(String fieldName, Object fieldValue, IService<T> service) {
|
||||
// // 创建 QueryWrapper,动态构建查询条件
|
||||
// QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.eq(fieldName, fieldValue); // 设置等值查询条件
|
||||
//
|
||||
// // 返回 QueryWrapper,供外部使用
|
||||
// return queryWrapper;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 根据指定字段和值,使用给定的服务对象构建查询条件。
|
||||
*
|
||||
@ -132,26 +81,6 @@ public class CommonServiceImpl implements CommonService {
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 根据指定字段名和值,使用给定的服务对象查询对应的实体类列表。
|
||||
// * @param <T> 实体类类型
|
||||
// * @param fieldName 查询字段的名称
|
||||
// * @param fieldValue 查询字段的值
|
||||
// * @param service 用于执行查询的服务层对象
|
||||
// *
|
||||
// * @return 返回符合条件的实体类列表(`List<T>`)。如果没有符合条件的记录,返回空列表。
|
||||
// */
|
||||
// @Override
|
||||
// public <T> List<T> findByFieldEqTargetField(String fieldName, Object fieldValue, IService<T> service) {
|
||||
// // 创建 QueryWrapper,动态构建查询条件
|
||||
// QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.eq(fieldName, fieldValue); // 设置等值查询条件
|
||||
//
|
||||
// // 执行查询
|
||||
// return service.list(queryWrapper);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 根据指定字段和值,使用给定的服务对象查询对应的实体类列表。
|
||||
*
|
||||
@ -177,30 +106,6 @@ public class CommonServiceImpl implements CommonService {
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 根据多个字段和对应的值进行查询。
|
||||
// * 该方法根据输入的查询条件,动态构建查询,并执行数据库查询。
|
||||
// * @param fieldConditions 查询条件的字段和值,使用Map存储
|
||||
// * @param service 执行查询操作的服务对象(通常是MyBatis-Plus的 IService)
|
||||
// * @return 返回查询结果的列表
|
||||
// */
|
||||
// @Override
|
||||
// public <T> List<T> findByFieldEqTargetFields(Map<String, Object> fieldConditions, IService<T> service) {
|
||||
// // 创建 QueryWrapper,动态构建查询条件
|
||||
// QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
||||
//
|
||||
// // 遍历传入的条件Map,逐个设置查询条件
|
||||
// for (Map.Entry<String, Object> entry : fieldConditions.entrySet()) {
|
||||
// // 设置等值查询条件
|
||||
// queryWrapper.eq(entry.getKey(), entry.getValue());
|
||||
// }
|
||||
//
|
||||
// // 执行查询,并返回结果
|
||||
// return service.list(queryWrapper);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据多个字段和对应的值进行查询。
|
||||
* 该方法可以动态构建查询条件并执行查询。
|
||||
@ -286,4 +191,114 @@ public class CommonServiceImpl implements CommonService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 从源集合中提取指定属性并作为查询条件查询目标集合,同时只返回指定的属性。
|
||||
* 通过 MyBatis-Plus 的 `select` 方法,限制查询时返回的字段,避免查询不必要的字段,从而提高性能。
|
||||
*
|
||||
* @param sourceList 源集合(List<T>),包含需要提取属性的元素
|
||||
* @param service 执行查询的 MyBatis-Plus IService<R> 实例,用于调用数据库查询方法
|
||||
* @param sourceField 提取源集合中每个元素的属性值的函数(如 T::getId),用于获取源集合中元素的属性值
|
||||
* @param targetField 目标集合中查询字段的函数引用(如 R::getForeignId),用于指定查询条件
|
||||
* @param targetFields 需要返回的目标字段列表,包含希望从目标集合中查询的字段(如 R::getId, R::getName)
|
||||
* @param <T> 源集合元素类型
|
||||
* @param <R> 目标集合中元素类型
|
||||
* @return 查询结果集合,包含指定字段的数据,其他字段为 null
|
||||
*/
|
||||
@Override
|
||||
public <T, R> List<R> findByFieldInTargetFieldWithSpecificFields(
|
||||
List<T> sourceList,
|
||||
IService<R> service,
|
||||
Function<T, ?> sourceField,
|
||||
SFunction<R, ?> targetField,
|
||||
List<SFunction<R, ?>> targetFields
|
||||
) {
|
||||
// 提取源集合中每个元素的字段值,获取源集合中每个元素的属性值
|
||||
List<Object> fieldValues = sourceList.stream()
|
||||
.map(sourceField) // 使用传入的 sourceField 函数获取每个元素的属性值
|
||||
.collect(Collectors.toList()); // 收集到 List 中
|
||||
|
||||
// 如果源集合为空,直接返回空集合
|
||||
if (fieldValues.isEmpty()) {
|
||||
return List.of(); // 返回一个空集合
|
||||
}
|
||||
|
||||
// 使用 LambdaQueryWrapper 构造 in 查询条件,确保查询时根据源集合中提取的字段值进行筛选
|
||||
LambdaQueryWrapper<R> query = new LambdaQueryWrapper<>();
|
||||
query.in(targetField, fieldValues); // 设置查询条件:targetField 在 fieldValues 中
|
||||
|
||||
// 动态选择需要返回的字段,传入指定的 targetFields 列表
|
||||
query.select(targetFields.toArray(new SFunction[0])); // 将 targetFields 列表转换为数组传递给 select 方法
|
||||
|
||||
// 执行查询并返回结果
|
||||
return service.list(query); // 执行查询并返回查询结果
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据指定字段和值,使用给定的服务对象查询对应的实体类列表,并且只返回指定的字段。
|
||||
*
|
||||
* @param <T> 实体类类型
|
||||
* @param field 目标查询字段的函数引用(如 User::getUsername)
|
||||
* @param fieldValue 查询字段的值
|
||||
* @param service 用于执行查询的服务层对象
|
||||
* @param targetFields 需要返回的目标字段列表
|
||||
* @return 返回符合条件的实体类列表(List<T>)。如果没有符合条件的记录,返回空列表。
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> findByFieldEqTargetFieldWithSpecificFields(
|
||||
SFunction<T, ?> field,
|
||||
Object fieldValue,
|
||||
IService<T> service,
|
||||
List<SFunction<T, ?>> targetFields
|
||||
) {
|
||||
// 构建 LambdaQueryWrapper,并设置等值查询条件
|
||||
LambdaQueryWrapper<T> query = new LambdaQueryWrapper<>();
|
||||
query.eq(field, fieldValue); // 设置查询条件:等于指定字段和值
|
||||
|
||||
// 动态选择需要返回的字段
|
||||
query.select(targetFields.toArray(new SFunction[0])); // 只返回指定的字段
|
||||
|
||||
// 执行查询并返回结果
|
||||
return service.list(query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据多个字段和对应的值进行查询,同时只返回指定的字段。
|
||||
* 该方法可以动态构建查询条件并执行查询。
|
||||
*
|
||||
* @param <T> 实体类类型
|
||||
* @param fieldConditions 查询条件的字段引用和值,使用 Map 存储
|
||||
* (key:R::getXxx,value:对应的查询值)
|
||||
* @param service 执行查询操作的服务对象(MyBatis-Plus 的 IService)
|
||||
* @param targetFields 需要返回的目标字段列表
|
||||
* @return 返回查询结果的列表,只包含指定的字段
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> findByFieldEqTargetFieldsWithSpecificColumns(
|
||||
Map<SFunction<T, ?>, Object> fieldConditions,
|
||||
IService<T> service,
|
||||
List<SFunction<T, ?>> targetFields
|
||||
) {
|
||||
// 构建 LambdaQueryWrapper,添加查询条件
|
||||
LambdaQueryWrapper<T> query = new LambdaQueryWrapper<>();
|
||||
|
||||
// 动态添加 EQ 条件
|
||||
fieldConditions.forEach(query::eq);
|
||||
|
||||
// 选择只返回指定的字段
|
||||
query.select(targetFields.toArray(new SFunction[0])); // 将 targetFields 转换为数组,传入 select 方法
|
||||
|
||||
// 执行查询并返回结果
|
||||
return service.list(query);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,4 +17,10 @@ public interface CourseOrderService extends IService<CourseOrder> {
|
||||
* 获取查询条件
|
||||
*/
|
||||
QueryWrapper<CourseOrder> getQueryWrapper(CourseOrderQueryRequest courseOrderQueryRequest);
|
||||
|
||||
|
||||
/**
|
||||
* 向消息队列中发送订单创建的消息
|
||||
*/
|
||||
void sendCreateOrderMessage(Long orderId);
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.greenorange.promotion.service.course;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【course_promotion_commission_pending(课程推广待提成记录)】的数据库操作Service
|
||||
* @createDate 2025-07-01 09:22:57
|
||||
*/
|
||||
public interface CoursePromotionCommissionPendingService extends IService<CoursePromotionCommissionPending> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
QueryWrapper<CoursePromotionCommissionPending> getQueryWrapper(CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest);
|
||||
}
|
@ -3,14 +3,21 @@ package com.greenorange.promotion.service.course.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.greenorange.promotion.constant.CommonConstant;
|
||||
import com.greenorange.promotion.constant.MqConstant;
|
||||
import com.greenorange.promotion.model.dto.courseOrder.CourseOrderQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.CourseOrder;
|
||||
import com.greenorange.promotion.service.course.CourseOrderService;
|
||||
import com.greenorange.promotion.mapper.CourseOrderMapper;
|
||||
import com.greenorange.promotion.utils.MultiDelayMessage;
|
||||
import com.greenorange.promotion.utils.SqlUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【course_order(课程订单表)】的数据库操作Service实现
|
||||
@ -21,6 +28,10 @@ public class CourseOrderServiceImpl extends ServiceImpl<CourseOrderMapper, Cours
|
||||
implements CourseOrderService{
|
||||
|
||||
|
||||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
@ -36,6 +47,25 @@ public class CourseOrderServiceImpl extends ServiceImpl<CourseOrderMapper, Cours
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向消息队列中发送订单创建的消息
|
||||
*/
|
||||
@Override
|
||||
public void sendCreateOrderMessage(Long orderId) {
|
||||
// 复制 DELAY_MILLIS 到一个新的 ArrayList
|
||||
List<Long> newDelayMillis = new ArrayList<>(MqConstant.DELAY_MILLIS);
|
||||
// 延迟检查订单状态信息
|
||||
MultiDelayMessage<Long> msg = new MultiDelayMessage<>(orderId, newDelayMillis);
|
||||
long delayValue = msg.removeNextDelay();
|
||||
rabbitTemplate.convertAndSend(MqConstant.DELAY_EXCHANGE,
|
||||
MqConstant.DELAY_ORDER_ROUTING_KEY, msg, message -> {
|
||||
// 添加延迟消息属性
|
||||
message.getMessageProperties().setDelayLong(delayValue);
|
||||
return message;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.greenorange.promotion.service.course.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.greenorange.promotion.model.dto.coursePromotionCommissionPending.CoursePromotionCommissionPendingQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.CoursePromotionCommissionPending;
|
||||
import com.greenorange.promotion.service.course.CoursePromotionCommissionPendingService;
|
||||
import com.greenorange.promotion.mapper.CoursePromotionCommissionPendingMapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【course_promotion_commission_pending(课程推广待提成记录)】的数据库操作Service实现
|
||||
* @createDate 2025-07-01 09:22:57
|
||||
*/
|
||||
@Service
|
||||
public class CoursePromotionCommissionPendingServiceImpl extends ServiceImpl<CoursePromotionCommissionPendingMapper, CoursePromotionCommissionPending>
|
||||
implements CoursePromotionCommissionPendingService{
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<CoursePromotionCommissionPending> getQueryWrapper(CoursePromotionCommissionPendingQueryRequest coursePromotionCommissionPendingQueryRequest) {
|
||||
String name = coursePromotionCommissionPendingQueryRequest.getName();
|
||||
String type = coursePromotionCommissionPendingQueryRequest.getType();
|
||||
String commissionStatus = coursePromotionCommissionPendingQueryRequest.getCommissionStatus();
|
||||
QueryWrapper<CoursePromotionCommissionPending> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(name), "name", name);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(type), "type", type);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(commissionStatus), "commissionStatus", commissionStatus);
|
||||
return queryWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo>
|
||||
String fileSuffix = FileUtil.getSuffix(multipartFile.getOriginalFilename());
|
||||
final long LIMIT = 20 * 1024 * 1024L;
|
||||
ThrowUtils.throwIf(fileSize > LIMIT, ErrorCode.PARAMS_ERROR, "文件大小不能超过20MB");
|
||||
ThrowUtils.throwIf(!Arrays.asList("jpeg", "jpg", "svg", "png", "webp", "JPG").contains(fileSuffix),ErrorCode.PARAMS_ERROR, "文件类型错误");
|
||||
ThrowUtils.throwIf(!Arrays.asList("jpeg", "jpg", "svg", "png", "webp", "JPG", "pdf", "PDF").contains(fileSuffix),ErrorCode.PARAMS_ERROR, "文件类型错误");
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.greenorange.promotion.service.refund;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.model.dto.refundRecord.RefundRecordQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.RefundRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【refund_record(退款记录表)】的数据库操作Service
|
||||
* @createDate 2025-07-01 08:18:44
|
||||
*/
|
||||
public interface RefundRecordService extends IService<RefundRecord> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
QueryWrapper<RefundRecord> getQueryWrapper(RefundRecordQueryRequest refundRecordQueryRequest);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.greenorange.promotion.service.refund.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.greenorange.promotion.constant.CommonConstant;
|
||||
import com.greenorange.promotion.model.dto.refundRecord.RefundRecordQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.RefundRecord;
|
||||
import com.greenorange.promotion.service.refund.RefundRecordService;
|
||||
import com.greenorange.promotion.mapper.RefundRecordMapper;
|
||||
import com.greenorange.promotion.utils.SqlUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author 35880
|
||||
* @description 针对表【refund_record(退款记录表)】的数据库操作Service实现
|
||||
* @createDate 2025-07-01 08:18:44
|
||||
*/
|
||||
@Service
|
||||
public class RefundRecordServiceImpl extends ServiceImpl<RefundRecordMapper, RefundRecord>
|
||||
implements RefundRecordService{
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*/
|
||||
@Override
|
||||
public QueryWrapper<RefundRecord> getQueryWrapper(RefundRecordQueryRequest refundRecordQueryRequest) {
|
||||
String outRefundNo = refundRecordQueryRequest.getOutRefundNo();
|
||||
String sortField = refundRecordQueryRequest.getSortField();
|
||||
String sortOrder = refundRecordQueryRequest.getSortOrder();
|
||||
QueryWrapper<RefundRecord> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(outRefundNo), "outRefundNo", outRefundNo);
|
||||
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_DESC), sortField);
|
||||
return queryWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user