Browse Source

商户PC端演出 增加 起始时间和结束时间搜索

qinxuyang 2 tháng trước cách đây
mục cha
commit
2d112d67fc

+ 35 - 5
alien-store/src/main/java/shop/alien/store/controller/BarPerformanceController.java

@@ -12,6 +12,9 @@ import shop.alien.entity.store.dto.BarPerformanceOnlineStatusDto;
 import shop.alien.entity.store.vo.BarPerformanceDetailVo;
 import shop.alien.store.service.BarPerformanceService;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 /**
  * 酒吧演出Controller
  * 提供酒吧演出的CRUD、审核、上下线等RESTful API接口
@@ -180,6 +183,8 @@ public class BarPerformanceController {
      * @param performanceType 演出类型(0-特邀演出,1-常规演出)
      * @param onlineStatus 上线状态(0-下线,1-上线)
      * @param reviewStatus 审核状态(0-待审核 1-审核通过 2-审核拒绝)
+     * @param startCreatedTime 创建时间开始(yyyy-MM-dd HH:mm:ss)
+     * @param endCreatedTime 创建时间结束(yyyy-MM-dd HH:mm:ss)
      * @return 演出列表
      */
     @ApiOperation("根据门店ID查询演出列表(支持按审核状态、分类和名称搜索)")
@@ -192,7 +197,9 @@ public class BarPerformanceController {
             @ApiImplicitParam(name = "performanceName", value = "演出名称(支持模糊搜索)", dataType = "String", paramType = "query", required = false),
             @ApiImplicitParam(name = "performanceType", value = "演出类型(0-特邀演出,1-常规演出)", dataType = "Integer", paramType = "query", required = false),
             @ApiImplicitParam(name = "onlineStatus", value = "上线状态(0-下线,1-上线)", dataType = "Integer", paramType = "query", required = false),
-            @ApiImplicitParam(name = "reviewStatus", value = "审核状态(0-待审核 1-审核通过 2-审核拒绝)", dataType = "Integer", paramType = "query", required = false)
+            @ApiImplicitParam(name = "reviewStatus", value = "审核状态(0-待审核 1-审核通过 2-审核拒绝)", dataType = "Integer", paramType = "query", required = false),
+            @ApiImplicitParam(name = "startCreatedTime", value = "创建时间开始(yyyy-MM-dd HH:mm:ss)", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "endCreatedTime", value = "创建时间结束(yyyy-MM-dd HH:mm:ss)", dataType = "String", paramType = "query", required = false)
     })
     @GetMapping("/listByStoreId")
     public R<IPage<BarPerformance>> queryPerformanceListByStoreId(
@@ -204,14 +211,37 @@ public class BarPerformanceController {
             @RequestParam(required = false) String performanceName,
             @RequestParam(required = false) Integer performanceType,
             @RequestParam(required = false) Integer onlineStatus,
-            @RequestParam(required = false) Integer reviewStatus) {
+            @RequestParam(required = false) Integer reviewStatus,
+            @RequestParam(required = false) String startCreatedTime,
+            @RequestParam(required = false) String endCreatedTime) {
         // 兼容旧参数:如果reviewStatus为空但statusReview不为空,使用statusReview
         Integer finalReviewStatus = reviewStatus != null ? reviewStatus : statusReview;
-        log.info("BarPerformanceController.queryPerformanceListByStoreId?page={}, size={}, storeId={}, statusReview={}, category={}, performanceName={}, performanceType={}, onlineStatus={}, reviewStatus={}",
-                page, size, storeId, statusReview, category, performanceName, performanceType, onlineStatus, reviewStatus);
+        
+        // 解析时间参数
+        Date startTime = null;
+        Date endTime = null;
+        if (startCreatedTime != null && !startCreatedTime.isEmpty()) {
+            try {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                startTime = sdf.parse(startCreatedTime);
+            } catch (Exception e) {
+                log.warn("解析开始时间失败: {}", startCreatedTime, e);
+            }
+        }
+        if (endCreatedTime != null && !endCreatedTime.isEmpty()) {
+            try {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                endTime = sdf.parse(endCreatedTime);
+            } catch (Exception e) {
+                log.warn("解析结束时间失败: {}", endCreatedTime, e);
+            }
+        }
+        
+        log.info("BarPerformanceController.queryPerformanceListByStoreId?page={}, size={}, storeId={}, statusReview={}, category={}, performanceName={}, performanceType={}, onlineStatus={}, reviewStatus={}, startCreatedTime={}, endCreatedTime={}",
+                page, size, storeId, statusReview, category, performanceName, performanceType, onlineStatus, reviewStatus, startCreatedTime, endCreatedTime);
         try {
             IPage<BarPerformance> performanceList = barPerformanceService.queryPerformanceListByStoreIdAndCategory(
-                    page, size, storeId, finalReviewStatus, category != null ? category : "all", performanceName, performanceType, onlineStatus);
+                    page, size, storeId, finalReviewStatus, category != null ? category : "all", performanceName, performanceType, onlineStatus, startTime, endTime);
             return R.data(performanceList);
         } catch (Exception e) {
             log.error("根据门店ID查询演出列表失败", e);

+ 5 - 1
alien-store/src/main/java/shop/alien/store/service/BarPerformanceService.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import shop.alien.entity.store.BarPerformance;
 import shop.alien.entity.store.vo.BarPerformanceDetailVo;
 
+import java.util.Date;
+
 /**
  * 酒吧演出服务接口
  * 提供酒吧演出的CRUD、审核、上下线等核心业务功能
@@ -79,7 +81,9 @@ public interface BarPerformanceService {
      * @param performanceName 演出名称(可选,支持模糊搜索)
      * @param performanceType 演出类型(0-特邀演出,1-常规演出)
      * @param onlineStatus 上线状态(0-下线,1-上线)
+     * @param startCreatedTime 创建时间开始
+     * @param endCreatedTime 创建时间结束
      * @return 演出列表
      */
-    IPage<BarPerformance> queryPerformanceListByStoreIdAndCategory(Integer page, Integer size, Integer storeId, Integer reviewStatus, String category, String performanceName, Integer performanceType, Integer onlineStatus);
+    IPage<BarPerformance> queryPerformanceListByStoreIdAndCategory(Integer page, Integer size, Integer storeId, Integer reviewStatus, String category, String performanceName, Integer performanceType, Integer onlineStatus, Date startCreatedTime, Date endCreatedTime);
 }

+ 10 - 2
alien-store/src/main/java/shop/alien/store/service/impl/BarPerformanceServiceImpl.java

@@ -572,11 +572,11 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
                 // 忽略无效的状态值
             }
         }
