This commit is contained in:
YAS\29473
2026-01-04 11:40:37 +08:00
parent ccd2f96466
commit 2768c6597c
6 changed files with 70 additions and 27 deletions

View File

@@ -3,15 +3,20 @@ package com.jsowell.api.uniapp.business;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.page.TableDataInfo;
import com.jsowell.common.exception.BusinessException; import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse; 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.StationBusinessAnalyzeInfoDTO;
import com.jsowell.pile.dto.business.StationStatisticsInfoDTO; import com.jsowell.pile.dto.business.StationStatisticsInfoDTO;
import com.jsowell.pile.service.OrderBasicInfoService; import com.jsowell.pile.service.OrderBasicInfoService;
import com.jsowell.pile.service.PileStationInfoService; import com.jsowell.pile.service.PileStationInfoService;
import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO; import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO; 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.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@@ -32,6 +37,23 @@ public class BusinessStationInfoController extends BaseController {
@Autowired @Autowired
private OrderBasicInfoService orderBasicInfoService; 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<StationSelectVO> list = pileStationInfoService.getStationSelectList(dto);
return getDataTable(list);
}
/** /**
* 获取站点统计信息 * 获取站点统计信息
* @param dto * @param dto

View File

@@ -117,4 +117,15 @@ public class QueryOrderDTO extends BaseEntity {
* 排除的站点Id列表 * 排除的站点Id列表
*/ */
private List<Integer> excludeStationIdList; private List<Integer> excludeStationIdList;
/**
* 启动方式
* 0-后管启动1-用户app启动2-卡启动3-离线卡启动; 4-第三方平台启动; 5-车辆vin码启动
*/
private String startMode;
/**
* 站点名称(用于模糊查询)
*/
private String stationName;
} }

View File

@@ -37,6 +37,12 @@ public class QueryBusinessOrderDTO {
*/ */
private String orderStatus; private String orderStatus;
/**
* 启动方式
* 0-后管启动1-用户app启动2-卡启动3-离线卡启动; 4-第三方平台启动; 5-车辆vin码启动
*/
private String startMode;
/** /**
* 页码默认1 * 页码默认1
*/ */

View File

@@ -6276,30 +6276,19 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
} }
// 根据站点名称过滤 // 获取所有站点ID列表
List<String> stationIdList = new ArrayList<>(); List<String> stationIdList = allStations.stream()
if (StringUtils.isNotBlank(dto.getStationName())) { .map(s -> String.valueOf(s.getId()))
List<PileStationInfo> filteredStations = allStations.stream() .collect(Collectors.toList());
.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());
}
// 构建QueryOrderDTO // 构建QueryOrderDTO包含启动方式和站点名称由SQL进行过滤
QueryOrderDTO queryOrderDTO = QueryOrderDTO.builder() QueryOrderDTO queryOrderDTO = QueryOrderDTO.builder()
.stationIdList(stationIdList) .stationIdList(stationIdList)
.startTime(dto.getCreateTime()) .startTime(dto.getCreateTime())
.endTime(dto.getEndTime()) .endTime(dto.getEndTime())
.orderStatus(dto.getOrderStatus()) .orderStatus(dto.getOrderStatus())
.startMode(dto.getStartMode())
.stationName(dto.getStationName())
.build(); .build();
// 1. 分页参数处理 // 1. 分页参数处理

View File

@@ -1998,11 +1998,17 @@
</foreach> </foreach>
</if> </if>
<if test="stationIdList != null and stationIdList.size() != 0"> <if test="stationIdList != null and stationIdList.size() != 0">
and station_id in and t1.station_id in
<foreach collection="stationIdList" item="stationId" open="(" separator="," close=")"> <foreach collection="stationIdList" item="stationId" open="(" separator="," close=")">
#{stationId} #{stationId}
</foreach> </foreach>
</if> </if>
<if test="startMode != null and startMode != ''">
and t1.start_mode = #{startMode,jdbcType=VARCHAR}
</if>
<if test="stationName != null and stationName != ''">
and t3.station_name like concat('%', #{stationName,jdbcType=VARCHAR}, '%')
</if>
order by t1.create_time desc order by t1.create_time desc
</select> </select>
@@ -2118,6 +2124,12 @@
#{stationId} #{stationId}
</foreach> </foreach>
</if> </if>
<if test="startMode != null and startMode != ''">
AND t1.start_mode = #{startMode,jdbcType=VARCHAR}
</if>
<if test="stationName != null and stationName != ''">
AND t3.station_name LIKE CONCAT('%', #{stationName,jdbcType=VARCHAR}, '%')
</if>
<if test="stationDeptIds != null and stationDeptIds.size() != 0"> <if test="stationDeptIds != null and stationDeptIds.size() != 0">
AND t3.dept_id IN AND t3.dept_id IN
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")"> <foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">

View File

@@ -671,6 +671,9 @@
#{stationDeptId} #{stationDeptId}
</foreach> </foreach>
</if> </if>
<if test="dto.stationName != null and dto.stationName != ''">
AND t1.station_name LIKE CONCAT('%', #{dto.stationName,jdbcType=VARCHAR}, '%')
</if>
</select> </select>
<select id="getStationInfoForAmap" resultMap="PileStationInfoResult"> <select id="getStationInfoForAmap" resultMap="PileStationInfoResult">