tujidelv 1 rok pred
rodič
commit
b1d713766e

+ 11 - 7
src/main/java/top/lvzhiqiang/service/impl/MusicInfoServiceImpl.java

@@ -1,9 +1,7 @@
 package top.lvzhiqiang.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
-import com.mpatric.mp3agic.InvalidDataException;
 import com.mpatric.mp3agic.Mp3File;
-import com.mpatric.mp3agic.UnsupportedTagException;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Connection;
 import org.jsoup.Jsoup;
@@ -12,8 +10,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 import top.lvzhiqiang.config.InitRunner;
 import top.lvzhiqiang.dto.R;
-import top.lvzhiqiang.entity.CoinWatchlist;
-import top.lvzhiqiang.entity.FileImage;
 import top.lvzhiqiang.entity.FileMusicCollection;
 import top.lvzhiqiang.enumeration.ResultCodeEnum;
 import top.lvzhiqiang.exception.BusinessException;
@@ -63,7 +59,7 @@ public class MusicInfoServiceImpl extends BaseServiceImpl<Object> implements Mus
             FileMusicCollection fileMusicCollection = new FileMusicCollection();
             String parentPath = StringUtils.isEmpty(issuingDate) ? String.valueOf(LocalDate.now().getYear()) : issuingDate.substring(0, 4);
             try {
-                if (file != null && "low".equals(qualityType)) {
+                if (file != null && StringUtils.isNotEmpty(file.getOriginalFilename()) && "low".equals(qualityType)) {
                     // 1、给上传的图片生成新的文件名
                     // 1.1获取原始文件名
                     String oldName = file.getOriginalFilename();
@@ -146,9 +142,17 @@ public class MusicInfoServiceImpl extends BaseServiceImpl<Object> implements Mus
                 fileMusicCollection.setCollectionDate(LocalDate.parse(collectionDate, DateUtils.dateFormatter));
             }
 
-            String parentPath = StringUtils.isEmpty(issuingDate) && fileMusicCollection.getIssuingDate() == null ? String.valueOf(LocalDate.now().getYear()) : issuingDate.substring(0, 4);
+            String parentPath;
+            if (StringUtils.isNotEmpty(issuingDate)) {
+                parentPath = issuingDate.substring(0, 4);
+            } else if (fileMusicCollection.getIssuingDate() == null) {
+                parentPath = String.valueOf(LocalDate.now().getYear());
+            } else {
+                parentPath = fileMusicCollection.getIssuingDate().format(DateUtils.dateFormatter);
+            }
+
             try {
-                if (file != null && "low".equals(qualityType)) {
+                if (file != null && StringUtils.isNotEmpty(file.getOriginalFilename()) && "low".equals(qualityType)) {
                     // 1、给上传的图片生成新的文件名
                     // 1.1获取原始文件名
                     String oldName = file.getOriginalFilename();

+ 16 - 4
src/main/resources/static/coin.html

@@ -149,12 +149,24 @@
         font-size: 20px;
     }
 
-    .select2-container {
-        width: 200px !important; /* 设置宽度 */
-    }
     /* 设置Select2容器的高度 */
     .select2-container {
-        height: 15px !important; /* 设置你希望的高度 */
+        height: 38px !important; /* 设置你希望的高度 */
+    }
+
+    /* 设置下拉选择框的高度 */
+    .select2-selection {
+        height: 36px !important; /* 设置选择框高度 */
+    }
+
+    /* 设置下拉列表中的选项的高度 */
+    .select2-results__option {
+        line-height: 24px; /* 设置选项的行高 */
+    }
+
+    /* 设置选择框文本的对齐方式 */
+    .select2-selection__rendered {
+        line-height: 36px; /* 调整文本垂直居中 */
     }
 </style>
 <script type="text/javascript">

+ 3 - 3
src/main/resources/static/js/my-coin.js

@@ -178,11 +178,11 @@ function initOther4Select() {
                         $("#apis-quiet-div-uploadMusics-categoryField").append(uploadMusicCategoryStr);
                         $("#apis-quiet-div-music-categoryField").append(uploadMusicCategoryStr);
 
+                        // 初始化Select2并设置宽度
                         $('#apis-quiet-div-uploadMusics-categoryField').select2({
-                            placeholder: '请选择', // 占位符
+                            placeholder: '请选择分类', // 占位符
                             allowClear: true, // 允许清除选择
-                            width: '200px',              // 在初始化时设置宽度
-                            height: '15px'
+                            width: '160px'              // 在初始化时设置宽度
                         });
                     }
                 });