ssk 1 ماه پیش
والد
کامیت
25363a19f3

+ 3 - 3
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserViolationServiceImpl.java

@@ -315,9 +315,9 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
         QueryWrapper<LifeUserViolationVo> queryWrapper = new QueryWrapper<>();
 
         // 基础查询条件
-        queryWrapper.eq("luv.delete_flag", 0)
-                //排除二手的举报
-                .notIn("luv.report_context_type", Arrays.asList("4", "5"));
+        queryWrapper.eq("luv.delete_flag", 0);
+//                //排除二手的举报
+//                .notIn("luv.report_context_type", Arrays.asList("4", "5"));
 
         // 动态查询条件
         queryWrapper.like(StringUtils.isNotEmpty(nickName), "ui.nick_name", nickName)

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/impl/PlatformStoreCouponServiceImpl.java

@@ -100,7 +100,7 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
     public IPage<LifeGroupBuyMainVo> getLifeGroupBuyMainList(Integer page, Integer size, String storeName, String status, String createdTime, String phone, String expiredState) {
         QueryWrapper<LifeGroupBuyMainVo> wrapper = new QueryWrapper<>();
         wrapper.like(StringUtils.isNotEmpty(storeName), "store.store_name", storeName);
-        if (status == null || status.equals("")) {
+        if (status == null || status.isEmpty()) {
             wrapper.in("life.status", 1, 2, 3, 4, 5, 6, 7);
         }
         if (status.equals("9")) {

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -1454,7 +1454,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         }
         String fileName = UUID.randomUUID().toString().replace("-", "");
         String filePath = ExcelGenerator.generateExcel(excelPath + excelGeneratePath + fileName + ".xlsx", storeInfoExpiredRecordsExcelVos, StoreInfoExpiredRecordsExcelVo.class);
-        String url = aliOSSUtil.uploadFile(new File(filePath), "/excel/" + fileName + ".xlsx");
+        String url = aliOSSUtil.uploadFile(new File(filePath), "excel/" + fileName + ".xlsx");
         new File(filePath).delete();
         return url;
     }

+ 51 - 2
alien-util/src/main/java/shop/alien/util/ali/AliOSSUtil.java

@@ -46,7 +46,23 @@ public class AliOSSUtil {
      * @return filePath
      */
     public String uploadFile(MultipartFile multipartFile, String ossFilePath) {
+        // 验证参数
+        if (multipartFile == null || multipartFile.isEmpty()) {
+            log.error("AliOSSUtil.uploadFile ERROR: multipartFile is null or empty");
+            return null;
+        }
+        
+        if (StringUtils.isEmpty(ossFilePath)) {
+            log.error("AliOSSUtil.uploadFile ERROR: ossFilePath is empty");
+            return null;
+        }
+        
         File convertFile = FileUtil.convert(multipartFile);
+        if (convertFile == null) {
+            log.error("AliOSSUtil.uploadFile ERROR: convertFile is null");
+            return null;
+        }
+        
         return uploadFile(convertFile, ossFilePath);
     }
 
@@ -58,6 +74,39 @@ public class AliOSSUtil {
      * @return filePath
      */
     public String uploadFile(File file, String ossFilePath) {
+        // 验证参数
+        if (file == null) {
+            log.error("AliOSSUtil.uploadFile ERROR: file is null");
+            return null;
+        }
+        
+        if (StringUtils.isEmpty(ossFilePath)) {
+            log.error("AliOSSUtil.uploadFile ERROR: ossFilePath is empty");
+            return null;
+        }
+        
+        // 检查文件是否存在且不为空
+        if (!file.exists()) {
+            log.error("AliOSSUtil.uploadFile ERROR: file does not exist, path: {}", file.getAbsolutePath());
+            return null;
+        }
+        
+        if (file.length() == 0) {
+            log.error("AliOSSUtil.uploadFile ERROR: file is empty, path: {}", file.getAbsolutePath());
+            return null;
+        }
+        
+        // 验证ossFilePath格式 - 不能以/开头
+        if (ossFilePath.startsWith("/")) {
+            log.error("AliOSSUtil.uploadFile ERROR: ossFilePath cannot start with '/': {}", ossFilePath);
+            return null;
+        }
+        
+        if (ossFilePath.contains("..") || ossFilePath.contains("\\")) {
+            log.error("AliOSSUtil.uploadFile ERROR: invalid ossFilePath format: {}", ossFilePath);
+            return null;
+        }
+
         // 创建OSSClient实例。
         // 当OSSClient实例不再使用时,调用shutdown方法以释放资源。
         ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
@@ -76,7 +125,7 @@ public class AliOSSUtil {
             }
             return null;
         } catch (Exception e) {
-            log.error("AliOSSUtil.uploadFile ERROR: {}", e.getMessage());
+            log.error("AliOSSUtil.uploadFile ERROR: {}", e.getMessage(), e);
             return null;
         } finally {
             if (ossClient != null) {
@@ -85,4 +134,4 @@ public class AliOSSUtil {
         }
     }
 
-}
+}