| | |
| | | } |
| | | |
| | | /** |
| | | * 通过站点id查询当前时间段计费策略展示 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过枪id查询当前时间段计费策略展示") |
| | | @GetMapping(value = "/queryStrategyByGunIdAndTime") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryStrategyByGunIdAndTime(@RequestParam("gunId") Integer gunId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryStrategyByGunIdAndTime(gunId)); |
| | | } |
| | | |
| | | /** |
| | | * 价格说明金额返回,会员开通金额说明 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "价格说明金额返回,会员开通金额说明") |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取当前有效的计费模板 |
| | | * @param accountingStrategyId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getNowData") |
| | | public R<TAccountingStrategyDetail> getNowData(@RequestParam("accountingStrategyId") Integer accountingStrategyId){ |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(new LambdaQueryWrapper<TAccountingStrategyDetail>() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategyId) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过站点id查询当前时段使用的策略明细 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getDetailBySiteId") |
| | | @GetMapping("/getDetailBySiteId") |
| | | public R<TAccountingStrategyDetail> getDetailBySiteId(@RequestParam("siteId") Integer siteId){ |
| | | Site site = siteService.getById(siteId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | |
| | | * @param code 设备编号 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getDetailByCode") |
| | | public R<TAccountingStrategyDetail> getDetailByPileId(@RequestParam("code") String code){ |
| | | @GetMapping("/getDetailByCode") |
| | | public R<TAccountingStrategyDetail> getDetailByCode(@RequestParam("code") String code){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,code) |
| | |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(dto.getStrategyDetailId().equals(one.getId())); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据计费策略主表id策略明细 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/getListByAccountingStrategyId") |
| | | public R<List<TAccountingStrategyDetail>> getListByAccountingStrategyId(@RequestParam("id") Integer id){ |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.list(new LambdaQueryWrapper<TAccountingStrategyDetail>().eq(TAccountingStrategyDetail::getAccountingStrategyId, id)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * 通过桩编号查询当前使用的策略明细列表 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDetailListByCode") |
| | | public R<List<TAccountingStrategyDetail>> getDetailListByCode(@RequestParam("code") String code){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,code) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingPile)){ |
| | | return R.fail("未查询到该桩设备"); |
| | | } |
| | | Site site = siteService.getById(chargingPile.getSiteId()); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailService.list(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId())); |
| | | return R.ok(accountingStrategyDetails); |
| | | } |
| | | } |
| | | |