-        return queryPerformanceListByStoreIdAndCategory(page, size, storeId, reviewStatus, "all", null, null, null);
+        return queryPerformanceListByStoreIdAndCategory(page, size, storeId, reviewStatus, "all", null, null, null, null, null);
     }
 
     @Override
-    public IPage<BarPerformance> queryPerformanceListByStoreIdAndCategory(Integer page, Integer size, Integer storeId, Integer reviewStatus, String category, String performanceName, Integer performanceType, Integer onlineStatus) {
+    public IPage<BarPerformance> queryPerformanceListByStoreIdAndCategory(Integer page, Integer size, Integer storeId, Integer reviewStatus, String category, String performanceName, Integer performanceType, Integer onlineStatus, Date startCreatedTime, Date endCreatedTime) {
         if (page == null || size == null || storeId == null || storeId <= 0) {
             return new Page<>();
         }
@@ -659,6 +659,14 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
             }
         }
 
+        // 按创建时间范围筛选
+        if (startCreatedTime != null) {
+            queryWrapper.ge("created_time", startCreatedTime);
+        }
+        if (endCreatedTime != null) {
+            queryWrapper.le("created_time", endCreatedTime);
+        }
+
         queryWrapper.eq("delete_flag", 0);
         // 按提交时间(创建时间)倒序排序
         queryWrapper.orderByDesc("created_time");