2026-01-09 09:42:43 +08:00
|
|
|
|
package com.cdzy.operations.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import com.cdzy.common.model.request.PageParam;
|
|
|
|
|
|
import com.cdzy.common.model.response.JsonResult;
|
|
|
|
|
|
import com.cdzy.operations.model.dto.EbikeSaveConfigurationDto;
|
|
|
|
|
|
import com.cdzy.operations.model.dto.EbikeUpdateConfigurationDto;
|
2026-02-28 11:16:18 +08:00
|
|
|
|
import com.cdzy.operations.model.entity.EbikeCarrierConfiguration;
|
|
|
|
|
|
import com.cdzy.operations.service.EbikeCarrierConfigurationService;
|
2026-01-09 09:42:43 +08:00
|
|
|
|
import com.mybatisflex.core.paginate.Page;
|
|
|
|
|
|
import com.mybatisflex.core.query.QueryWrapper;
|
|
|
|
|
|
import jakarta.annotation.Resource;
|
2026-02-27 11:07:01 +08:00
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
2026-01-09 09:42:43 +08:00
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
2026-02-28 11:16:18 +08:00
|
|
|
|
import static com.cdzy.operations.model.entity.table.EbikeCarrierConfigurationTableDef.EBIKE_CARRIER_CONFIGURATION;
|
|
|
|
|
|
|
2026-01-09 09:42:43 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-28 11:16:18 +08:00
|
|
|
|
* 运营商配置配置 控制层
|
2026-01-09 09:42:43 +08:00
|
|
|
|
*
|
|
|
|
|
|
* @author yanglei
|
|
|
|
|
|
* @since 2026-01-08 17:08
|
|
|
|
|
|
*/
|
|
|
|
|
|
@RestController
|
2026-02-28 11:16:18 +08:00
|
|
|
|
@RequestMapping("/ebikeCarrierConfiguration")
|
|
|
|
|
|
public class EbikeCarrierConfigurationController {
|
2026-01-09 09:42:43 +08:00
|
|
|
|
|
|
|
|
|
|
@Resource
|
2026-02-28 11:16:18 +08:00
|
|
|
|
private EbikeCarrierConfigurationService carrierConfigurationService;
|
2026-01-09 09:42:43 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 添加。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param dto 配置实体类
|
|
|
|
|
|
* @return 主键id
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("save")
|
2026-02-27 11:07:01 +08:00
|
|
|
|
public JsonResult<?> save(@RequestBody @Validated EbikeSaveConfigurationDto dto) {
|
2026-02-28 11:16:18 +08:00
|
|
|
|
carrierConfigurationService.saveConfiguration(dto);
|
2026-01-09 09:42:43 +08:00
|
|
|
|
return JsonResult.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据主键删除。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param configurationId 主键
|
|
|
|
|
|
* @return {@code true} 删除成功,{@code false} 删除失败
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("remove")
|
|
|
|
|
|
public JsonResult<?> remove(@RequestParam("configurationId") Long configurationId) {
|
2026-02-28 11:16:18 +08:00
|
|
|
|
carrierConfigurationService.removeById(configurationId);
|
2026-01-09 09:42:43 +08:00
|
|
|
|
return JsonResult.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据主键更新。
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param dto 配置实体类信息
|
|
|
|
|
|
* @return {@code true} 更新成功,{@code false} 更新失败
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("update")
|
2026-02-27 11:07:01 +08:00
|
|
|
|
public JsonResult<?> update(@RequestBody @Validated EbikeUpdateConfigurationDto dto) {
|
2026-02-28 11:16:18 +08:00
|
|
|
|
carrierConfigurationService.updateConfiguration(dto);
|
2026-01-09 09:42:43 +08:00
|
|
|
|
return JsonResult.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据主键id查询
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param configurationId 主键id
|
|
|
|
|
|
* @return 配置信息
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("getById")
|
|
|
|
|
|
public JsonResult<?> getById(@RequestParam("configurationId") Long configurationId) {
|
2026-02-28 11:16:18 +08:00
|
|
|
|
EbikeCarrierConfiguration result = carrierConfigurationService.getById(configurationId);
|
2026-01-09 09:42:43 +08:00
|
|
|
|
return JsonResult.success(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 分页查询
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param page 分页参数
|
|
|
|
|
|
* @return 配置信息
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("page")
|
|
|
|
|
|
public JsonResult<?> page(PageParam page) {
|
|
|
|
|
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
2026-02-28 11:16:18 +08:00
|
|
|
|
.select(EBIKE_CARRIER_CONFIGURATION.ALL_COLUMNS);
|
|
|
|
|
|
Page<EbikeCarrierConfiguration> orderPage = carrierConfigurationService.pageAs(page.getPage(), queryWrapper, EbikeCarrierConfiguration.class);
|
2026-01-09 09:42:43 +08:00
|
|
|
|
return JsonResult.success(orderPage);
|
|
|
|
|
|
}
|
2026-02-28 11:16:18 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据运营商id查询电话
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param operatorId 运营商id
|
|
|
|
|
|
* @return 运营商电话
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("getPhoneByOperatorId")
|
|
|
|
|
|
public JsonResult<?> getPhoneByOperatorId(@RequestParam("operatorId") Long operatorId) {
|
|
|
|
|
|
String operatorPhone = carrierConfigurationService.getPhoneByOperatorId(operatorId);
|
|
|
|
|
|
return JsonResult.success(operatorPhone);
|
|
|
|
|
|
}
|
2026-03-03 15:30:42 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据运营商id查询电话
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param bikeCode 车辆编码
|
|
|
|
|
|
* @return 运营商电话
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("/api/getPhoneByBikeCode")
|
|
|
|
|
|
public JsonResult<?> getPhoneByBikeCode(@RequestParam("bikeCode") String bikeCode) {
|
|
|
|
|
|
String operatorPhone = carrierConfigurationService.getPhoneByBikeCode(bikeCode);
|
|
|
|
|
|
return JsonResult.success((Object) operatorPhone);
|
|
|
|
|
|
}
|
2026-01-09 09:42:43 +08:00
|
|
|
|
}
|