| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.account.api.dto.ChargingCardAuthDTO; |
| | | import com.ruoyi.account.api.dto.ChargingCardBalanceDTO; |
| | | import com.ruoyi.account.api.dto.ChargingCardDeductDTO; |
| | | import com.ruoyi.account.api.dto.ChargingCardExcelDTO; |
| | | import com.ruoyi.account.api.dto.ChargingCardQueryDTO; |
| | | import com.ruoyi.account.api.dto.ChargingCardSaveDTO; |
| | | import com.ruoyi.account.api.dto.ChargingCardStatusDTO; |
| | | import com.ruoyi.account.api.model.TChargingCard; |
| | | import com.ruoyi.account.api.vo.ChargingCardDeductVO; |
| | | import com.ruoyi.account.service.TChargingCardService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | List<ChargingCardExcelDTO> cards = util.importExcel(file.getInputStream()); |
| | | return R.ok(chargingCardService.importCards(cards)); |
| | | } |
| | | |
| | | // ==================== 内部接口(刷卡充电链路,订单服务调用,V0.2 定稿) ==================== |
| | | |
| | | @ApiOperation(value = "刷卡启动鉴权(内部):卡片配置密码时才校验密码") |
| | | @PostMapping("/inner/verify-charging") |
| | | public R<TChargingCard> verifyCharging(@RequestBody ChargingCardAuthDTO dto) { |
| | | return R.ok(chargingCardService.verifyCardForCharging(dto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "锁定卡片为充电中(内部):返回 false 表示同卡已有进行中订单") |
| | | @PostMapping("/inner/lock-charging") |
| | | public R<Boolean> lockForCharging(@RequestParam("cardId") Long cardId, |
| | | @RequestParam("orderCode") String orderCode) { |
| | | return R.ok(chargingCardService.lockCardForCharging(cardId, orderCode)); |
| | | } |
| | | |
| | | @ApiOperation(value = "解锁卡片(内部):订单终态后调用,带订单号比对") |
| | | @PostMapping("/inner/unlock-charging") |
| | | public R<Boolean> unlockForCharging(@RequestParam("cardId") Long cardId, |
| | | @RequestParam("orderCode") String orderCode) { |
| | | return R.ok(chargingCardService.unlockCardForCharging(cardId, orderCode)); |
| | | } |
| | | |
| | | @ApiOperation(value = "刷卡订单结算扣款(内部):订单号幂等、允许扣成负余额") |
| | | @PostMapping("/inner/deduct-charging") |
| | | public R<ChargingCardDeductVO> deductForCharging(@RequestBody ChargingCardDeductDTO dto) { |
| | | return R.ok(chargingCardService.deductBalanceForCharging(dto)); |
| | | } |
| | | } |