Quellcode durchsuchen

商家端 信息设置 增加字段businessHoursStr 存储多个时间

qinxuyang vor 2 Wochen
Ursprung
Commit
4a2533b6a8

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/StoreBookingBusinessHours.java

@@ -54,6 +54,10 @@ public class StoreBookingBusinessHours {
     @TableField("end_time")
     private String endTime;
 
+    @ApiModelProperty(value = "营业时间(多段用英文分号分隔,varchar500)")
+    @TableField("business_hours_str")
+    private String businessHoursStr;
+
     @ApiModelProperty(value = "排序(用于同一门店多条记录的排序)")
     @TableField("sort")
     private Integer sort;

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/dto/StoreBookingBusinessHoursDTO.java

@@ -42,6 +42,9 @@ public class StoreBookingBusinessHoursDTO {
     @ApiModelProperty(value = "结束时间(HH:mm格式,非全天时必填)")
     private String endTime;
 
+    @ApiModelProperty(value = "营业时间(多段用英文分号;分隔,最长500字符)")
+    private String businessHoursStr;
+
     @ApiModelProperty(value = "排序(用于同一门店多条记录的排序)")
     private Integer sort;
 

+ 2 - 1
alien-entity/src/main/resources/mapper/StoreBookingBusinessHoursMapper.xml

@@ -13,6 +13,7 @@
         <result column="booking_time_type" property="bookingTimeType" />
         <result column="start_time" property="startTime" />
         <result column="end_time" property="endTime" />
+        <result column="business_hours_str" property="businessHoursStr" />
         <result column="sort" property="sort" />
         <result column="delete_flag" property="deleteFlag" />
         <result column="created_time" property="createdTime" />
@@ -27,7 +28,7 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id, store_id, settings_id, business_type, holiday_type, holiday_date, 
-        booking_time_type, start_time, end_time, sort, 
+        booking_time_type, start_time, end_time, business_hours_str, sort, 
         delete_flag, created_time, created_user_id, updated_time, updated_user_id,
         essential_id, reservation, reservation_money
     </sql>

+ 2 - 0
alien-store/src/main/java/shop/alien/store/controller/StoreBookingBusinessHoursController.java

@@ -129,6 +129,7 @@ public class StoreBookingBusinessHoursController {
             businessHours.setBookingTimeType(dto.getBookingTimeType());
             businessHours.setStartTime(dto.getStartTime());
             businessHours.setEndTime(dto.getEndTime());
+            businessHours.setBusinessHoursStr(dto.getBusinessHoursStr());
             businessHours.setSort(dto.getSort());
             
             boolean result = storeBookingBusinessHoursService.saveOrUpdateBusinessHours(businessHours);
@@ -177,6 +178,7 @@ public class StoreBookingBusinessHoursController {
                         businessHours.setBookingTimeType(dto.getBookingTimeType());
                         businessHours.setStartTime(dto.getStartTime());
                         businessHours.setEndTime(dto.getEndTime());
+                        businessHours.setBusinessHoursStr(dto.getBusinessHoursStr());
                         businessHours.setSort(dto.getSort());
                         return businessHours;
                     })

+ 1 - 43
alien-store/src/main/java/shop/alien/store/controller/StoreBookingSettingsController.java

@@ -89,49 +89,7 @@ public class StoreBookingSettingsController {
         if (dto.getBookingNotAvailableTime() == null || dto.getBookingNotAvailableTime() < 0) {
             return R.fail("营业时间结束前不可预订时间必须大于等于0");
         }
-        
-        // 如果选择非全天,必须填写开始时间和结束时间
-//        if (dto.getBookingTimeType() != null && dto.getBookingTimeType() == 0) {
-//            if (!StringUtils.hasText(dto.getBookingStartTime())) {
-//                return R.fail("非全天时必须填写开始时间");
-//            }
-//            if (!StringUtils.hasText(dto.getBookingEndTime())) {
-//                return R.fail("非全天时必须填写结束时间");
-//            }
-//        }
-        
-        // 验证正常营业时间
-//        if (dto.getNormalBusinessHours() != null) {
-//            StoreBookingBusinessHoursDTO normalHours = dto.getNormalBusinessHours();
-//            if (normalHours.getBookingTimeType() == null) {
-//                return R.fail("正常营业时间的预订时间类型不能为空");
-//            }
-//            if (normalHours.getBookingTimeType() == 0) {
-//                if (!StringUtils.hasText(normalHours.getStartTime())) {
-//                    return R.fail("正常营业时间非全天时必须填写开始时间");
-//                }
-//                if (!StringUtils.hasText(normalHours.getEndTime())) {
-//                    return R.fail("正常营业时间非全天时必须填写结束时间");
-//                }
-//            }
-//        }
-        
-        // 验证特殊营业时间列表
-//        if (dto.getSpecialBusinessHoursList() != null && !dto.getSpecialBusinessHoursList().isEmpty()) {
-//            for (StoreBookingBusinessHoursDTO specialHours : dto.getSpecialBusinessHoursList()) {
-//                if (specialHours.getBookingTimeType() == null) {
-//                    return R.fail("特殊营业时间的预订时间类型不能为空");
-//                }
-//                if (specialHours.getBookingTimeType() == 0) {
-//                    if (!StringUtils.hasText(specialHours.getStartTime())) {
-//                        return R.fail("特殊营业时间非全天时必须填写开始时间");
-//                    }
-//                    if (!StringUtils.hasText(specialHours.getEndTime())) {
-//                        return R.fail("特殊营业时间非全天时必须填写结束时间");
-//                    }
-//                }
-//            }
-//        }
+
         
         // 编辑校验:如果是编辑操作,检查正常营业时间的id是否有值
         // 注意:特殊营业时间列表中的项可以部分有id(编辑)部分没有id(新增)

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

@@ -146,6 +146,7 @@ public class StoreBookingBusinessHoursServiceImpl extends ServiceImpl<StoreBooki
             updateWrapper.set(StoreBookingBusinessHours::getBookingTimeType, businessHours.getBookingTimeType());
             updateWrapper.set(StoreBookingBusinessHours::getStartTime, businessHours.getStartTime());
             updateWrapper.set(StoreBookingBusinessHours::getEndTime, businessHours.getEndTime());
+            updateWrapper.set(StoreBookingBusinessHours::getBusinessHoursStr, businessHours.getBusinessHoursStr());
             updateWrapper.set(StoreBookingBusinessHours::getSort, businessHours.getSort());
             
             if (userId != null) {

+ 2 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreBookingSettingsServiceImpl.java

@@ -378,6 +378,7 @@ public class StoreBookingSettingsServiceImpl extends ServiceImpl<StoreBookingSet
         businessHours.setBookingTimeType(dto.getBookingTimeType());
         businessHours.setStartTime(dto.getStartTime());
         businessHours.setEndTime(dto.getEndTime());
+        businessHours.setBusinessHoursStr(dto.getBusinessHoursStr());
         businessHours.setSort(dto.getSort() != null ? dto.getSort() : 0);
         businessHours.setEssentialId(dto.getEssentialId());
         businessHours.setReservation(dto.getReservation());
@@ -401,6 +402,7 @@ public class StoreBookingSettingsServiceImpl extends ServiceImpl<StoreBookingSet
         dto.setBookingTimeType(businessHours.getBookingTimeType());
         dto.setStartTime(businessHours.getStartTime());
         dto.setEndTime(businessHours.getEndTime());
+        dto.setBusinessHoursStr(businessHours.getBusinessHoursStr());
         dto.setSort(businessHours.getSort());
         dto.setEssentialId(businessHours.getEssentialId());
         dto.setReservation(businessHours.getReservation());