| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.xiaopeng.api.dto.map.XpPointExportExcelQuery; |
| | | import com.xiaopeng.api.dto.operation.PointAddDto; |
| | |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceAreaService; |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceService; |
| | | import com.xiaopeng.operation.service.XpPointService; |
| | | import com.xiaopeng.operation.vo.SpecialPointListVo; |
| | | import com.xiaopeng.operation.vo.SpecialPointVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @GetMapping("/deletePoint") |
| | | @ResponseBody |
| | | @ApiOperation(value = "删除点位") |
| | | |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | public R deletePoint(@RequestParam("ids") String ids) { |
| | | xpPointService.removeBatchByIds(Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList())); |
| | | return R.ok(); |
| | |
| | | */ |
| | | @PostMapping("/enableDisablePoint") |
| | | @ApiOperation(value = "启用/禁用") |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | public R enableDisable(@RequestBody XpPointEnableDisableDto dto) { |
| | | XpPoint xpPoint = xpPointService.getById(dto.getId()); |
| | | xpPoint.setOperationStatus(dto.getOperationStatus()); |
| | | xpPoint.setElectronicAreaId(null); |
| | | xpPointService.updateById(xpPoint); |
| | | return R.ok(); |
| | | } |
| | |
| | | * 设置特殊点位 |
| | | */ |
| | | @PostMapping("/setSpecialPoint") |
| | | @ApiOperation(value = "设置特殊点位") |
| | | @ApiOperation(value = "设置特殊点位",tags = "后台管理-特殊点位") |
| | | public R setSpecialPoint(@RequestBody XpPointSpecialDto dto) { |
| | | xpPointService.update(new LambdaUpdateWrapper<XpPoint>().set(XpPoint::getChargePoint, 0).set(XpPoint::getParkingPoint,0)); |
| | | xpPointService.update(new LambdaUpdateWrapper<XpPoint>().in(XpPoint::getId,dto.getChargePoints()).set(XpPoint::getChargePoint,1)); |
| | | xpPointService.update(new LambdaUpdateWrapper<XpPoint>().in(XpPoint::getId,dto.getParkingPoints()).set(XpPoint::getParkingPoint,2)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/listSpecialPoint") |
| | | @ApiOperation(value = "获取特殊点位",tags = "后台管理-特殊点位") |
| | | public R<SpecialPointVo> getSpecialPoint() { |
| | | List<XpPoint> chargePoints = xpPointService.list(new LambdaQueryWrapper<XpPoint>().eq(XpPoint::getChargePoint, 1)); |
| | | List<XpPoint> parkingPoints = xpPointService.list(new LambdaQueryWrapper<XpPoint>().eq(XpPoint::getParkingPoint, 1)); |
| | | |
| | | SpecialPointVo specialPointVo = new SpecialPointVo(); |
| | | ArrayList<SpecialPointListVo> chargePointsList = new ArrayList<>(); |
| | | for (XpPoint chargePoint : chargePoints) { |
| | | SpecialPointListVo specialPointListVo = new SpecialPointListVo(); |
| | | specialPointListVo.setPointName(chargePoint.getPointName()); |
| | | specialPointListVo.setPointAddress(chargePoint.getPointAddress()); |
| | | specialPointListVo.setPointId(chargePoint.getId()); |
| | | chargePointsList.add(specialPointListVo); |
| | | } |
| | | specialPointVo.setChargePoints(chargePointsList); |
| | | |
| | | |
| | | ArrayList<SpecialPointListVo> parkingPointsList = new ArrayList<>(); |
| | | for (XpPoint parkingPoint : parkingPoints) { |
| | | SpecialPointListVo specialPointListVo = new SpecialPointListVo(); |
| | | specialPointListVo.setPointName(parkingPoint.getPointName()); |
| | | specialPointListVo.setPointAddress(parkingPoint.getPointAddress()); |
| | | specialPointListVo.setPointId(parkingPoint.getId()); |
| | | parkingPointsList.add(specialPointListVo); |
| | | } |
| | | specialPointVo.setParkingPoints(parkingPointsList); |
| | | |
| | | return R.ok(specialPointVo); |
| | | } |
| | | } |