|
@@ -3,7 +3,9 @@ package com.fs.app.controller.store;
|
|
|
|
|
|
import cn.hutool.core.img.ImgUtil;
|
|
import cn.hutool.core.img.ImgUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
+import cn.hutool.core.io.resource.ResourceUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
|
+import cn.hutool.extra.servlet.ServletUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.fs.app.annotation.Login;
|
|
import com.fs.app.annotation.Login;
|
|
import com.fs.app.controller.AppBaseController;
|
|
import com.fs.app.controller.AppBaseController;
|
|
@@ -33,16 +35,21 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import javax.imageio.ImageIO;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.awt.*;
|
|
import java.awt.*;
|
|
|
|
+import java.awt.image.BufferedImage;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.net.URL;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@@ -80,6 +87,8 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("获取用户信息")
|
|
@ApiOperation("获取用户信息")
|
|
@GetMapping("/getUserInfo")
|
|
@GetMapping("/getUserInfo")
|
|
public R getUserInfo(HttpServletRequest request){
|
|
public R getUserInfo(HttpServletRequest request){
|
|
|
|
+
|
|
|
|
+ log.info("获取用户信息 headers: {}", ServletUtil.getHeaderMap(request));
|
|
try {
|
|
try {
|
|
FsUserScrm user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
FsUserScrm user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
if (user.getIsShow() !=null && user.getIsShow() == 0){
|
|
if (user.getIsShow() !=null && user.getIsShow() == 0){
|
|
@@ -108,20 +117,40 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("检测是否登录")
|
|
@ApiOperation("检测是否登录")
|
|
@GetMapping("/checkLogin")
|
|
@GetMapping("/checkLogin")
|
|
public R checkLogin(HttpServletRequest request){
|
|
public R checkLogin(HttpServletRequest request){
|
|
|
|
+ log.info("检测是否登录 headers: {}", ServletUtil.getHeaderMap(request));
|
|
return R.ok("认证成功");
|
|
return R.ok("认证成功");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Value("${getTuiImg}")
|
|
|
|
+ private String getTuiImg;
|
|
|
|
+ @Value("${getTuiFont}")
|
|
|
|
+ private String getTuiFont;
|
|
@Login
|
|
@Login
|
|
@ApiOperation("获取推荐海报")
|
|
@ApiOperation("获取推荐海报")
|
|
@GetMapping("/getTuiImg")
|
|
@GetMapping("/getTuiImg")
|
|
public R getTuiImg(HttpServletRequest request){
|
|
public R getTuiImg(HttpServletRequest request){
|
|
|
|
+ log.info("获取推荐海报 headers: {}", ServletUtil.getHeaderMap(request));
|
|
log.info("开始获取推荐海报");
|
|
log.info("开始获取推荐海报");
|
|
|
|
+
|
|
|
|
+ InputStream templateStream = null;
|
|
|
|
+ InputStream fontStream = null;
|
|
|
|
+
|
|
try {
|
|
try {
|
|
String userId = getUserId();
|
|
String userId = getUserId();
|
|
log.info("获取用户ID: {}", userId);
|
|
log.info("获取用户ID: {}", userId);
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isEmpty(userId)) {
|
|
|
|
+ log.error("用户ID为空");
|
|
|
|
+ return R.error("用户ID不能为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
FsUserScrm user = userService.selectFsUserById(Long.parseLong(userId));
|
|
FsUserScrm user = userService.selectFsUserById(Long.parseLong(userId));
|
|
- log.info("查询到用户信息: 用户ID={}, 昵称={}", userId, user.getNickname());
|
|
|
|
|
|
+ if (user == null) {
|
|
|
|
+ log.error("未找到用户信息,用户ID: {}", userId);
|
|
|
|
+ return R.error("用户信息不存在");
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ log.info("查询到用户信息: 用户ID={}, 昵称={}", userId, user.getNickname());
|
|
if(StringUtils.isEmpty(user.getUserCode())){
|
|
if(StringUtils.isEmpty(user.getUserCode())){
|
|
log.info("用户邀请码为空,开始生成新的邀请码");
|
|
log.info("用户邀请码为空,开始生成新的邀请码");
|
|
FsUserScrm userMap = new FsUserScrm();
|
|
FsUserScrm userMap = new FsUserScrm();
|
|
@@ -131,104 +160,223 @@ public class UserScrmController extends AppBaseController {
|
|
user.setUserCode(userMap.getUserCode());
|
|
user.setUserCode(userMap.getUserCode());
|
|
log.info("成功生成并更新用户邀请码: {}", userMap.getUserCode());
|
|
log.info("成功生成并更新用户邀请码: {}", userMap.getUserCode());
|
|
}
|
|
}
|
|
|
|
+ File templateSourceFile = new File(getTuiImg);
|
|
|
|
+ File fontSourceFile = new File(getTuiFont);
|
|
|
|
+
|
|
|
|
+ if (!templateSourceFile.exists() || !templateSourceFile.isFile()) {
|
|
|
|
+ log.error("海报模板文件不存在: {}", getTuiImg);
|
|
|
|
+ return R.error("海报模板文件不存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!fontSourceFile.exists() || !fontSourceFile.isFile()) {
|
|
|
|
+ log.error("字体文件不存在: {}", getTuiFont);
|
|
|
|
+ return R.error("字体文件不存在");
|
|
|
|
+ }
|
|
|
|
+ String tempDir = System.getProperty("java.io.tmpdir") + File.separator + "poster_temp";
|
|
|
|
+ File tempDirFile = new File(tempDir);
|
|
|
|
+ if (!tempDirFile.exists()) {
|
|
|
|
+ tempDirFile.mkdirs();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ File tempTemplateFile = new File(tempDir, "template_" + userId + "_" + System.currentTimeMillis() + ".jpg");
|
|
|
|
+ File tempFontFile = new File(tempDir, "font_" + userId + "_" + System.currentTimeMillis() + ".ttf");
|
|
|
|
|
|
- File newFile = new File("fx.jpg");
|
|
|
|
- File newFileT = new File("simsunb.ttf");
|
|
|
|
try {
|
|
try {
|
|
log.info("开始加载海报模板图片");
|
|
log.info("开始加载海报模板图片");
|
|
- InputStream stream = getClass().getClassLoader().getResourceAsStream("fx.jpg");
|
|
|
|
- FileUtils.copyInputStreamToFile(stream, newFile);
|
|
|
|
- log.info("海报模板图片加载成功: {}", newFile.getAbsolutePath());
|
|
|
|
-
|
|
|
|
- if(!newFileT.exists()){
|
|
|
|
- log.info("开始加载字体文件");
|
|
|
|
- InputStream streamT = getClass().getClassLoader().getResourceAsStream("simsunb.ttf");
|
|
|
|
- FileUtils.copyInputStreamToFile(streamT, newFileT);
|
|
|
|
- log.info("字体文件加载成功: {}", newFileT.getAbsolutePath());
|
|
|
|
|
|
+ templateStream = new FileInputStream(templateSourceFile);
|
|
|
|
+ FileUtils.copyInputStreamToFile(templateStream, tempTemplateFile);
|
|
|
|
+ log.info("海报模板图片加载成功: {}", tempTemplateFile.getAbsolutePath());
|
|
|
|
+ if (!isValidImageFile(tempTemplateFile)) {
|
|
|
|
+ log.error("模板图片文件无效或损坏");
|
|
|
|
+ return R.error("模板图片文件无效");
|
|
}
|
|
}
|
|
|
|
+ log.info("开始加载字体文件");
|
|
|
|
+ fontStream = new FileInputStream(fontSourceFile);
|
|
|
|
+ FileUtils.copyInputStreamToFile(fontStream, tempFontFile);
|
|
|
|
+ log.info("字体文件加载成功: {}", tempFontFile.getAbsolutePath());
|
|
|
|
+
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
log.error("加载资源文件失败: {}", e.getMessage(), e);
|
|
log.error("加载资源文件失败: {}", e.getMessage(), e);
|
|
- throw new CustomException(e.getMessage());
|
|
|
|
|
|
+ return R.error("加载资源文件失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
+ return generatePoster(user, tempTemplateFile, tempFontFile, userId);
|
|
|
|
+
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ log.error("用户ID格式错误: {}", e.getMessage(), e);
|
|
|
|
+ return R.error("用户ID格式错误");
|
|
|
|
+ } catch (Exception e){
|
|
|
|
+ log.error("获取推荐海报失败: {}", e.getMessage(), e);
|
|
|
|
+ return R.error("操作异常: " + e.getMessage());
|
|
|
|
+ } finally {
|
|
|
|
+ closeQuietly(templateStream);
|
|
|
|
+ closeQuietly(fontStream);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成海报的核心方法
|
|
|
|
+ */
|
|
|
|
+ private R generatePoster(FsUserScrm user, File templateFile, File fontFile, String userId) {
|
|
|
|
+ File outputFile = null;
|
|
|
|
+ File qrFile = null;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ String outputDir = fsConfig.getTuiImgPath();
|
|
|
|
+ File outputDirFile = new File(outputDir);
|
|
|
|
+ if (!outputDirFile.exists()) {
|
|
|
|
+ outputDirFile.mkdirs();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String outputPath = outputDir + "/tui-" + userId + ".jpg";
|
|
|
|
+ outputFile = new File(outputPath);
|
|
|
|
+ log.info("开始生成用户海报,输出路径: {}", outputPath);
|
|
|
|
+ Font font;
|
|
try {
|
|
try {
|
|
- String url = fsConfig.getTuiImgPath()+"/tui-"+getUserId()+".jpg";
|
|
|
|
- log.info("开始生成用户海报,输出路径: {}", url);
|
|
|
|
-
|
|
|
|
- File outputFile = new File(url);
|
|
|
|
- if(!outputFile.exists()) {
|
|
|
|
- try {
|
|
|
|
- outputFile.createNewFile();
|
|
|
|
- log.info("创建海报输出文件成功");
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- log.error("创建海报输出文件失败: {}", e.getMessage(), e);
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ font = Font.createFont(Font.TRUETYPE_FONT, fontFile);
|
|
|
|
+ font = font.deriveFont(Font.PLAIN, 50f);
|
|
|
|
+ log.info("字体加载成功");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("字体加载失败: {}", e.getMessage(), e);
|
|
|
|
+ font = new Font(Font.SANS_SERIF, Font.PLAIN, 50);
|
|
|
|
+ log.info("使用系统默认字体作为备选");
|
|
|
|
+ }
|
|
|
|
+ String nickname = user.getNickname();
|
|
|
|
+ if (StringUtils.isEmpty(nickname)) {
|
|
|
|
+ nickname = "用户";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ log.info("开始向海报添加用户昵称文本: {}", nickname);
|
|
|
|
+ try {
|
|
|
|
+ FileUtils.copyFile(templateFile, outputFile);
|
|
|
|
+
|
|
|
|
+ BufferedImage templateImage = ImageIO.read(templateFile);
|
|
|
|
+ if (templateImage == null) {
|
|
|
|
+ log.error("无法读取模板图片");
|
|
|
|
+ return R.error("模板图片读取失败");
|
|
}
|
|
}
|
|
|
|
|
|
- Font font = Font.createFont(Font.TRUETYPE_FONT, newFileT);
|
|
|
|
- Font f = font.deriveFont(Font.PLAIN,50);
|
|
|
|
- log.info("开始向海报添加用户昵称文本");
|
|
|
|
- ImgUtil.pressText(
|
|
|
|
- newFile,
|
|
|
|
- outputFile,
|
|
|
|
- user.getNickname()+"邀您加入",
|
|
|
|
- Color.BLACK,
|
|
|
|
- f,
|
|
|
|
- -60,
|
|
|
|
- 900,
|
|
|
|
- 0.8f
|
|
|
|
|
|
+ BufferedImage resultImage = new BufferedImage(
|
|
|
|
+ templateImage.getWidth(),
|
|
|
|
+ templateImage.getHeight(),
|
|
|
|
+ BufferedImage.TYPE_INT_RGB
|
|
);
|
|
);
|
|
|
|
|
|
- log.info("开始向海报添加邀请码文本: {}", user.getUserCode());
|
|
|
|
- ImgUtil.pressText(
|
|
|
|
- outputFile,
|
|
|
|
- outputFile,
|
|
|
|
- "邀请码:"+user.getUserCode(),
|
|
|
|
- Color.BLACK,
|
|
|
|
- f,
|
|
|
|
- -40,
|
|
|
|
- 1000,
|
|
|
|
- 0.8f
|
|
|
|
- );
|
|
|
|
|
|
+ Graphics2D g2d = resultImage.createGraphics();
|
|
|
|
+ try {
|
|
|
|
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
|
|
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
|
|
|
+
|
|
|
|
+ g2d.drawImage(templateImage, 0, 0, null);
|
|
|
|
+
|
|
|
|
+ g2d.setFont(font);
|
|
|
|
+ g2d.setColor(Color.BLACK);
|
|
|
|
+
|
|
|
|
+ String nicknameText = nickname + "邀您加入";
|
|
|
|
+ FontMetrics fm = g2d.getFontMetrics();
|
|
|
|
+ int textWidth = fm.stringWidth(nicknameText);
|
|
|
|
+ int x = (templateImage.getWidth() - textWidth) / 2;
|
|
|
|
+ int y = 900;
|
|
|
|
+
|
|
|
|
+ g2d.drawString(nicknameText, x, y);
|
|
|
|
+
|
|
|
|
+ String inviteText = "邀请码:" + user.getUserCode();
|
|
|
|
+ int inviteTextWidth = fm.stringWidth(inviteText);
|
|
|
|
+ int inviteX = (templateImage.getWidth() - inviteTextWidth) / 2;
|
|
|
|
+ int inviteY = 1000;
|
|
|
|
|
|
- String qrPath = fsConfig.getTuiImgPath()+"/qr-"+getUserId()+".png";
|
|
|
|
- File qr = new File(qrPath);
|
|
|
|
- log.info("开始生成二维码图片: {}", qrPath);
|
|
|
|
- if(!qr.exists()) {
|
|
|
|
- try {
|
|
|
|
- qr.createNewFile();
|
|
|
|
- log.info("创建二维码输出文件成功");
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- log.error("创建二维码输出文件失败: {}", e.getMessage(), e);
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ g2d.drawString(inviteText, inviteX, inviteY);
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ g2d.dispose();
|
|
}
|
|
}
|
|
|
|
|
|
- String qrContent = fsConfig.getUrl()+"/distribution?userCode="+user.getUserCode();
|
|
|
|
- log.info("生成二维码内容: {}", qrContent);
|
|
|
|
- QrCodeUtil.generate(qrContent, 300, 300, FileUtil.file(qrPath));
|
|
|
|
|
|
+ ImageIO.write(resultImage, "jpg", outputFile);
|
|
|
|
+ log.info("文本添加完成");
|
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("添加文本时出现异常: {}", e.getMessage(), e);
|
|
|
|
+ return R.error("添加文本失败: " + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ String qrPath = fsConfig.getTuiImgPath() + "/qr-" + userId + ".png";
|
|
|
|
+ qrFile = new File(qrPath);
|
|
|
|
+ log.info("开始生成二维码图片: {}", qrPath);
|
|
|
|
+ try {
|
|
|
|
+ String qrContent = fsConfig.getUrl() + "/distribution?userCode=" + user.getUserCode();
|
|
|
|
+ log.info("生成二维码内容: {}", qrContent);
|
|
|
|
+ QrCodeUtil.generate(qrContent, 300, 300, qrFile);
|
|
|
|
+ log.info("二维码生成成功");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("生成二维码失败: {}", e.getMessage(), e);
|
|
|
|
+ return R.error("生成二维码失败: " + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
log.info("开始将二维码图片合并到海报");
|
|
log.info("开始将二维码图片合并到海报");
|
|
- ImgUtil.pressImage(
|
|
|
|
- outputFile,
|
|
|
|
- outputFile,
|
|
|
|
- ImgUtil.read(qr),
|
|
|
|
- -400,
|
|
|
|
- 900,
|
|
|
|
- 1f
|
|
|
|
- );
|
|
|
|
|
|
+ BufferedImage posterImage = ImageIO.read(outputFile);
|
|
|
|
+ BufferedImage qrImage = ImageIO.read(qrFile);
|
|
|
|
+
|
|
|
|
+ if (posterImage == null || qrImage == null) {
|
|
|
|
+ log.error("读取图片失败,无法合并二维码");
|
|
|
|
+ return R.error("图片读取失败");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Graphics2D g2d = posterImage.createGraphics();
|
|
|
|
+ try {
|
|
|
|
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
|
|
+
|
|
|
|
+ int qrX = posterImage.getWidth() - qrImage.getWidth() - 50;
|
|
|
|
+ int qrY = 900;
|
|
|
|
+
|
|
|
|
+ g2d.drawImage(qrImage, qrX, qrY, null);
|
|
|
|
+ } finally {
|
|
|
|
+ g2d.dispose();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ImageIO.write(posterImage, "jpg", outputFile);
|
|
|
|
+ log.info("二维码合并完成");
|
|
|
|
|
|
- String resultUrl = "profile/tui/tui-"+getUserId()+".jpg";
|
|
|
|
- log.info("海报生成完成,返回URL: {}", resultUrl);
|
|
|
|
- return R.ok().put("url", resultUrl);
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("生成海报过程出现异常: {}", e.getMessage(), e);
|
|
|
|
- e.printStackTrace();
|
|
|
|
- return R.error("操作异常");
|
|
|
|
|
|
+ log.error("合并二维码时出现异常: {}", e.getMessage(), e);
|
|
|
|
+ return R.error("合并二维码失败: " + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ String resultUrl = "profile/tui/tui-" + userId + ".jpg";
|
|
|
|
+ log.info("海报生成完成,返回URL: {}", resultUrl);
|
|
|
|
+ return R.ok().put("url", resultUrl);
|
|
|
|
+
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("生成海报过程出现异常: {}", e.getMessage(), e);
|
|
|
|
+ return R.error("生成海报失败: " + e.getMessage());
|
|
|
|
+ } finally {
|
|
|
|
+ cleanupTempFiles(qrFile);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private boolean isValidImageFile(File imageFile) {
|
|
|
|
+ try {
|
|
|
|
+ BufferedImage image = ImageIO.read(imageFile);
|
|
|
|
+ return image != null && image.getWidth() > 0 && image.getHeight() > 0;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("验证图片文件失败: {}", e.getMessage());
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private void closeQuietly(InputStream stream) {
|
|
|
|
+ if (stream != null) {
|
|
|
|
+ try {
|
|
|
|
+ stream.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ log.warn("关闭流时出现异常: {}", e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private void cleanupTempFiles(File... files) {
|
|
|
|
+ for (File file : files) {
|
|
|
|
+ if (file != null && file.exists()) {
|
|
|
|
+ try {
|
|
|
|
+ file.delete();
|
|
|
|
+ log.debug("删除临时文件: {}", file.getAbsolutePath());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.warn("删除临时文件失败: {}", e.getMessage());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- } catch (Exception e){
|
|
|
|
- log.error("获取推荐海报失败: {}", e.getMessage(), e);
|
|
|
|
- return R.error("操作异常");
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -236,6 +384,7 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("获取我的推荐人")
|
|
@ApiOperation("获取我的推荐人")
|
|
@GetMapping("/getMyTuiList")
|
|
@GetMapping("/getMyTuiList")
|
|
public R getMyTuiList(BaseQueryParam param, HttpServletRequest request){
|
|
public R getMyTuiList(BaseQueryParam param, HttpServletRequest request){
|
|
|
|
+ log.info("获取我的推荐人 参数: {}",param);
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
List<FsUserTuiVO> list= userService.selectFsUserTuiList(getUserId());
|
|
List<FsUserTuiVO> list= userService.selectFsUserTuiList(getUserId());
|
|
PageInfo<FsUserTuiVO> listPageInfo=new PageInfo<>(list);
|
|
PageInfo<FsUserTuiVO> listPageInfo=new PageInfo<>(list);
|
|
@@ -246,6 +395,7 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("获取用户金额")
|
|
@ApiOperation("获取用户金额")
|
|
@GetMapping("/getTuiMoney")
|
|
@GetMapping("/getTuiMoney")
|
|
public R getMemberTuiMoney(HttpServletRequest request){
|
|
public R getMemberTuiMoney(HttpServletRequest request){
|
|
|
|
+ log.info("获取我的推荐人 headers: {}",ServletUtil.getHeaderMap(request));
|
|
try {
|
|
try {
|
|
FsUserScrm user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
FsUserScrm user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
BigDecimal yesterdayMoney=userBillService.selectFsUserBillTotalByUserId(getUserId(),"brokerage_price");
|
|
BigDecimal yesterdayMoney=userBillService.selectFsUserBillTotalByUserId(getUserId(),"brokerage_price");
|
|
@@ -260,6 +410,8 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("获取我的推荐订单")
|
|
@ApiOperation("获取我的推荐订单")
|
|
@GetMapping("/getMyTuiOrderList")
|
|
@GetMapping("/getMyTuiOrderList")
|
|
public R getMyTuiOrderList(BaseQueryParam param, HttpServletRequest request){
|
|
public R getMyTuiOrderList(BaseQueryParam param, HttpServletRequest request){
|
|
|
|
+ log.info("获取我的推荐订单 参数: {}",param);
|
|
|
|
+
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
List<FsStoreOrderTuiVO> list= orderService.selectFsStoreOrderTuiListVO(getUserId());
|
|
List<FsStoreOrderTuiVO> list= orderService.selectFsStoreOrderTuiListVO(getUserId());
|
|
PageInfo<FsStoreOrderTuiVO> listPageInfo=new PageInfo<>(list);
|
|
PageInfo<FsStoreOrderTuiVO> listPageInfo=new PageInfo<>(list);
|
|
@@ -270,6 +422,8 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("获取用户佣金记录")
|
|
@ApiOperation("获取用户佣金记录")
|
|
@GetMapping("/getTuiMoneyLogs")
|
|
@GetMapping("/getTuiMoneyLogs")
|
|
public R getTuiMoneyLogs(BaseQueryParam param, HttpServletRequest request){
|
|
public R getTuiMoneyLogs(BaseQueryParam param, HttpServletRequest request){
|
|
|
|
+ log.info("获取用户佣金记录 参数: {}",param);
|
|
|
|
+
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
FsUserBillScrm map=new FsUserBillScrm();
|
|
FsUserBillScrm map=new FsUserBillScrm();
|
|
map.setUserId(Long.parseLong(getUserId()));
|
|
map.setUserId(Long.parseLong(getUserId()));
|
|
@@ -284,6 +438,8 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("获取商品足迹")
|
|
@ApiOperation("获取商品足迹")
|
|
@GetMapping("/getProductFoots")
|
|
@GetMapping("/getProductFoots")
|
|
public R getProductFoots(FsStoreProductRelationQueryParam param, HttpServletRequest request){
|
|
public R getProductFoots(FsStoreProductRelationQueryParam param, HttpServletRequest request){
|
|
|
|
+ log.info("获取商品足迹 参数: {}",param);
|
|
|
|
+
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
List<FsStoreProductRelationQueryVO> list=productRelationService.selectFsStoreProductRelationListVOQuery(param);
|
|
List<FsStoreProductRelationQueryVO> list=productRelationService.selectFsStoreProductRelationListVOQuery(param);
|
|
@@ -295,6 +451,8 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("删除足迹")
|
|
@ApiOperation("删除足迹")
|
|
@PostMapping("/delProductFoots")
|
|
@PostMapping("/delProductFoots")
|
|
public R delProductFoots(@RequestBody FsStoreProductFootDelParam param, HttpServletRequest request){
|
|
public R delProductFoots(@RequestBody FsStoreProductFootDelParam param, HttpServletRequest request){
|
|
|
|
+ log.info("删除足迹 参数: {}",param);
|
|
|
|
+
|
|
productRelationService.deleteFsStoreProductRelationById(param.getId());
|
|
productRelationService.deleteFsStoreProductRelationById(param.getId());
|
|
return R.ok("操作成功");
|
|
return R.ok("操作成功");
|
|
}
|
|
}
|
|
@@ -304,6 +462,8 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("申请提现")
|
|
@ApiOperation("申请提现")
|
|
@PostMapping("/doExtract")
|
|
@PostMapping("/doExtract")
|
|
public R doExtract(@Validated @RequestBody FsUseDoExtractParam param, HttpServletRequest request){
|
|
public R doExtract(@Validated @RequestBody FsUseDoExtractParam param, HttpServletRequest request){
|
|
|
|
+ log.info("申请提现 参数: {}",param);
|
|
|
|
+
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
return userExtractService.doExtract(param);
|
|
return userExtractService.doExtract(param);
|
|
}
|
|
}
|
|
@@ -312,6 +472,8 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("获取提现记录")
|
|
@ApiOperation("获取提现记录")
|
|
@GetMapping("/getExtractList")
|
|
@GetMapping("/getExtractList")
|
|
public R getExtractList(FsUseExtractQueryParam param, HttpServletRequest request){
|
|
public R getExtractList(FsUseExtractQueryParam param, HttpServletRequest request){
|
|
|
|
+ log.info("获取提现记录 参数: {}",param);
|
|
|
|
+
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
PageHelper.startPage(param.getPage(), param.getPageSize());
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
List<FsUserExtractVO> list=userExtractService.selectFsUserExtractListVOQuery(param);
|
|
List<FsUserExtractVO> list=userExtractService.selectFsUserExtractListVOQuery(param);
|
|
@@ -323,6 +485,8 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("修改用户信息")
|
|
@ApiOperation("修改用户信息")
|
|
@PostMapping("/editUser")
|
|
@PostMapping("/editUser")
|
|
public R editUser(@RequestBody @Valid FsUserEditParam param, HttpServletRequest request){
|
|
public R editUser(@RequestBody @Valid FsUserEditParam param, HttpServletRequest request){
|
|
|
|
+ log.info("修改用户信息 参数: {}",param);
|
|
|
|
+
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
log.info("【修改用户头像昵称】:{}",param);
|
|
log.info("【修改用户头像昵称】:{}",param);
|
|
if (param.getNickname().length()>50){
|
|
if (param.getNickname().length()>50){
|
|
@@ -365,6 +529,7 @@ public class UserScrmController extends AppBaseController {
|
|
@ApiOperation("绑定推广员")
|
|
@ApiOperation("绑定推广员")
|
|
@PostMapping("/bindPromoter")
|
|
@PostMapping("/bindPromoter")
|
|
public R bindPromoter(@RequestBody FsUserBindPromoterParam param, HttpServletRequest request){
|
|
public R bindPromoter(@RequestBody FsUserBindPromoterParam param, HttpServletRequest request){
|
|
|
|
+ log.info("绑定推广员 参数: {}",param);
|
|
|
|
|
|
FsUserScrm user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
FsUserScrm user=userService.selectFsUserById(Long.parseLong(getUserId()));
|
|
if(user.getIsPromoter()==null||user.getIsPromoter()==0){
|
|
if(user.getIsPromoter()==null||user.getIsPromoter()==0){
|