Commit c415c54f7c1a1e068e262a7cce826b841cac7385

Authored by 王明元
1 parent 55d6c618

2022年10月1日23:37:41 主题文件文件夹避开中文

fw-dalaran-server/src/main/java/cn/fw/dalaran/server/controller/common/DataExchangeController.java
... ... @@ -126,8 +126,8 @@ public class DataExchangeController {
126 126 * @throws Exception
127 127 */
128 128 @GetMapping("/calcSimilarity")
129   - public Message<BigDecimal> calcSimilarity(String theme, Long themeId, String fid, String coverUrl, String account, String itemId, Integer type) throws Exception {
130   - return success(commonBizService.validCover(theme, themeId, fid, coverUrl, account, itemId, type));
  129 + public Message<BigDecimal> calcSimilarity(/*String theme,*/ Long themeId, String fid, String coverUrl, String account, String itemId, Integer type) throws Exception {
  130 + return success(commonBizService.validCover(/*theme,*/ themeId, fid, coverUrl, account, itemId, type));
131 131 }
132 132  
133 133 /**
... ...
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/biz/CommonBizService.java
... ... @@ -214,7 +214,7 @@ public class CommonBizService {
214 214 .list();
215 215 for (ThemeFile themeFile : list) {
216 216 try {
217   - final BigDecimal coverSimilarity = this.validCover(activityTheme.getTheme(), themeFile.getThemeId(), themeFile.getFileId(), videoCover, accountNo, videoId, 1);
  217 + final BigDecimal coverSimilarity = this.validCover(/*activityTheme.getTheme(),*/ themeFile.getThemeId(), themeFile.getFileId(), videoCover, accountNo, videoId, 1);
218 218 if (validCover = coverSimilarity.compareTo(rate) >= 0)
219 219 break;
220 220 } catch (Exception e) {
... ... @@ -491,7 +491,7 @@ public class CommonBizService {
491 491 .list();
492 492 for (ThemeFile themeFile : list) {
493 493 try {
494   - final BigDecimal coverSimilarity = this.validCover(activityTheme.getTheme(), activityTheme.getId(), themeFile.getFileId(), liveCover, accountNo, roomNo, 2);
  494 + final BigDecimal coverSimilarity = this.validCover(/*activityTheme.getTheme(),*/ activityTheme.getId(), themeFile.getFileId(), liveCover, accountNo, roomNo, 2);
495 495 if (validCover = coverSimilarity.compareTo(rate) >= 0)
496 496 break;
497 497 } catch (Exception e) {
... ... @@ -968,20 +968,20 @@ public class CommonBizService {
968 968 * @return 封面图匹配度
969 969 * @throws Exception
970 970 */
971   - public BigDecimal validCover(String theme, Long themeId, String fileId, String coverUrl, String account, String itemId, Integer type) throws Exception {
  971 + public BigDecimal validCover(/*String theme,*/ Long themeId, String fileId, String coverUrl, String account, String itemId, Integer type) throws Exception {
972 972 int[][] imagePixArr1;// 图片1的像素数组
973 973 int[][] imagePixArr2;// 图片2的像素数组
974   - File imageFile1 = this.findLocalCacheImageTheme(theme, themeId, fileId);
  974 + File imageFile1 = this.findLocalCacheImageTheme(/*theme,*/ themeId, fileId);
975 975 imagePixArr1 = ImageUtils.readImagePixel(imageFile1);
976 976 File imageFile2;
977   - File localCacheImage = this.findLocalCacheImageUser(theme, themeId, account, itemId, type);
  977 + File localCacheImage = this.findLocalCacheImageUser(/*theme,*/ themeId, account, itemId, type);
978 978 if (Objects.nonNull(localCacheImage)) {
979 979 imageFile2 = localCacheImage;
980 980 } else {
981 981 imageFile2 = ImageUtils.convertFileByUrl(coverUrl, itemId);
982 982 String tempDir = common.getActivityThemeCoverDir();
983 983 File file = new File(ImageUtils.modifyResolution1(imageFile2.getPath(),
984   - tempDir + "activityTheme" + File.separator + themeId + "#" + theme + File.separator + account + File.separator + (Objects.equals(type, 1) ? "video" : "live"),
  984 + tempDir + "activityTheme" + File.separator + themeId /*+ "#" + theme*/ + File.separator + account + File.separator + (Objects.equals(type, 1) ? "video" : "live"),
985 985 "fw_theme_cover_" + itemId,
986 986 512, 512));
987 987 if (imageFile2.delete()) {
... ... @@ -989,7 +989,7 @@ public class CommonBizService {
989 989 }
990 990 }
991 991 imagePixArr2 = ImageUtils.readImagePixel(imageFile2);
992   - String msg = String.format("\n 主题: %s\n 设置封面文件id: %s\n 账户号: %s\n %s%s\n", theme, fileId, account, Objects.equals(type, 1) ? "短视频id: " : "直播间号: ", itemId);
  992 + String msg = String.format("\n 主题: %s\n 设置封面文件id: %s\n 账户号: %s\n %s%s\n", /*theme,*/ fileId, account, Objects.equals(type, 1) ? "短视频id: " : "直播间号: ", itemId);
993 993 return BigDecimal.valueOf(ImageUtils.calcSimilarity(ImageUtils.getFingerprint(imagePixArr1), ImageUtils.getFingerprint(imagePixArr2), msg));
994 994 }
995 995  
... ... @@ -1002,9 +1002,9 @@ public class CommonBizService {
1002 1002 * @param itemId 视频id/直播间id
1003 1003 * @param type 1:视频, 2:直播
1004 1004 */
1005   - private File findLocalCacheImageUser(String theme, Long themeId, String account, String itemId, Integer type) {
  1005 + private File findLocalCacheImageUser(/*String theme,*/ Long themeId, String account, String itemId, Integer type) {
1006 1006 String tempDir = common.getActivityThemeCoverDir();
1007   - File file = new File(tempDir + File.separator + "activityTheme" + File.separator + themeId + "#" + theme + File.separator + account + File.separator + (Objects.equals(type, 1) ? "video" : "live"));
  1007 + File file = new File(tempDir + File.separator + "activityTheme" + File.separator + themeId + "#" /*+ theme*/ + File.separator + account + File.separator + (Objects.equals(type, 1) ? "video" : "live"));
1008 1008 if (!file.exists()) {
1009 1009 boolean mkdirs = file.mkdirs();
1010 1010 if (mkdirs)
... ... @@ -1027,9 +1027,9 @@ public class CommonBizService {
1027 1027 * @param themeId 主题id
1028 1028 * @param fileId 文件id(主题配置指定封面图文件)
1029 1029 */
1030   - private File findLocalCacheImageTheme(String theme, Long themeId, String fileId) {
  1030 + private File findLocalCacheImageTheme(/*String theme,*/ Long themeId, String fileId) {
1031 1031 String tempDir = common.getActivityThemeCoverDir();
1032   - File file = new File(tempDir + "activityTheme" + File.separator + themeId + "#" + theme + File.separator + "settingCover");
  1032 + File file = new File(tempDir + "activityTheme" + File.separator + themeId /*+ "#" + theme*/ + File.separator + "settingCover");
1033 1033 if (!file.exists()) {
1034 1034 boolean mkdirs = file.mkdirs();
1035 1035 if (mkdirs)
... ...
fw-dalaran-service/src/main/java/cn/fw/dalaran/service/data/impl/ActivityThemeServiceImpl.java
... ... @@ -365,7 +365,7 @@ public class ActivityThemeServiceImpl extends ServiceImpl&lt;ActivityThemeDao, Acti
365 365 String fileId = item.getFid();
366 366 File downloadFile = ImageUtils.convertFileByUrl(serverAddr + fileId, fileId);
367 367 ImageUtils.modifyResolution1(downloadFile.getPath(),
368   - tempDir + "activityTheme" + File.separator + activityTheme.getId() + "#" + activityTheme.getTheme() + File.separator + "settingCover",
  368 + tempDir + "activityTheme" + File.separator + activityTheme.getId() /*+ "#" + activityTheme.getTheme()*/ + File.separator + "settingCover",
369 369 "fw_theme_cover_" + fileId,
370 370 512, 512);
371 371 boolean result = downloadFile.delete();
... ...