| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | /** |
| | | * 查询会员在本月有多少次享受了充电折扣 |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getChargingCount") |
| | | public R<Integer> getChargingCount(@RequestBody TChargingCountQuery req) { |
| | | int size = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getAppUserId, req.getUserId()) |
| | | .eq(TChargingOrder::getRechargePaymentStatus,2) |
| | | .between(TChargingOrder::getStartTime, req.getStartTime(), req.getEndTime())).size(); |
| | | return R.ok(size); |
| | | } |
| | | //用户订单数量 |
| | | @PostMapping(value = "/useOrderCount") |
| | | public R<Long> useOrderCount(@RequestParam Long userId) { |
| | | public R<Long> useOrderCount(@RequestParam("userId") Long userId) { |
| | | Long count = chargingOrderService.lambdaQuery().eq(TChargingOrder::getAppUserId, userId).count(); |
| | | |
| | | return R.ok(count); |
| | | } |
| | | |
| | | //订单详情 |
| | | @PostMapping(value = "/detail") |
| | | public R<TChargingOrder> detail(@RequestParam("orderId") Long orderId) { |
| | | return R.ok(chargingOrderService.getById(orderId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据充电枪id获取正在进行中的订单 |
| | | * @param chargingGunId 充电枪id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/getOrderDetailByGunId") |
| | | public R<TChargingOrder> getOrderDetailByGunId(@RequestParam("chargingGunId") Integer chargingGunId){ |
| | | TChargingOrder one = chargingOrderService.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, chargingGunId) |
| | | .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 3)); |
| | | return R.ok(one); |
| | | } |
| | | } |
| | | |