| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | |
| | | public R<List<TVinManagement>> listByCompany(@RequestParam("companyId") Integer companyId) { |
| | | return R.ok(service.listByCompany(companyId)); |
| | | } |
| | | |
| | | /** |
| | | * 内部接口:锁定VIN账户余额(VIN码充电申请,分配模式实扣冻结:余额立即扣减并计入锁定金额) |
| | | */ |
| | | @PostMapping("/inner/lock-balance") |
| | | public R<BigDecimal> lockBalance(@RequestParam("vinId") Long vinId, @RequestParam("amount") BigDecimal amount) { |
| | | try { |
| | | return R.ok(service.lockBalance(vinId, amount)); |
| | | } catch (RuntimeException ex) { |
| | | return R.fail(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 内部接口:结算VIN账户余额(解锁锁定额并按实际消费扣减,允许扣成负数) |
| | | */ |
| | | @PostMapping("/inner/settle-balance") |
| | | public R<BigDecimal> settleBalance(@RequestParam("vinId") Long vinId, |
| | | @RequestParam("lockedAmount") BigDecimal lockedAmount, |
| | | @RequestParam("actualAmount") BigDecimal actualAmount) { |
| | | try { |
| | | return R.ok(service.settleBalance(vinId, lockedAmount, actualAmount)); |
| | | } catch (RuntimeException ex) { |
| | | return R.fail(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 内部接口:释放VIN锁定金额(未产生消费时使用) |
| | | */ |
| | | @PostMapping("/inner/unlock-balance") |
| | | public R<BigDecimal> unlockBalance(@RequestParam("vinId") Long vinId, @RequestParam("amount") BigDecimal amount) { |
| | | try { |
| | | return R.ok(service.unlockBalance(vinId, amount)); |
| | | } catch (RuntimeException ex) { |
| | | return R.fail(ex.getMessage()); |
| | | } |
| | | } |
| | | } |