修复门店默认经营有效期为空
This commit is contained in:
+1
@@ -129,6 +129,7 @@ public class WorkbenchRegistrationServiceImpl implements WorkbenchRegistrationSe
|
||||
shop.setBusinessHours("10:00-22:00");
|
||||
shop.setStatus(0);
|
||||
shop.setIsDelete(0);
|
||||
shop.setBusinessExpireTime(shopBusinessExpiryService.defaultExpireTime(LocalDateTime.now().toLocalDate()));
|
||||
if (shop.getId() == null) {
|
||||
shopMapper.insert(shop);
|
||||
} else {
|
||||
|
||||
+3
@@ -23,6 +23,7 @@ import com.xiaowang.jayucloud.salon.core.modules.integration.service.MapService;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.artist.service.NailArtistInfoService;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.file.service.ObjectStorageFileService;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.shop.service.ShopService;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.shop.service.ShopBusinessExpiryService;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.file.support.ObjectStorageUrlSupport;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.shop.support.ShopThemeSupport;
|
||||
import com.xiaowang.jayucloud.salon.core.modules.shop.support.UserShopBindingSupport;
|
||||
@@ -87,6 +88,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
|
||||
* Variable `shopMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
|
||||
*/
|
||||
private final ShopMapper shopMapper;
|
||||
private final ShopBusinessExpiryService shopBusinessExpiryService;
|
||||
/**
|
||||
* Variable `couponService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
|
||||
*/
|
||||
@@ -161,6 +163,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
|
||||
shopDO.setLongitude(shopDTO.getLongitude());
|
||||
shopDO.setLatitude(shopDTO.getLatitude());
|
||||
shopDO.setBusinessHours(null);
|
||||
shopDO.setBusinessExpireTime(shopBusinessExpiryService.defaultExpireTime(LocalDate.now()));
|
||||
shopDO.setCoverImageFileId(null);
|
||||
shopDO.setImageFileIds(null);
|
||||
shopDO.setModerationStatus("PENDING");
|
||||
|
||||
+2
@@ -68,6 +68,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -1655,6 +1656,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
shop.setAuthorizationStartDate(LocalDateTime.now().minusDays(1).toLocalDate());
|
||||
shop.setAuthorizationDays(0);
|
||||
shop.setAuthorizationExpireTime(LocalDateTime.now().minusSeconds(1));
|
||||
shop.setBusinessExpireTime(shopBusinessExpiryService.defaultExpireTime(LocalDate.now()));
|
||||
shop.setIsDelete(0);
|
||||
shopMapper.insert(shop);
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
-- 修复历史门店经营有效期为空的问题,并保证默认天数参数有有效值。
|
||||
-- 已有有效期的门店不会被覆盖;已审核通过的店长注册按审核日期起算,其余存量门店从迁移日获得默认期限。
|
||||
|
||||
INSERT INTO t_system_parameter_config
|
||||
(id, config_group, config_key, config_name, config_value, enabled, remark, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
(CAST(CONV(SUBSTR(SHA2('SALON:SHOP:SHOP_DEFAULT_VALID_DAYS', 256), 1, 15), 16, 10) AS UNSIGNED),
|
||||
'SHOP', 'SHOP_DEFAULT_VALID_DAYS', '新门店默认有效期天数', '30', 1,
|
||||
'店长注册审核通过后新门店的默认经营有效期天数,范围1-3650', NOW(), NOW(), 0)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
config_name = VALUES(config_name),
|
||||
config_value = CASE
|
||||
WHEN config_value REGEXP '^[0-9]+$'
|
||||
AND CAST(config_value AS UNSIGNED) BETWEEN 1 AND 3650 THEN config_value
|
||||
ELSE '30'
|
||||
END,
|
||||
enabled = 1,
|
||||
is_delete = 0,
|
||||
remark = VALUES(remark),
|
||||
update_time = NOW();
|
||||
|
||||
SET @salon_shop_default_valid_days = (
|
||||
SELECT CASE
|
||||
WHEN config_value REGEXP '^[0-9]+$'
|
||||
AND CAST(config_value AS UNSIGNED) BETWEEN 1 AND 3650 THEN CAST(config_value AS UNSIGNED)
|
||||
ELSE 30
|
||||
END
|
||||
FROM t_system_parameter_config
|
||||
WHERE config_group = 'SHOP'
|
||||
AND config_key = 'SHOP_DEFAULT_VALID_DAYS'
|
||||
AND enabled = 1
|
||||
AND is_delete = 0
|
||||
ORDER BY id
|
||||
LIMIT 1
|
||||
);
|
||||
SET @salon_shop_default_valid_days = COALESCE(@salon_shop_default_valid_days, 30);
|
||||
|
||||
UPDATE t_shop s
|
||||
LEFT JOIN (
|
||||
SELECT shop_id, MAX(reviewed_at) AS approved_at
|
||||
FROM t_workbench_registration_application
|
||||
WHERE role_type = 'MANAGER'
|
||||
AND status = 'APPROVED'
|
||||
AND is_delete = 0
|
||||
GROUP BY shop_id
|
||||
) approved_application ON approved_application.shop_id = s.id
|
||||
SET s.business_expire_time = TIMESTAMP(
|
||||
DATE_ADD(
|
||||
COALESCE(DATE(approved_application.approved_at), CURDATE()),
|
||||
INTERVAL (@salon_shop_default_valid_days - 1) DAY
|
||||
),
|
||||
'23:59:59'
|
||||
)
|
||||
WHERE s.business_expire_time IS NULL
|
||||
AND s.is_delete = 0;
|
||||
Reference in New Issue
Block a user