feat: 添加顾客权限控制和订单时间限制

This commit is contained in:
Agent
2026-03-24 00:40:15 +00:00
parent 8e47a764b3
commit 3d84686fcf
9 changed files with 222 additions and 13 deletions

View File

@@ -0,0 +1,43 @@
package com.example.building.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.building.entity.SystemConfig;
import com.example.building.mapper.SystemConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
@Service
public class SystemConfigService {
@Autowired
private SystemConfigMapper systemConfigMapper;
/**
* 获取顾客订单可见天数配置
* 默认180天半年
*/
public int getCustomerOrderVisibleDays() {
LambdaQueryWrapper<SystemConfig> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SystemConfig::getConfigKey, "customer_order_visible_days");
SystemConfig config = systemConfigMapper.selectOne(wrapper);
if (config != null && config.getConfigValue() != null) {
try {
return Integer.parseInt(config.getConfigValue());
} catch (NumberFormatException e) {
return 180;
}
}
return 180; // 默认半年
}
/**
* 获取顾客可见订单开始日期
*/
public LocalDate getCustomerOrderStartDate() {
int days = getCustomerOrderVisibleDays();
return LocalDate.now().minusDays(days);
}
}