| | |
| | | import java.util.Objects; |
| | | import java.util.function.Function; |
| | | 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 |
| | |
| | | |
| | | @ApiOperation(value = "点位导出") |
| | | @PostMapping("/exportExcel") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.EXPORT, |
| | | content = "导出正式点位", |
| | | appendRequestData = true |
| | | ) |
| | | public void exportExcel(@RequestBody XpPointExportExcelQuery query) { |
| | | List<Long> pointIds = query == null ? Collections.emptyList() : query.getPointIds(); |
| | | List<Long> distinctIds = pointIds == null |
| | |
| | | @PostMapping("/add") |
| | | @ResponseBody |
| | | @ApiOperation(value = "新增点位") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.ADD, |
| | | content = "新增正式点位", |
| | | appendRequestData = true |
| | | ) |
| | | public R<?> add(@Validated @RequestBody PointAddDto pointAddDto) { |
| | | if (xpGeoFencingPolygonService.isInFence(pointAddDto.getPointLon(), pointAddDto.getPointLat(), pointAddDto.getFenceId(), "prohibited_area")) { |
| | | return R.ok("in_prohibited_area"); |
| | |
| | | @GetMapping("/deletePoint") |
| | | @ResponseBody |
| | | @ApiOperation(value = "删除点位") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.DELETE, |
| | | contentExpression = "'删除正式点位,ids=' + #p0", |
| | | appendRequestData = false |
| | | ) |
| | | public R deletePoint(@RequestParam("ids") String ids) { |
| | | List<Long> pointIds = Arrays.stream(ids.split(",")) |
| | | .map(String::trim) |
| | |
| | | @ApiOperation(value = "编辑点位") |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "编辑正式点位", |
| | | appendRequestData = true |
| | | ) |
| | | public R edit(@Validated @RequestBody PointUpdateDto pointAddDto) { |
| | | XpPoint xpPoint = xpPointService.getById(pointAddDto.getId()); |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | | if (xpPoint == null) { |
| | | throw new ServiceException("系统异常", I18nKeyConstant.SYSTEM_EXCEPTION); |
| | | } |
| | | xpPointService.validatePointNameUnique(pointAddDto.getPointName(), pointAddDto.getId()); |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | | if (Integer.valueOf(2).equals(pointAddDto.getOperationStatus()) && Integer.valueOf(5).equals(pointAddDto.getVerificationStatus())) { |
| | | Long electronicAreaId = xpPoint.getElectronicAreaId(); |
| | | if (electronicAreaId == null) { |
| | |
| | | } |
| | | } |
| | | xpPoint.setFpElectronicAreaId(null); |
| | | xpPointService.updateById(xpPoint); |
| | | // 使用 lambdaUpdate 确保 pointPictures 为 null 时也能将数据库字段清空 |
| | | // (updateById 默认策略 NOT_NULL 会跳过 null 值,导致删除图片后数据库仍保留旧图片) |
| | | xpPointService.lambdaUpdate() |
| | | .eq(XpPoint::getId, xpPoint.getId()) |
| | | .set(XpPoint::getPointName, xpPoint.getPointName()) |
| | | .set(XpPoint::getPointPoi, xpPoint.getPointPoi()) |
| | | .set(XpPoint::getPointNumber, xpPoint.getPointNumber()) |
| | | .set(XpPoint::getOperationStatus, xpPoint.getOperationStatus()) |
| | | .set(XpPoint::getPointType, xpPoint.getPointType()) |
| | | .set(XpPoint::getVerificationStatus, xpPoint.getVerificationStatus()) |
| | | .set(XpPoint::getParkingTimeLimit, xpPoint.getParkingTimeLimit()) |
| | | .set(XpPoint::getOperationType, xpPoint.getOperationType()) |
| | | .set(XpPoint::getEffectivePeriod, xpPoint.getEffectivePeriod()) |
| | | .set(XpPoint::getEffectiveTimePeriod, xpPoint.getEffectiveTimePeriod()) |
| | | .set(XpPoint::getPointAddress, xpPoint.getPointAddress()) |
| | | .set(XpPoint::getRemarks, xpPoint.getRemarks()) |
| | | .set(XpPoint::getPointPictures, xpPoint.getPointPictures()) |
| | | .set(XpPoint::getPointLon, xpPoint.getPointLon()) |
| | | .set(XpPoint::getPointLat, xpPoint.getPointLat()) |
| | | .set(XpPoint::getElectronicAreaId, xpPoint.getElectronicAreaId()) |
| | | .set(XpPoint::getChargePoint, xpPoint.getChargePoint()) |
| | | .set(XpPoint::getParkingPoint, xpPoint.getParkingPoint()) |
| | | .set(XpPoint::getProvinceName, xpPoint.getProvinceName()) |
| | | .set(XpPoint::getProvinceCode, xpPoint.getProvinceCode()) |
| | | .set(XpPoint::getCityCode, xpPoint.getCityCode()) |
| | | .set(XpPoint::getCityName, xpPoint.getCityName()) |
| | | .set(XpPoint::getDistrictName, xpPoint.getDistrictName()) |
| | | .set(XpPoint::getDistrictCode, xpPoint.getDistrictCode()) |
| | | .update(); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/enableDisable") |
| | | @ApiOperation(value = "启用/禁用") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.POINT_MANAGEMENT, |
| | | operationType = AdminOperationType.SWITCH_STATUS, |
| | | content = "启用/禁用正式点位", |
| | | appendRequestData = true |
| | | ) |
| | | public R enableDisable(@RequestBody XpPointEnableDisableDto dto) { |
| | | XpPoint xpPoint = xpPointService.getById(dto.getId()); |
| | | xpPoint.setOperationStatus(dto.getOperationStatus()); |