| | |
| | | import com.xiaopeng.api.dto.operation.PointUpdateDto; |
| | | import com.xiaopeng.api.dto.operation.XpPointEnableDisableDto; |
| | | import com.xiaopeng.api.model.map.XpTestPoint; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFence; |
| | | import com.xiaopeng.api.model.operation.XpElectronicFenceArea; |
| | | import com.xiaopeng.api.model.operation.XpTestElectronicFence; |
| | | import com.xiaopeng.api.model.operation.XpTestElectronicFenceArea; |
| | | import com.xiaopeng.api.model.operation.XpTestElectronicFenceArea; |
| | | import com.xiaopeng.api.query.operation.PointListQuery; |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.api.vo.map.QueryTestPoint; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import com.xiaopeng.map.dto.XpPointSpecialDto; |
| | | import com.xiaopeng.map.service.XpElectronicFenceAreaService; |
| | | import com.xiaopeng.map.service.XpElectronicFenceService; |
| | | import com.xiaopeng.map.service.XpTestPointService; |
| | | import com.xiaopeng.map.service.*; |
| | | import com.xiaopeng.map.vo.SpecialPointListVo; |
| | | import com.xiaopeng.map.vo.SpecialPointVo; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | @Resource |
| | | private XpTestPointService xpTestPointService; |
| | | @Resource |
| | | private XpElectronicFenceAreaService xpElectronicFenceAreaService; |
| | | private XpTestElectronicFenceAreaService xpElectronicFenceAreaService; |
| | | @Resource |
| | | private XpElectronicFenceService xpElectronicFenceService; |
| | | private XpTestElectronicFenceService xpElectronicFenceService; |
| | | |
| | | |
| | | @ApiOperation(value = "获取所有运营中的区域", response = XpElectronicFenceArea.class) |
| | | @ApiOperation(value = "获取所有运营中的区域", response = XpTestElectronicFenceArea.class) |
| | | @PostMapping("/api/v1/testPoint/listElectronicFenceArea") |
| | | public R<List<XpElectronicFenceArea>> listElectronicFenceArea() { |
| | | public R<List<XpTestElectronicFenceArea>> listElectronicFenceArea() { |
| | | // 获取所有启用的电子围栏 |
| | | List<XpElectronicFence> electronicFences = xpElectronicFenceService.lambdaQuery().eq(XpElectronicFence::getStatus, 2).list(); |
| | | List<Long> electronicFenceIds = electronicFences.stream().map(XpElectronicFence::getId).collect(Collectors.toList()); |
| | | List<XpTestElectronicFence> electronicFences = xpElectronicFenceService.lambdaQuery().eq(XpTestElectronicFence::getStatus, 2).list(); |
| | | List<Long> electronicFenceIds = electronicFences.stream().map(XpTestElectronicFence::getId).collect(Collectors.toList()); |
| | | if (electronicFenceIds.isEmpty()) { |
| | | return R.ok(new ArrayList<XpElectronicFenceArea>()); |
| | | return R.ok(new ArrayList<XpTestElectronicFenceArea>()); |
| | | } |
| | | // 获取电子围栏下启用的运营区域 |
| | | List<XpElectronicFenceArea> electronicFenceAreaList = xpElectronicFenceAreaService.lambdaQuery().in(XpElectronicFenceArea::getElectronicId, electronicFenceIds) |
| | | .eq(XpElectronicFenceArea::getAreaStatus, 1).list(); |
| | | List<XpTestElectronicFenceArea> electronicFenceAreaList = xpElectronicFenceAreaService.lambdaQuery().in(XpTestElectronicFenceArea::getTestElectronicId, electronicFenceIds) |
| | | .eq(XpTestElectronicFenceArea::getAreaStatus, 1).list(); |
| | | return R.ok(electronicFenceAreaList); |
| | | } |
| | | |
| | |
| | | @PostMapping("/api/v1/testPoint/addPoint") |
| | | @ResponseBody |
| | | @ApiOperation(value = "新增点位") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.TEST_POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.ADD, |
| | | content = "新增测试demo点位", |
| | | appendRequestData = true |
| | | ) |
| | | public R add(@Validated @RequestBody PointAddDto pointAddDto) { |
| | | XpTestPoint xpPoint = new XpTestPoint(); |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | |
| | | @GetMapping("/api/v1/testPoint/deletePoint") |
| | | @ResponseBody |
| | | @ApiOperation(value = "删除点位") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.TEST_POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.DELETE, |
| | | contentExpression = "'删除测试demo点位,ids=' + #p0", |
| | | appendRequestData = false |
| | | ) |
| | | public R deletePoint(@RequestParam("ids") String ids) { |
| | | xpTestPointService.removeBatchByIds(Arrays.stream(ids.split(",")) |
| | | .map(Long::parseLong).collect(Collectors.toList())); |
| | |
| | | */ |
| | | @PostMapping("/api/v1/testPoint/editPoint") |
| | | @ApiOperation(value = "编辑点位") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.TEST_POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "编辑测试demo点位", |
| | | appendRequestData = true |
| | | ) |
| | | public R edit(@Validated @RequestBody PointUpdateDto pointAddDto) { |
| | | XpTestPoint xpPoint = new XpTestPoint(); |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | |
| | | */ |
| | | @PostMapping("/api/v1/testPoint/enableDisablePoint") |
| | | @ApiOperation(value = "启用/禁用") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.TEST_POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.SWITCH_STATUS, |
| | | content = "启用/禁用测试demo点位", |
| | | appendRequestData = true |
| | | ) |
| | | public R enableDisable(@RequestBody XpPointEnableDisableDto dto) { |
| | | XpTestPoint xpPoint = xpTestPointService.getById(dto.getId()); |
| | | xpPoint.setOperationStatus(dto.getOperationStatus()); |
| | |
| | | */ |
| | | @PostMapping("/api/v1/testPoint/setSpecialPoint") |
| | | @ApiOperation(value = "设置特殊点位", tags = "后台管理-特殊点位") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.TEST_SPECIAL_POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "设置测试demo特殊点位", |
| | | appendRequestData = true |
| | | ) |
| | | public R setSpecialPoint(@RequestBody XpPointSpecialDto dto) { |
| | | xpTestPointService.update(new LambdaUpdateWrapper<XpTestPoint>().set(XpTestPoint::getChargePoint, 0) |
| | | .set(XpTestPoint::getParkingPoint, 0)); |
| | |
| | | List<XpTestPoint> xpTestPoints = xpTestPointService.listByIds(query.getIds()); |
| | | return R.ok(xpTestPoints); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑点位 |
| | | * @param xpPoint |
| | | * @return |
| | | */ |
| | | @PostMapping("/logan/inner/v1/testPoint/editTestPoint") |
| | | public R<?> editXpPoint(@RequestBody XpTestPoint xpPoint){ |
| | | xpTestPointService.updateById(xpPoint); |
| | | return R.ok(); |
| | | } |
| | | } |