| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * 新增点位 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @PostMapping("/addPoint") |
| | | @ResponseBody |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | @ApiOperation(value = "新增点位") |
| | | // @Transactional |
| | | // @ShardingSphereTransactionType(TransactionType.BASE) |
| | | public R add(@Validated @RequestBody PointAddDto pointAddDto) { |
| | | XpPoint xpPoint = new XpPoint(); |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | |
| | | @GetMapping("/deletePoint") |
| | | @ResponseBody |
| | | @ApiOperation(value = "删除点位") |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | // @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("/editPoint") |
| | | @ApiOperation(value = "编辑点位") |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | // @Transactional |
| | | // @ShardingSphereTransactionType(TransactionType.BASE) |
| | | public R edit(@Validated@RequestBody PointUpdateDto pointAddDto) { |
| | | XpPoint xpPoint = new XpPoint(); |
| | | BeanUtils.copyProperties(pointAddDto, xpPoint); |
| | |
| | | */ |
| | | @PostMapping("/enableDisablePoint") |
| | | @ApiOperation(value = "启用/禁用") |
| | | @Transactional |
| | | @ShardingSphereTransactionType(TransactionType.BASE) |
| | | // @Transactional |
| | | // @ShardingSphereTransactionType(TransactionType.BASE) |
| | | public R enableDisable(@RequestBody XpPointEnableDisableDto dto) { |
| | | XpPoint xpPoint = xpPointService.getById(dto.getId()); |
| | | xpPoint.setOperationStatus(dto.getOperationStatus()); |
| | |
| | | @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)); |
| | | List<XpPoint> list = xpPointService.list(new LambdaQueryWrapper<XpPoint>().in(XpPoint::getId, dto.getChargePoints())); |
| | | list.forEach(e->{ |
| | | e.setChargePoint(1); |
| | | e.setElectronicAreaId(null); |
| | | }); |
| | | xpPointService.updateBatchById(list); |
| | | List<XpPoint> list1 = xpPointService.list(new LambdaQueryWrapper<XpPoint>().in(XpPoint::getId, dto.getParkingPoints())); |
| | | list1.forEach(e->{ |
| | | e.setParkingPoint(1); |
| | | e.setElectronicAreaId(null); |
| | | }); |
| | | xpPointService.updateBatchById(list1); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/listSpecialPoint") |
| | | @GetMapping("/listSpecialPoint") |
| | | @ApiOperation(value = "获取特殊点位",tags = "后台管理-特殊点位") |
| | | public R<SpecialPointVo> getSpecialPoint() { |
| | | List<XpPoint> chargePoints = xpPointService.list(new LambdaQueryWrapper<XpPoint>().eq(XpPoint::getChargePoint, 1)); |