diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java index c4cdf9a86..05f984a7c 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessStationInfoController.java @@ -3,15 +3,20 @@ package com.jsowell.api.uniapp.business; import com.alibaba.fastjson2.JSONObject; import com.google.common.collect.ImmutableMap; import com.jsowell.common.core.controller.BaseController; +import com.jsowell.common.core.page.TableDataInfo; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.response.RestApiResponse; +import com.jsowell.common.util.StringUtils; +import com.jsowell.pile.dto.QueryStationDTO; import com.jsowell.pile.dto.business.StationBusinessAnalyzeInfoDTO; import com.jsowell.pile.dto.business.StationStatisticsInfoDTO; import com.jsowell.pile.service.OrderBasicInfoService; import com.jsowell.pile.service.PileStationInfoService; import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO; import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO; +import com.jsowell.pile.vo.web.StationSelectVO; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -32,6 +37,23 @@ public class BusinessStationInfoController extends BaseController { @Autowired private OrderBasicInfoService orderBasicInfoService; + + + /** + * 查询充电站下拉列表 + * @param stationName 站点名称(可选,支持模糊查询) + */ + @GetMapping("/getStationSelectList") + public TableDataInfo getStationSelectList(@RequestParam(required = false) String stationName) { + QueryStationDTO dto = new QueryStationDTO(); + if (StringUtils.isNotBlank(stationName)) { + dto.setStationName(stationName); + } + List list = pileStationInfoService.getStationSelectList(dto); + return getDataTable(list); + } + + /** * 获取站点统计信息 * @param dto diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/QueryOrderDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/QueryOrderDTO.java index 7ea34f89d..b7be18277 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/QueryOrderDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/QueryOrderDTO.java @@ -117,4 +117,15 @@ public class QueryOrderDTO extends BaseEntity { * 排除的站点Id列表 */ private List excludeStationIdList; + + /** + * 启动方式 + * (0-后管启动;1-用户app启动;2-卡启动;3-离线卡启动; 4-第三方平台启动; 5-车辆vin码启动) + */ + private String startMode; + + /** + * 站点名称(用于模糊查询) + */ + private String stationName; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/business/QueryBusinessOrderDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/business/QueryBusinessOrderDTO.java index bf029612d..019ac749f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/business/QueryBusinessOrderDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/business/QueryBusinessOrderDTO.java @@ -37,6 +37,12 @@ public class QueryBusinessOrderDTO { */ private String orderStatus; + /** + * 启动方式 + * (0-后管启动;1-用户app启动;2-卡启动;3-离线卡启动; 4-第三方平台启动; 5-车辆vin码启动) + */ + private String startMode; + /** * 页码(默认1) */ diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index 8f220f151..030840eb5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -6276,30 +6276,19 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); } - // 根据站点名称过滤 - List stationIdList = new ArrayList<>(); - if (StringUtils.isNotBlank(dto.getStationName())) { - List filteredStations = allStations.stream() - .filter(s -> s.getStationName() != null && s.getStationName().contains(dto.getStationName())) - .collect(Collectors.toList()); - if (CollectionUtils.isEmpty(filteredStations)) { - throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); - } - stationIdList = filteredStations.stream() - .map(s -> String.valueOf(s.getId())) - .collect(Collectors.toList()); - } else { - stationIdList = allStations.stream() - .map(s -> String.valueOf(s.getId())) - .collect(Collectors.toList()); - } + // 获取所有站点ID列表 + List stationIdList = allStations.stream() + .map(s -> String.valueOf(s.getId())) + .collect(Collectors.toList()); - // 构建QueryOrderDTO + // 构建QueryOrderDTO(包含启动方式和站点名称,由SQL进行过滤) QueryOrderDTO queryOrderDTO = QueryOrderDTO.builder() .stationIdList(stationIdList) .startTime(dto.getCreateTime()) .endTime(dto.getEndTime()) .orderStatus(dto.getOrderStatus()) + .startMode(dto.getStartMode()) + .stationName(dto.getStationName()) .build(); // 1. 分页参数处理 diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 5f0982cce..8ff44cc20 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -1998,11 +1998,17 @@ - and station_id in + and t1.station_id in #{stationId} + + and t1.start_mode = #{startMode,jdbcType=VARCHAR} + + + and t3.station_name like concat('%', #{stationName,jdbcType=VARCHAR}, '%') + order by t1.create_time desc @@ -2083,18 +2089,18 @@ COUNT(*) AS orderCount, IFNULL(SUM(order_amount), 0) AS orderAmount FROM ( - SELECT DISTINCT - t1.order_code, + SELECT DISTINCT + t1.order_code, t1.order_amount FROM order_basic_info t1 - LEFT JOIN member_basic_info t2 - ON t1.member_id = t2.member_id + LEFT JOIN member_basic_info t2 + ON t1.member_id = t2.member_id AND t2.del_flag = '0' - JOIN pile_station_info t3 - ON t1.station_id = t3.id + JOIN pile_station_info t3 + ON t1.station_id = t3.id AND t3.del_flag = '0' - JOIN order_detail t4 - ON t4.order_code = t1.order_code + JOIN order_detail t4 + ON t4.order_code = t1.order_code AND t4.del_flag = '0' WHERE t1.del_flag = '0' @@ -2118,6 +2124,12 @@ #{stationId} + + AND t1.start_mode = #{startMode,jdbcType=VARCHAR} + + + AND t3.station_name LIKE CONCAT('%', #{stationName,jdbcType=VARCHAR}, '%') + AND t3.dept_id IN diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml index 7193d8f7c..b0b56ff03 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml @@ -671,6 +671,9 @@ #{stationDeptId} + + AND t1.station_name LIKE CONCAT('%', #{dto.stationName,jdbcType=VARCHAR}, '%') +