| | |
| | | return AjaxResult.success(siteService.getSiteListGun()); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/chargingPile", "/chargingPile/select"}, logical = Logical.OR) |
| | | @RequiresPermissions(value = {"/site", "/chargingPile", "/chargingPile/select"}, logical = Logical.OR) |
| | | @GetMapping("/chargingPileFilterOptions") |
| | | @ApiOperation(value = "获取充电桩筛选级联选项", tags = {"管理后台-充电桩管理"}) |
| | | public AjaxResult<ChargingPileFilterOptionsDTO> getChargingPileFilterOptions() { |
| | |
| | | import com.ruoyi.chargingPile.service.TParkingRecordService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | @ApiOperation(tags = {"后台-停车场"},value = "添加停车场") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TParkingLotDTO dto) { |
| | | validateBarrierBrand(dto); |
| | | return AjaxResult.ok(parkingLotService.save(dto)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(tags = {"后台-停车场"},value = "修改停车场") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TParkingLotDTO dto) { |
| | | validateBarrierBrand(dto); |
| | | return AjaxResult.ok(parkingLotService.updateById(dto)); |
| | | } |
| | | |
| | | private void validateBarrierBrand(TParkingLotDTO dto) { |
| | | if (Integer.valueOf(1).equals(dto.getBarrierBrand()) && !Integer.valueOf(1).equals(dto.getType())) { |
| | | throw new ServiceException("顺捷道闸品牌仅支持直营停车场"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查看停车场详情 |
| | | */ |
| | |
| | | AND tas.audit_status = #{query.auditStatus} |
| | | </if> |
| | | <if test="query.partnerId != null"> |
| | | AND tas.partner_id = #{query.partnerId} |
| | | AND ( |
| | | tas.partner_id = #{query.partnerId} |
| | | OR EXISTS ( |
| | | SELECT 1 |
| | | FROM t_accounting_strategy audit_tas |
| | | WHERE audit_tas.parent_id = tas.id |
| | | AND audit_tas.partner_id = #{query.partnerId} |
| | | AND audit_tas.audit_status IN (1, 2, 4) |
| | | AND audit_tas.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND audit_tas.id = ( |
| | | SELECT latest_audit_tas.id |
| | | FROM t_accounting_strategy latest_audit_tas |
| | | WHERE latest_audit_tas.parent_id = tas.id |
| | | AND latest_audit_tas.audit_status IN (1, 2, 4) |
| | | AND latest_audit_tas.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | ORDER BY latest_audit_tas.create_time DESC, latest_audit_tas.id DESC |
| | | LIMIT 1 |
| | | ) |
| | | ) |
| | | ) |
| | | </if> |
| | | AND tas.site_id IS NULL |
| | | AND (tas.parent_id IS NULL OR tas.audit_status = 3 OR tas.audit_status = 4) |
| New file |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | import com.ruoyi.chargingPile.api.dto.TParkingLotDTO; |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import org.junit.jupiter.api.Test; |
| | | |
| | | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| | | import static org.junit.jupiter.api.Assertions.assertThrows; |
| | | import static org.mockito.Mockito.mock; |
| | | |
| | | class TParkingLotControllerTest { |
| | | |
| | | private final TParkingLotController controller = new TParkingLotController( |
| | | mock(TParkingLotService.class), |
| | | mock(TVehicleRampService.class), |
| | | mock(TCarportService.class) |
| | | ); |
| | | |
| | | @Test |
| | | void rejectsShunjieForCooperativeParkingLot() { |
| | | TParkingLotDTO dto = new TParkingLotDTO(); |
| | | dto.setType(2); |
| | | dto.setBarrierBrand(1); |
| | | |
| | | assertThrows(ServiceException.class, () -> controller.add(dto)); |
| | | } |
| | | |
| | | @Test |
| | | void allowsShunjieForDirectParkingLot() { |
| | | TParkingLotDTO dto = new TParkingLotDTO(); |
| | | dto.setType(1); |
| | | dto.setBarrierBrand(1); |
| | | |
| | | assertDoesNotThrow(() -> controller.add(dto)); |
| | | } |
| | | } |
| | |
| | | finishManualChargingRefund(tChargingOrder, chargingOrderRefund, manualRefundAmount, balanceRefundAmount, thirdRefundAmount); |
| | | } |
| | | else if (isIcbcOrder(tChargingOrder)) { |
| | | R shareRefund = refundIcbcShareBeforeMainRefund(tChargingOrder, chargingOrderRefund, thirdRefundAmount); |
| | | if (shareRefund.getCode() != 200) { |
| | | return shareRefund; |
| | | } |
| | | refundByIcbcAndFinish(tChargingOrder, chargingOrderRefund, thirdRefundAmount, "取消订单", true, |
| | | manualRefundAmount, balanceRefundAmount); |
| | | } |
| | |
| | | a.app_user_id |
| | | FROM |
| | | charging_pile_order.t_charging_order a |
| | | where a.recharge_payment_status = 2 |
| | | where (a.recharge_payment_status = 2 OR #{data.invoiceId} IS NOT NULL) |
| | | |
| | | UNION ALL |
| | | |
| | |
| | | a.app_user_id |
| | | FROM |
| | | charging_pile_order.t_shopping_order a |
| | | where a.payment_status = 2 |
| | | where (a.payment_status = 2 OR #{data.invoiceId} IS NOT NULL) |
| | | |
| | | UNION ALL |
| | | |
| | |
| | | a.app_user_id |
| | | FROM |
| | | charging_pile_order.t_vip_order a |
| | | where a.payment_status = 2 |
| | | where (a.payment_status = 2 OR #{data.invoiceId} IS NOT NULL) |
| | | |
| | | UNION ALL |
| | | |
| | |
| | | </if> |
| | | |
| | | </where> |
| | | ORDER BY o.create_time desc |
| | | ORDER BY COALESCE(o.pay_time, o.create_time, o.end_time) DESC, o.create_time DESC, o.id DESC |
| | | |
| | | </select> |
| | | <select id="getRefundList" resultType="com.ruoyi.order.api.model.TChargingOrderRefund"> |
| | |
| | | } |
| | | |
| | | @Test |
| | | void invoiceOrderViewRetainsLinkedOrdersAfterPaymentStatusChanges() throws IOException { |
| | | InputStream input = getClass().getClassLoader() |
| | | .getResourceAsStream("mapper/order/TChargingOrderMapper.xml"); |
| | | assertNotNull(input); |
| | | |
| | | String mapper; |
| | | try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) { |
| | | mapper = reader.lines().collect(Collectors.joining("\n")); |
| | | } |
| | | |
| | | String payOrderQuery = mapper.substring( |
| | | mapper.indexOf("<select id=\"payOrderQuery\""), |
| | | mapper.indexOf("<select id=\"getRefundList\"")); |
| | | assertEquals(3, countOccurrences(payOrderQuery, "#{data.invoiceId} IS NOT NULL")); |
| | | assertTrue(payOrderQuery.contains("a.recharge_payment_status = 2 OR #{data.invoiceId} IS NOT NULL")); |
| | | assertEquals(2, countOccurrences(payOrderQuery, |
| | | "a.payment_status = 2 OR #{data.invoiceId} IS NOT NULL")); |
| | | } |
| | | |
| | | @Test |
| | | void paymentOrderListUsesLatestPaymentTimeAsItsDefaultSort() throws IOException { |
| | | InputStream input = getClass().getClassLoader() |
| | | .getResourceAsStream("mapper/order/TChargingOrderMapper.xml"); |
| | | assertNotNull(input); |
| | | |
| | | String mapper; |
| | | try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) { |
| | | mapper = reader.lines().collect(Collectors.joining("\n")); |
| | | } |
| | | |
| | | String payOrderQuery = mapper.substring( |
| | | mapper.indexOf("<select id=\"payOrderQuery\""), |
| | | mapper.indexOf("<select id=\"getRefundList\"")); |
| | | assertTrue(payOrderQuery.contains( |
| | | "ORDER BY COALESCE(o.pay_time, o.create_time, o.end_time) DESC, o.create_time DESC, o.id DESC")); |
| | | } |
| | | |
| | | @Test |
| | | void refundListAppliesPartnerSiteScopeInsidePagedQuery() throws IOException { |
| | | InputStream input = getClass().getClassLoader() |
| | | .getResourceAsStream("mapper/order/TChargingOrderMapper.xml"); |