车辆相关配置

This commit is contained in:
yanglei 2025-12-04 16:21:15 +08:00
parent 08d6256fd5
commit a842dcb7c6
3 changed files with 14 additions and 7 deletions

View File

@ -18,7 +18,7 @@ public interface EbikeDispatchConfigurationService extends IService<EbikeDispatc
*
* @return 配置项
*/
EbikeDispatchConfiguration getConfigurationByOperationId();
EbikeDispatchConfiguration getConfigurationByOperationId(Long operationId);
/**
* 配置项保存

View File

@ -12,10 +12,7 @@ import com.cdzy.operations.model.dto.EbikeUserBikeInfo;
import com.cdzy.operations.model.dto.EbikeUserLockDto;
import com.cdzy.operations.model.entity.*;
import com.cdzy.operations.model.vo.*;
import com.cdzy.operations.service.EbikeBikeInfoService;
import com.cdzy.operations.service.EbikeEcuInfoService;
import com.cdzy.operations.service.EbikeInventoryRecordService;
import com.cdzy.operations.service.EbikeInventoryService;
import com.cdzy.operations.service.*;
import com.cdzy.operations.utils.RedisUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
@ -35,6 +32,7 @@ import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import static com.cdzy.operations.model.entity.table.EbikeBatteryInfoTableDef.EBIKE_BATTERY_INFO;
import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO;
@ -96,6 +94,9 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
@Resource
private EbikeBikeOrderMapper orderMapper;
@Resource
private EbikeDispatchConfigurationService dispatchConfigurationService;
@Override
@Transactional
public void bind(EbikeBikeBindVo bindVo) {
@ -466,6 +467,10 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
ebikeEcuInfoService.lock(ebikeEcuInfo);
EbikeDispatchConfiguration configuration = dispatchConfigurationService.getConfigurationByOperationId(info.getOperatorId());
redisUtil.expire(bikeCode, configuration.getDispatchDuration(), TimeUnit.HOURS);
this.mapper.update(info);
return EbikeUserLockDto.builder()

View File

@ -10,6 +10,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
import static com.cdzy.operations.model.entity.table.EbikeDispatchConfigurationTableDef.EBIKE_DISPATCH_CONFIGURATION;
@ -24,9 +25,10 @@ import static com.cdzy.operations.model.entity.table.EbikeDispatchConfigurationT
public class EbikeDispatchConfigurationServiceImpl extends ServiceImpl<EbikeDispatchConfigurationMapper, EbikeDispatchConfiguration> implements EbikeDispatchConfigurationService {
@Override
public EbikeDispatchConfiguration getConfigurationByOperationId() {
public EbikeDispatchConfiguration getConfigurationByOperationId(Long operationId) {
QueryWrapper queryWrapper = QueryWrapper.create()
.select(EBIKE_DISPATCH_CONFIGURATION.ALL_COLUMNS);
.select(EBIKE_DISPATCH_CONFIGURATION.ALL_COLUMNS)
.and(EBIKE_DISPATCH_CONFIGURATION.OPERATOR_ID.eq(operationId, Objects.nonNull(operationId)));
return this.mapper.selectOneByQuery(queryWrapper);
}