| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserTagClient; |
| | | import com.ruoyi.account.api.model.TAppUserTag; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | |
| | | assertEquals("老用户", result.get(0).get("name")); |
| | | assertEquals(1L, result.get(0).get("value")); |
| | | } |
| | | |
| | | @Test |
| | | void franchiseeVehicleClassCountsOrdersInsteadOfDistinctVehicles() { |
| | | TAppUserCar privateCar = new TAppUserCar(); |
| | | privateCar.setId(1L); |
| | | privateCar.setVehicleUse("私家车"); |
| | | TAppUserCar companyCar = new TAppUserCar(); |
| | | companyCar.setId(2L); |
| | | companyCar.setVehicleUse("企业车"); |
| | | List<TChargingOrder> orders = new java.util.ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) { |
| | | TChargingOrder order = new TChargingOrder(); |
| | | order.setAppUserCarId(1L); |
| | | orders.add(order); |
| | | } |
| | | for (int i = 0; i < 3; i++) { |
| | | TChargingOrder order = new TChargingOrder(); |
| | | order.setAppUserCarId(2L); |
| | | orders.add(order); |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | List<java.util.Map<String, Object>> result = ReflectionTestUtils.invokeMethod( |
| | | new TChargingOrderController(), "franchiseeOrderCarGroup", orders, |
| | | Arrays.asList(privateCar, companyCar), |
| | | (java.util.function.Function<TAppUserCar, String>) TAppUserCar::getVehicleUse, |
| | | "未知用途", 5); |
| | | |
| | | assertEquals("私家车", result.get(0).get("name")); |
| | | assertEquals(10L, result.get(0).get("value")); |
| | | assertEquals("企业车", result.get(1).get("name")); |
| | | assertEquals(3L, result.get(1).get("value")); |
| | | } |
| | | } |