车辆相关配置
This commit is contained in:
parent
0a3de7088c
commit
8648f6a51d
@ -1,14 +0,0 @@
|
||||
package com.cdzy.operations.mapper;
|
||||
|
||||
import com.cdzy.operations.model.entity.EbikeBikeConfiguration;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
|
||||
/**
|
||||
* 车辆相关配置 映射层
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-03 16:21
|
||||
*/
|
||||
|
||||
public interface EbikeBikeConfigurationMapper extends BaseMapper<EbikeBikeConfiguration> {
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cdzy.operations.mapper;
|
||||
|
||||
import com.cdzy.operations.model.entity.EbikeDispatchConfiguration;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
|
||||
/**
|
||||
* 车辆调度配置 映射层
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-03 16:21
|
||||
*/
|
||||
|
||||
public interface EbikeDispatchConfigurationMapper extends BaseMapper<EbikeDispatchConfiguration> {
|
||||
}
|
||||
@ -15,7 +15,12 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EbikeBikeConfigurationDto {
|
||||
public class EbikeDispatchConfigurationDto {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long configurationId;
|
||||
|
||||
/**
|
||||
* 运营商id
|
||||
@ -26,12 +31,12 @@ public class EbikeBikeConfigurationDto {
|
||||
/**
|
||||
* 配置项时长
|
||||
*/
|
||||
@NotNull(message = "配置项时长不能为空")
|
||||
private Integer configurationDuration;
|
||||
@NotNull(message = "车辆多长时间无单生成调度工单不能为空")
|
||||
private Integer dispatchDuration;
|
||||
|
||||
/**
|
||||
* 配置项描述
|
||||
*/
|
||||
@NotBlank(message = "配置项描述不能为空")
|
||||
private String configurationDescription;
|
||||
@NotBlank(message = "调度完成后多长时间内骑行是有效的不能为空")
|
||||
private Integer rideDuration;
|
||||
}
|
||||
@ -23,8 +23,8 @@ import java.time.LocalDateTime;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("ebike_bike_configuration")
|
||||
public class EbikeBikeConfiguration implements Serializable {
|
||||
@Table("ebike_dispatch_configuration")
|
||||
public class EbikeDispatchConfiguration implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -33,7 +33,7 @@ public class EbikeBikeConfiguration implements Serializable {
|
||||
* 操作主键id
|
||||
*/
|
||||
@Id
|
||||
private Long batteryId;
|
||||
private Long configurationId;
|
||||
|
||||
/**
|
||||
* 运营商id
|
||||
@ -41,14 +41,14 @@ public class EbikeBikeConfiguration implements Serializable {
|
||||
private Long operatorId;
|
||||
|
||||
/**
|
||||
* 配置项时长
|
||||
* 车辆多长时间无单生成调度工单
|
||||
*/
|
||||
private Integer configurationDuration;
|
||||
private Integer dispatchDuration;
|
||||
|
||||
/**
|
||||
* 配置项描述
|
||||
* 调度完成后多长时间内骑行是有效的
|
||||
*/
|
||||
private String configurationDescription;
|
||||
private Integer rideDuration;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
@ -1,7 +1,7 @@
|
||||
package com.cdzy.operations.service;
|
||||
|
||||
import com.cdzy.operations.model.dto.EbikeBikeConfigurationDto;
|
||||
import com.cdzy.operations.model.entity.EbikeBikeConfiguration;
|
||||
import com.cdzy.operations.model.dto.EbikeDispatchConfigurationDto;
|
||||
import com.cdzy.operations.model.entity.EbikeDispatchConfiguration;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
@ -13,19 +13,19 @@ import java.util.List;
|
||||
* @since 2025-12-03 16:22
|
||||
*/
|
||||
|
||||
public interface EbikeBikeConfigurationService extends IService<EbikeBikeConfiguration> {
|
||||
public interface EbikeDispatchConfigurationService extends IService<EbikeDispatchConfiguration> {
|
||||
|
||||
/**
|
||||
* 根据运营商id获取配置项(sql会自动拼接运营商id)
|
||||
*
|
||||
* @return 配置项
|
||||
*/
|
||||
List<EbikeBikeConfiguration> getConfigurationByOperationId();
|
||||
List<EbikeDispatchConfiguration> getConfigurationByOperationId();
|
||||
|
||||
/**
|
||||
* 配置项保存
|
||||
*
|
||||
* @param configurationDto 配置项参数
|
||||
*/
|
||||
void saveConfiguration(EbikeBikeConfigurationDto configurationDto);
|
||||
void saveOrUpdateConfiguration(EbikeDispatchConfigurationDto configurationDto);
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
package com.cdzy.operations.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.cdzy.operations.mapper.EbikeBikeConfigurationMapper;
|
||||
import com.cdzy.operations.model.dto.EbikeBikeConfigurationDto;
|
||||
import com.cdzy.operations.model.entity.EbikeBikeConfiguration;
|
||||
import com.cdzy.operations.service.EbikeBikeConfigurationService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.cdzy.operations.model.entity.table.EbikeBikeConfigurationTableDef.EBIKE_BIKE_CONFIGURATION;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆相关配置 实现类
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-03 16:22
|
||||
*/
|
||||
@Service
|
||||
public class EbikeBikeConfigurationServiceImpl extends ServiceImpl<EbikeBikeConfigurationMapper, EbikeBikeConfiguration> implements EbikeBikeConfigurationService {
|
||||
|
||||
@Override
|
||||
public List<EbikeBikeConfiguration> getConfigurationByOperationId() {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.select(EBIKE_BIKE_CONFIGURATION.ALL_COLUMNS);
|
||||
return this.mapper.selectListByQuery(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfiguration(EbikeBikeConfigurationDto configurationDto) {
|
||||
EbikeBikeConfiguration configuration = EbikeBikeConfiguration.builder()
|
||||
.operatorId(configurationDto.getOperatorId())
|
||||
.configurationDuration(configurationDto.getConfigurationDuration())
|
||||
.configurationDescription(configurationDto.getConfigurationDescription())
|
||||
.createdBy(StpUtil.getLoginIdAsLong())
|
||||
.build();
|
||||
this.mapper.insert(configuration);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.cdzy.operations.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.cdzy.operations.mapper.EbikeDispatchConfigurationMapper;
|
||||
import com.cdzy.operations.model.dto.EbikeDispatchConfigurationDto;
|
||||
import com.cdzy.operations.model.entity.EbikeDispatchConfiguration;
|
||||
import com.cdzy.operations.service.EbikeDispatchConfigurationService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.cdzy.operations.model.entity.table.EbikeDispatchConfigurationTableDef.EBIKE_DISPATCH_CONFIGURATION;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆相关配置 实现类
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2025-12-03 16:22
|
||||
*/
|
||||
@Service
|
||||
public class EbikeDispatchConfigurationServiceImpl extends ServiceImpl<EbikeDispatchConfigurationMapper, EbikeDispatchConfiguration> implements EbikeDispatchConfigurationService {
|
||||
|
||||
@Override
|
||||
public List<EbikeDispatchConfiguration> getConfigurationByOperationId() {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.select(EBIKE_DISPATCH_CONFIGURATION.ALL_COLUMNS);
|
||||
return this.mapper.selectListByQuery(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateConfiguration(EbikeDispatchConfigurationDto configurationDto) {
|
||||
if (configurationDto.getConfigurationId() != null) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.where(EBIKE_DISPATCH_CONFIGURATION.CONFIGURATION_ID.eq(configurationDto.getConfigurationId()));
|
||||
EbikeDispatchConfiguration ebikeDispatchConfiguration = this.mapper.selectOneByQuery(queryWrapper);
|
||||
ebikeDispatchConfiguration.setDispatchDuration(configurationDto.getDispatchDuration());
|
||||
ebikeDispatchConfiguration.setRideDuration(configurationDto.getRideDuration());
|
||||
ebikeDispatchConfiguration.setUpdatedBy(StpUtil.getLoginIdAsLong());
|
||||
this.mapper.update(ebikeDispatchConfiguration);
|
||||
} else {
|
||||
EbikeDispatchConfiguration configuration = EbikeDispatchConfiguration.builder()
|
||||
.operatorId(configurationDto.getOperatorId())
|
||||
.dispatchDuration(configurationDto.getDispatchDuration())
|
||||
.rideDuration(configurationDto.getRideDuration())
|
||||
.createdBy(StpUtil.getLoginIdAsLong())
|
||||
.build();
|
||||
this.mapper.insert(configuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user