Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
45c7771c4a
@ -21,7 +21,7 @@ import static com.cdzy.operations.model.entity.table.EbikeCarrierConfigurationTa
|
||||
|
||||
|
||||
/**
|
||||
* 运营商配置配置 控制层
|
||||
* 运营商配置 控制层
|
||||
*
|
||||
* @author yanglei
|
||||
* @since 2026-01-08 17:08
|
||||
@ -34,12 +34,12 @@ public class EbikeCarrierConfigurationController {
|
||||
private EbikeCarrierConfigurationService carrierConfigurationService;
|
||||
|
||||
/**
|
||||
* 添加。
|
||||
* 添加更新
|
||||
*
|
||||
* @param dto 配置实体类
|
||||
* @return 主键id
|
||||
*/
|
||||
@PostMapping("save")
|
||||
@PostMapping("saveOrUpdate")
|
||||
public JsonResult<?> save(@RequestBody @Validated EbikeSaveConfigurationDto dto) {
|
||||
carrierConfigurationService.saveConfiguration(dto);
|
||||
return JsonResult.success();
|
||||
@ -108,7 +108,7 @@ public class EbikeCarrierConfigurationController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据运营商id查询电话
|
||||
* 根据车辆编码查询电话
|
||||
*
|
||||
* @param bikeCode 车辆编码
|
||||
* @return 运营商电话
|
||||
|
||||
@ -35,21 +35,40 @@ public class EbikeCarrierConfigurationServiceImpl extends ServiceImpl<EbikeCarri
|
||||
return this.mapper.selectOneByQuery(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新运营商配置
|
||||
*
|
||||
* @param dto 配置项参数
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void saveConfiguration(EbikeSaveConfigurationDto dto) {
|
||||
if (dto.getOperatorId() == null) {
|
||||
throw new EbikeException("保存配置时运营商id不能为空");
|
||||
Long staffId = StpUtil.getLoginIdAsLong();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.select(EBIKE_CARRIER_CONFIGURATION.ALL_COLUMNS)
|
||||
.and(EBIKE_CARRIER_CONFIGURATION.OPERATOR_ID.eq(dto.getOperatorId()));
|
||||
EbikeCarrierConfiguration config = this.mapper.selectOneByQuery(queryWrapper);
|
||||
// 保存
|
||||
if (config == null) {
|
||||
EbikeCarrierConfiguration configuration = EbikeCarrierConfiguration.builder()
|
||||
.operatorId(dto.getOperatorId())
|
||||
.dispatchDuration(dto.getDispatchDuration())
|
||||
.rideDuration(dto.getRideDuration())
|
||||
.inspectionIntervalDuration(dto.getInspectionIntervalDuration())
|
||||
.operatorPhone(dto.getOperatorPhone())
|
||||
.createdBy(staffId)
|
||||
.build();
|
||||
this.mapper.insert(configuration);
|
||||
} else {
|
||||
// 更新
|
||||
config.setOperatorId(dto.getOperatorId());
|
||||
config.setDispatchDuration(dto.getDispatchDuration());
|
||||
config.setRideDuration(dto.getRideDuration());
|
||||
config.setInspectionIntervalDuration(dto.getInspectionIntervalDuration());
|
||||
config.setOperatorPhone(dto.getOperatorPhone());
|
||||
config.setUpdatedBy(staffId);
|
||||
this.mapper.update(config);
|
||||
}
|
||||
EbikeCarrierConfiguration configuration = EbikeCarrierConfiguration.builder()
|
||||
.operatorId(dto.getOperatorId())
|
||||
.dispatchDuration(dto.getDispatchDuration())
|
||||
.rideDuration(dto.getRideDuration())
|
||||
.inspectionIntervalDuration(dto.getInspectionIntervalDuration())
|
||||
.operatorPhone(dto.getOperatorPhone())
|
||||
.createdBy(StpUtil.getLoginIdAsLong())
|
||||
.build();
|
||||
this.mapper.insert(configuration);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user