From c96fbe6b0aeb413a17c429133ee6d81d138144b9 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 09 六月 2026 10:58:52 +0800
Subject: [PATCH] Merge branch '1.0' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi into 1.0

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpStationManagementController.java |   90 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 67 insertions(+), 23 deletions(-)

diff --git a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpStationManagementController.java b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpStationManagementController.java
index 7e0e51a..ea35e76 100644
--- a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpStationManagementController.java
+++ b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpStationManagementController.java
@@ -2,6 +2,8 @@
 
 import cn.afterturn.easypoi.excel.ExcelExportUtil;
 import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.xiaopeng.api.model.operation.XpElectronicFence;
 import com.xiaopeng.api.model.operation.XpStation;
 import com.xiaopeng.api.query.operation.XpStationQuery;
 import com.xiaopeng.api.vo.account.LoginUser;
@@ -12,12 +14,15 @@
 import com.xiaopeng.common.core.web.page.PageInfo;
 import com.xiaopeng.common.security.service.TokenService;
 import com.xiaopeng.map.exportExcel.XpStationExportExcel;
+import com.xiaopeng.map.service.XpElectronicFenceService;
+import com.xiaopeng.map.service.XpPointService;
 import com.xiaopeng.map.service.XpStationService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.BeanUtils;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -45,13 +50,54 @@
 
     @Resource
     private TokenService tokenService;
+    @Resource
+    private XpPointService xpPointService;
+    @Resource
+    private XpElectronicFenceService xpElectronicFenceService;
+
+
+    @ApiOperation(value = "场站管理已经启动列表", tags = {"管理后台-运营-场站管理"})
+    @GetMapping("/findListEnable")
+    public R<List<XpStation>> findListByCityCode(@RequestParam String cityCode) {
+        XpStationQuery query = new XpStationQuery();
+        query.setCityCode(cityCode);
+        return R.ok( xpStationService.findList(query));
+    }
 
 
     @ApiOperation(value = "场站管理列表", tags = {"管理后台-运营-场站管理"})
+    @PostMapping("/findList")
+    public R<List<XpStation>> findList(@RequestBody XpStationQuery query) {
+        List<XpStation> list = xpStationService.findList(query);
+        return R.ok(list);
+    }
+
+    @ApiOperation(value = "场站管理分页列表", tags = {"管理后台-运营-场站管理"})
     @PostMapping("/pageList")
     public R<PageInfo<XpStation>> pageList(@RequestBody XpStationQuery query) {
         PageInfo<XpStation> pageList = xpStationService.pageList(query);
         return R.ok(pageList);
+    }
+
+    @GetMapping("/getById/{id}")
+    @ApiOperation(value = "详情场站管理", tags = {"管理后台-运营-场站管理"})
+    public R getById(@PathVariable Long id) {
+        XpStation bean = xpStationService.getById(id);
+        if (bean == null) {
+            return R.fail("参数错误");
+        }
+        XpStationVo beanVo = new XpStationVo();
+        BeanUtils.copyProperties(bean, beanVo);
+        beanVo.setXpPointList(xpPointService.listByStationId(bean.getId()));
+
+        XpElectronicFence electronicFence = xpElectronicFenceService.getById(bean.getElectronicId());
+
+        beanVo.setFenceEffectType(electronicFence.getEffectType());
+        beanVo.setFenceEffectTime(electronicFence.getEffectTime());
+        beanVo.setFenceFailureType(electronicFence.getFailureType());
+        beanVo.setFenceFailureTime(electronicFence.getFailureTime());
+
+        return R.ok(beanVo);
     }
 
     /**
@@ -66,11 +112,9 @@
         LoginUser loginUser = tokenService.getLoginUser();
 
         vo.setCreateBy(loginUser.getUsername());
-        vo.setUpdateBy(loginUser.getUsername());
         vo.setCreateTime(LocalDateTime.now());
-
+        vo.setUpdateBy(loginUser.getUsername());
         vo.setUpdateTime(LocalDateTime.now());
-
 
         return xpStationService.add(vo);
     }
@@ -84,11 +128,15 @@
         if(vo.getId() == null){
             return R.fail("参数错误");
         }
-        xpStationService.validate(vo);
         XpStation bean = xpStationService.getById(vo.getId());
         if(bean == null){
             return R.fail("参数错误");
         }
+        xpStationService.validate(vo);
+        //场站状态 0=草稿 1=待启用 2=启用中 3=已停用 4=失效
+//        if(bean.getStatus() == 2){
+//            return R.fail("场站在启动中不能编辑");
+//        }
 
         LoginUser loginUser = tokenService.getLoginUser();
 
@@ -106,18 +154,22 @@
      *       - 否:子点位维持当前状态,但自动退回为“独立点位”。
      */
     @ApiOperation(value = "停用" , tags = {"管理后台-运营-场站管理"})
-    @PostMapping("/updateStatus/{id}")
-    public R updateStatusStop(@PathVariable Long id, @RequestParam Boolean pointStop) {
+    @GetMapping("/updateStatus/{id}")
+    public R updateStatus(@PathVariable Long id, @RequestParam Boolean isEnable, @RequestParam Boolean pointStop) {
         XpStation bean = xpStationService.getById(id);
         if (bean == null) {
             throw new ServiceException("场站不存在,请刷新重试");
         }
-//        Integer status =6;
-//        if(!statusEnable){
-//            status = 7;
-//        }
-        //场站状态 0=草稿 1=待测试 2=测试中 3=测试不通过 4=可运营 5=待生效 6=启用中 7=已停用 8=失效
-        xpStationService.updateStatusStop(bean,pointStop);
+        if(isEnable){
+            xpStationService.updateStatusEnable(bean);
+        }else{
+//            if(bean.getStatus() == 2){//场站状态 0=草稿 1=待启用 2=启用中 3=已停用 4=失效
+//                return R.fail("场站状态启动中,不能停用");
+//            }
+            //场站状态 0=草稿 1=待测试 2=测试中 3=测试不通过 4=可运营 5=待生效 6=启用中 7=已停用 8=失效
+            xpStationService.updateStatusStop(bean,pointStop);
+        }
+
         return R.ok();
     }
     /**
@@ -137,18 +189,10 @@
         if (bean == null) {
             throw new ServiceException("场站不存在,请刷新重试");
         }
-        // 场站状态 0=草稿 1=待测试 2=测试中 3=测试不通过 4=可运营 5=待生效 6=启用中 7=已停用 8=失效
+        // 场站状态  0=草稿 1=待启用 2=启用中 3=已停用 4=失效
         // 只有状态为已停用(7)时才能删除
-        if (bean.getStatus() == 4 || bean.getStatus() == 5 || bean.getStatus() == 6) {
-            String msg = "";
-            if(bean.getStatus() == 4){
-                msg = "可运营";
-            }else if (bean.getStatus() == 5){
-                msg = "待生效";
-            }else {
-                msg = "启用中";
-            }
-            throw new ServiceException("场站"+msg+",无法删除");
+        if (bean.getStatus() == 2 ) {
+            throw new ServiceException("场站启用中,无法删除");
         }
         boolean b = xpStationService.removeById(bean,pointDelete);
         if (b){

--
Gitblit v1.7.1