From 154dd2fd8e28477c44ad7b48ededa00903df5319eac67d3837c3b2b62f9d949c Mon Sep 17 00:00:00 2001 From: attiya <2413103649@qq.com> Date: Wed, 22 Oct 2025 15:07:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E5=9F=BA=E7=A1=80=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EbikeRegionController.java | 38 ++++++++++++++++++- .../handler/PGpolygonSerializer.java | 3 -- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/ebike-operations/src/main/java/com/cdzy/operations/controller/EbikeRegionController.java b/ebike-operations/src/main/java/com/cdzy/operations/controller/EbikeRegionController.java index f10794d..84c9c7b 100644 --- a/ebike-operations/src/main/java/com/cdzy/operations/controller/EbikeRegionController.java +++ b/ebike-operations/src/main/java/com/cdzy/operations/controller/EbikeRegionController.java @@ -1,12 +1,15 @@ package com.cdzy.operations.controller; +import cn.dev33.satoken.stp.StpUtil; import com.cdzy.common.model.request.PageParam; import com.cdzy.common.model.response.JsonResult; +import com.cdzy.operations.enums.RegionStatus; import com.cdzy.operations.model.entity.EbikeRegion; import com.cdzy.operations.model.vo.EbikeRegionVo; import com.cdzy.operations.service.EbikeRegionService; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.core.update.UpdateChain; import com.mybatisflex.core.util.StringUtil; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -60,7 +63,7 @@ public class EbikeRegionController { * @param ebikeRegion 运营区域表 * @return {@code true} 更新成功,{@code false} 更新失败 */ - @PutMapping("update") + @PostMapping("update") public JsonResult update(@RequestBody EbikeRegionVo ebikeRegion) { ebikeRegionService.update(ebikeRegion); return JsonResult.success(); @@ -106,4 +109,37 @@ public class EbikeRegionController { return JsonResult.success(page); } + + /** + * 开始运营。 + * + * @param regionId 运营区主键 + * @return 分页对象 + */ + @GetMapping("commenceOperation") + public JsonResult commenceOperation(@RequestParam Long regionId) { + UpdateChain.of(EbikeRegion.class) + .where(EbikeRegion::getRegionId).eq(regionId) + .set(EBIKE_REGION.STATUS, RegionStatus.OPERATION) + .set(EBIKE_REGION.UPDATED_BY, StpUtil.getLoginIdAsLong()) + .update(); + return JsonResult.success(); + } + + /** + * 结束运营。 + * + * @param regionId 运营区主键 + * @return 分页对象 + */ + @GetMapping("stopOperation") + public JsonResult stopOperation(@RequestParam Long regionId) { + UpdateChain.of(EbikeRegion.class) + .where(EbikeRegion::getRegionId).eq(regionId) + .set(EBIKE_REGION.STATUS, RegionStatus.STOP_OPERATION) + .set(EBIKE_REGION.UPDATED_BY, StpUtil.getLoginIdAsLong()) + .update(); + return JsonResult.success(); + } + } diff --git a/ebike-operations/src/main/java/com/cdzy/operations/handler/PGpolygonSerializer.java b/ebike-operations/src/main/java/com/cdzy/operations/handler/PGpolygonSerializer.java index 9f7713e..fe1b39d 100644 --- a/ebike-operations/src/main/java/com/cdzy/operations/handler/PGpolygonSerializer.java +++ b/ebike-operations/src/main/java/com/cdzy/operations/handler/PGpolygonSerializer.java @@ -41,8 +41,6 @@ public class PGpolygonSerializer extends JsonSerializer { for (int i = 0; i < points.length; i++) { if (points[i] == null) { log.error("错误: 第 {} 个点为 null", i); - } else { - log.info("点 {}: ({}, {})", i, points[i].x, points[i].y); } } @@ -119,7 +117,6 @@ public class PGpolygonSerializer extends JsonSerializer { Object pointsObj = pointsField.get(polygon); if (pointsObj instanceof PGpoint[] points) { - log.info("反射成功,获取到 {} 个点", points.length); return points; } else { log.error("反射获取的 points 字段类型不正确: {}", pointsObj != null ? pointsObj.getClass() : "null");