开始运营限制:配置了计费规则

This commit is contained in:
attiya 2025-10-24 16:07:43 +08:00
parent a6a0da11c7
commit 12e8ea9c09

View File

@ -1,6 +1,7 @@
package com.cdzy.operations.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.cdzy.common.ex.EbikeException;
import com.cdzy.common.model.request.PageParam;
import com.cdzy.common.model.response.JsonResult;
import com.cdzy.operations.enums.RegionStatus;
@ -131,6 +132,12 @@ public class EbikeRegionController {
*/
@GetMapping("commenceOperation")
public JsonResult<?> commenceOperation(@RequestParam Long regionId) {
QueryWrapper queryWrapper = QueryWrapper.create()
.where(EBIKE_DEFAULT_BILLING_CONFIGURATION.REGION_ID.eq(regionId));
EbikeDefaultBillingConfiguration configuration = defaultConfigurationService.getOne(queryWrapper);
if (configuration == null) {
throw new EbikeException("请配置计费规则后再开始运营");
}
UpdateChain.of(EbikeRegion.class)
.where(EbikeRegion::getRegionId).eq(regionId)
.set(EBIKE_REGION.STATUS, RegionStatus.OPERATION)