|
@@ -27,6 +27,7 @@ import com.fs.hisStore.vo.FsStoreOrderTuiVO;
|
|
|
import com.fs.hisStore.vo.FsStoreProductRelationQueryVO;
|
|
|
import com.fs.hisStore.vo.FsUserExtractVO;
|
|
|
import com.fs.hisStore.vo.FsUserTuiVO;
|
|
|
+import com.fs.utils.FileCacheService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -78,6 +79,8 @@ public class UserScrmController extends AppBaseController {
|
|
|
private IFsUserCourseVideoService courseVideoService;
|
|
|
@Autowired
|
|
|
private IFsUserScrmService fsUserService;
|
|
|
+ @Autowired
|
|
|
+ private FileCacheService fileCacheService;
|
|
|
|
|
|
/**
|
|
|
* 获取用户信息
|
|
@@ -121,10 +124,6 @@ public class UserScrmController extends AppBaseController {
|
|
|
return R.ok("认证成功");
|
|
|
}
|
|
|
|
|
|
- @Value("${getTuiImg}")
|
|
|
- private String getTuiImg;
|
|
|
- @Value("${getTuiFont}")
|
|
|
- private String getTuiFont;
|
|
|
@Login
|
|
|
@ApiOperation("获取推荐海报")
|
|
|
@GetMapping("/getTuiImg")
|
|
@@ -160,18 +159,7 @@ public class UserScrmController extends AppBaseController {
|
|
|
user.setUserCode(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()) {
|
|
@@ -183,7 +171,7 @@ public class UserScrmController extends AppBaseController {
|
|
|
|
|
|
try {
|
|
|
log.info("开始加载海报模板图片");
|
|
|
- templateStream = new FileInputStream(templateSourceFile);
|
|
|
+ templateStream = fileCacheService.getTemplateStream();
|
|
|
FileUtils.copyInputStreamToFile(templateStream, tempTemplateFile);
|
|
|
log.info("海报模板图片加载成功: {}", tempTemplateFile.getAbsolutePath());
|
|
|
if (!isValidImageFile(tempTemplateFile)) {
|
|
@@ -191,7 +179,7 @@ public class UserScrmController extends AppBaseController {
|
|
|
return R.error("模板图片文件无效");
|
|
|
}
|
|
|
log.info("开始加载字体文件");
|
|
|
- fontStream = new FileInputStream(fontSourceFile);
|
|
|
+ fontStream = fileCacheService.getFontStream();
|
|
|
FileUtils.copyInputStreamToFile(fontStream, tempFontFile);
|
|
|
log.info("字体文件加载成功: {}", tempFontFile.getAbsolutePath());
|
|
|
|