package com.xiaopeng.operation.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xiaopeng.api.vo.HotFixInfoVo; import com.xiaopeng.common.redis.service.RedisService; import com.xiaopeng.operation.mapper.XpSystemSettingMapper; import com.xiaopeng.api.model.operation.XpSystemSetting; import com.xiaopeng.operation.service.XpSystemSettingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.cache.RedisCache; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Objects; /** *

* 系统设置表 服务实现类 *

* * @author liu * @since 2026-02-03 */ @Service public class XpSystemSettingServiceImpl extends ServiceImpl implements XpSystemSettingService { @Autowired private RedisService redisService; @Override public String getCustomerServicePhone() { XpSystemSetting xpSystemSetting = this.getOne(null); if (xpSystemSetting != null) { return xpSystemSetting.getCustomerServicePhone(); } return ""; } @Override public Integer getOrderDistance() { XpSystemSetting xpSystemSetting = this.getOne(null); if (xpSystemSetting != null) { return xpSystemSetting.getOrderDistance(); } return 0; } @Override public Integer getMinOrderDistance() { XpSystemSetting xpSystemSetting = this.getOne(null); if (xpSystemSetting != null) { return xpSystemSetting.getMinOrderDistance(); } return 0; } @Override public Integer getOrderFinishTime() { XpSystemSetting xpSystemSetting = this.getOne(null); if (xpSystemSetting != null) { return xpSystemSetting.getArriveTime(); } return 15; } @Override public void saveSystemSetting(XpSystemSetting xpSystemSetting) { XpSystemSetting existSetting = lambdaQuery().last("limit 1").one(); if (Objects.nonNull(existSetting)) { lambdaUpdate().eq(XpSystemSetting::getId, existSetting.getId()) .set(XpSystemSetting::getCustomerServicePhone, xpSystemSetting.getCustomerServicePhone()) .set(XpSystemSetting::getOrderDistance, xpSystemSetting.getOrderDistance()) .set(XpSystemSetting::getMinOrderDistance, xpSystemSetting.getMinOrderDistance()) .set(XpSystemSetting::getArriveTime, xpSystemSetting.getArriveTime()) .set(XpSystemSetting::getHeadShowCount, xpSystemSetting.getHeadShowCount()) .set(XpSystemSetting::getNearPointDistance, xpSystemSetting.getNearPointDistance()) .set(XpSystemSetting::getAdsorptionDistance, xpSystemSetting.getAdsorptionDistance()) .set(XpSystemSetting::getHotfixStatus, xpSystemSetting.getHotfixStatus()) .set(XpSystemSetting::getHotfixStartTime, xpSystemSetting.getHotfixStartTime()) .set(XpSystemSetting::getHotfixEndTime, xpSystemSetting.getHotfixEndTime()).update(); }else { save(xpSystemSetting); } //保存热修复信息到redis HotFixInfoVo hotFixInfoVo = new HotFixInfoVo(); hotFixInfoVo.setHotfixStatus(xpSystemSetting.getHotfixStatus() == null ? 0 : xpSystemSetting.getHotfixStatus()); hotFixInfoVo.setHotfixStartTime(xpSystemSetting.getHotfixStartTime()); hotFixInfoVo.setHotfixEndTime(xpSystemSetting.getHotfixEndTime()); redisService.setCacheObject("HOT_FIX_INFO", hotFixInfoVo); } }