完善用户邀请码生成接口(用户注册)
This commit is contained in:
parent
2ba63d32e1
commit
0632b32c08
|
@ -21,6 +21,7 @@ import java.math.BigDecimal;
|
||||||
"withdrawalAmount",
|
"withdrawalAmount",
|
||||||
"withdrawnAmount",
|
"withdrawnAmount",
|
||||||
"totalIncome",
|
"totalIncome",
|
||||||
|
"uniteRate",
|
||||||
"userId",
|
"userId",
|
||||||
"inviteQrCode",
|
"inviteQrCode",
|
||||||
})
|
})
|
||||||
|
@ -68,6 +69,12 @@ public class UserMainInfoAddRequest implements Serializable {
|
||||||
@Schema(description = "累计收入", example = "70.00")
|
@Schema(description = "累计收入", example = "70.00")
|
||||||
private BigDecimal totalIncome;
|
private BigDecimal totalIncome;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一抽佣比例
|
||||||
|
*/
|
||||||
|
@Schema(description = "统一抽佣比例", example = "5")
|
||||||
|
private BigDecimal uniteRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -67,6 +67,12 @@ public class UserMainInfoQueryRequest extends PageRequest implements Serializabl
|
||||||
@Schema(description = "累计收入", example = "70.00")
|
@Schema(description = "累计收入", example = "70.00")
|
||||||
private BigDecimal totalIncome;
|
private BigDecimal totalIncome;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一抽佣比例
|
||||||
|
*/
|
||||||
|
@Schema(description = "统一抽佣比例", example = "5")
|
||||||
|
private BigDecimal uniteRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.math.BigDecimal;
|
||||||
"withdrawalAmount",
|
"withdrawalAmount",
|
||||||
"withdrawnAmount",
|
"withdrawnAmount",
|
||||||
"totalIncome",
|
"totalIncome",
|
||||||
|
"uniteRate",
|
||||||
"userId",
|
"userId",
|
||||||
"inviteQrCode",
|
"inviteQrCode",
|
||||||
})
|
})
|
||||||
|
@ -76,6 +77,12 @@ public class UserMainInfoUpdateRequest implements Serializable {
|
||||||
@Schema(description = "累计收入", example = "70.00")
|
@Schema(description = "累计收入", example = "70.00")
|
||||||
private BigDecimal totalIncome;
|
private BigDecimal totalIncome;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一抽佣比例
|
||||||
|
*/
|
||||||
|
@Schema(description = "统一抽佣比例", example = "5")
|
||||||
|
private BigDecimal uniteRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -52,6 +52,11 @@ public class UserMainInfo implements Serializable {
|
||||||
*/
|
*/
|
||||||
private BigDecimal totalIncome;
|
private BigDecimal totalIncome;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一抽佣比例
|
||||||
|
*/
|
||||||
|
private BigDecimal uniteRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -62,6 +62,12 @@ public class UserMainInfoVO implements Serializable {
|
||||||
@Schema(description = "累计收入", example = "100.00")
|
@Schema(description = "累计收入", example = "100.00")
|
||||||
private BigDecimal totalIncome;
|
private BigDecimal totalIncome;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一抽佣比例
|
||||||
|
*/
|
||||||
|
@Schema(description = "统一抽佣比例", example = "5")
|
||||||
|
private BigDecimal uniteRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,6 +18,7 @@ import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.commons.lang.RandomStringUtils;
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@ -38,8 +39,9 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 上传文件的服务器存储目录
|
// 文件上传的存储目录
|
||||||
private static final String UPLOAD_DIR = "/www/wwwroot/fileUpload_qc/";
|
@Value("${file.upload-dir}")
|
||||||
|
private String uploadDir;
|
||||||
|
|
||||||
|
|
||||||
// 优化:设置一个合理的缓冲区大小
|
// 优化:设置一个合理的缓冲区大小
|
||||||
|
@ -101,7 +103,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo>
|
||||||
.build();
|
.build();
|
||||||
this.save(fileInfo);
|
this.save(fileInfo);
|
||||||
// 创建上传目录,如果不存在
|
// 创建上传目录,如果不存在
|
||||||
File file = new File(UPLOAD_DIR + fileName);
|
File file = new File(uploadDir + fileName);
|
||||||
if (!file.getParentFile().exists()) {
|
if (!file.getParentFile().exists()) {
|
||||||
file.getParentFile().mkdirs();// 如果路径不存在则创建
|
file.getParentFile().mkdirs();// 如果路径不存在则创建
|
||||||
}
|
}
|
||||||
|
@ -132,7 +134,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo>
|
||||||
FileInfo fileInfo = this.getOne(lambdaQueryWrapper);
|
FileInfo fileInfo = this.getOne(lambdaQueryWrapper);
|
||||||
ThrowUtils.throwIf(fileInfo == null, ErrorCode.NOT_FOUND_ERROR, "文件不存在");
|
ThrowUtils.throwIf(fileInfo == null, ErrorCode.NOT_FOUND_ERROR, "文件不存在");
|
||||||
|
|
||||||
File file = new File(UPLOAD_DIR + fileInfo.getName());
|
File file = new File(uploadDir + fileInfo.getName());
|
||||||
// // 设置response的Header
|
// // 设置response的Header
|
||||||
response.setContentType("application/octet-stream");
|
response.setContentType("application/octet-stream");
|
||||||
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileInfo.getName(), StandardCharsets.UTF_8));
|
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileInfo.getName(), StandardCharsets.UTF_8));
|
||||||
|
|
|
@ -34,6 +34,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -129,6 +130,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
||||||
* 小程序用户注册
|
* 小程序用户注册
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void userInfoMiniRegister(UserInfoRegisterRequest userInfoRegisterRequest) {
|
public void userInfoMiniRegister(UserInfoRegisterRequest userInfoRegisterRequest) {
|
||||||
String phoneNumber = userInfoRegisterRequest.getPhoneNumber();
|
String phoneNumber = userInfoRegisterRequest.getPhoneNumber();
|
||||||
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
ThrowUtils.throwIf(RegexUtils.isPhoneInvalid(phoneNumber), ErrorCode.PARAMS_ERROR, "手机号格式无效");
|
||||||
|
|
|
@ -19,9 +19,11 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.commons.lang.RandomStringUtils;
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
@ -36,8 +38,9 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 上传文件的服务器存储目录
|
// 文件上传的存储目录
|
||||||
private static final String UPLOAD_DIR = "D:/qingcheng/image/";
|
@Value("${file.upload-dir}")
|
||||||
|
private String uploadDir;
|
||||||
|
|
||||||
|
|
||||||
private final static String ACCESS_TOKEN_KEY = "accessToken";
|
private final static String ACCESS_TOKEN_KEY = "accessToken";
|
||||||
|
@ -99,6 +102,7 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||||
* 获取微信小程序二维码
|
* 获取微信小程序二维码
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String getWxQrCode(String inviteCode) throws IOException {
|
public String getWxQrCode(String inviteCode) throws IOException {
|
||||||
String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
String accessToken = (String) redisTemplate.opsForValue().get(ACCESS_TOKEN_KEY);
|
||||||
if (accessToken == null) {
|
if (accessToken == null) {
|
||||||
|
@ -107,7 +111,7 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put("page", "pages/loginModule/register/register");
|
param.put("page", "pages/loginModule/register/register");
|
||||||
param.put("scene", "invitationCode=" + inviteCode);
|
param.put("scene", "invitationCode=" + inviteCode);
|
||||||
param.put("width", 430); // 宽度
|
param.put("width", 430);
|
||||||
param.put("check_path", false);
|
param.put("check_path", false);
|
||||||
param.put("env_version", "develop");
|
param.put("env_version", "develop");
|
||||||
String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
|
String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken;
|
||||||
|
@ -140,12 +144,12 @@ public class WechatGetQrcodeServiceImpl implements WechatGetQrcodeService {
|
||||||
byte[] resultBytes = resultStream.readAllBytes();
|
byte[] resultBytes = resultStream.readAllBytes();
|
||||||
// 创建上传目录,如果不存在
|
// 创建上传目录,如果不存在
|
||||||
String biz = "default";
|
String biz = "default";
|
||||||
String fileName = "qrcode.png";
|
String fileName = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "." + "png";
|
||||||
// 获取文件类型
|
// 获取文件类型
|
||||||
String fileType = FileUtil.getSuffix(fileName);
|
String fileType = FileUtil.getSuffix(fileName);
|
||||||
// 获取view值
|
// 获取view值
|
||||||
String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
String view = RandomStringUtils.random(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
||||||
File file = new File(UPLOAD_DIR + fileName);
|
File file = new File(uploadDir + fileName);
|
||||||
if (!file.getParentFile().exists()) {
|
if (!file.getParentFile().exists()) {
|
||||||
file.getParentFile().mkdirs();// 如果路径不存在则创建
|
file.getParentFile().mkdirs();// 如果路径不存在则创建
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,12 @@ spring:
|
||||||
max-request-size: 20MB
|
max-request-size: 20MB
|
||||||
|
|
||||||
|
|
||||||
|
#文件上传和下载地址
|
||||||
|
file:
|
||||||
|
# upload-dir: /www/wwwroot/fileUpload_qc/
|
||||||
|
upload-dir: D:/qingcheng/image/
|
||||||
|
|
||||||
|
|
||||||
jackson:
|
jackson:
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
|
|
|
@ -24,6 +24,12 @@ spring:
|
||||||
max-request-size: 20MB
|
max-request-size: 20MB
|
||||||
|
|
||||||
|
|
||||||
|
#文件上传和下载地址
|
||||||
|
file:
|
||||||
|
# upload-dir: /www/wwwroot/fileUpload_qc/
|
||||||
|
upload-dir: D:/qingcheng/image/
|
||||||
|
|
||||||
|
|
||||||
jackson:
|
jackson:
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
|
|
|
@ -23,6 +23,11 @@ spring:
|
||||||
max-file-size: 20MB
|
max-file-size: 20MB
|
||||||
max-request-size: 20MB
|
max-request-size: 20MB
|
||||||
|
|
||||||
|
#文件上传和下载地址
|
||||||
|
file:
|
||||||
|
# upload-dir: /www/wwwroot/fileUpload_qc/
|
||||||
|
upload-dir: D:/qingcheng/image/
|
||||||
|
|
||||||
|
|
||||||
jackson:
|
jackson:
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
|
|
@ -24,6 +24,12 @@ spring:
|
||||||
max-request-size: 20MB
|
max-request-size: 20MB
|
||||||
|
|
||||||
|
|
||||||
|
# 文件上传和下载地址
|
||||||
|
file:
|
||||||
|
# upload-dir: /www/wwwroot/fileUpload_qc/
|
||||||
|
upload-dir: D:/qingcheng/image/
|
||||||
|
|
||||||
|
|
||||||
jackson:
|
jackson:
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
|
|
Loading…
Reference in New Issue
Block a user