update 小程序首页查询站点列表接口

This commit is contained in:
Lemon
2025-03-26 16:47:20 +08:00
parent f136f66855
commit 1232418627
3 changed files with 59 additions and 36 deletions

View File

@@ -110,6 +110,13 @@ public class QueryStationDTO extends BaseEntity {
*/
private String stationType;
/**
* 充电方式
* 1 - 直流
* 2 - 交流
*/
private String chargeMode;
/**
* 充电速度(快充/慢充)
* 1 - 快充30-180kw
@@ -118,10 +125,9 @@ public class QueryStationDTO extends BaseEntity {
*/
private String chargeSpeed;
/**
* 其他筛选条件
*/
private OtherOptions otherOptions;
private String startPower;
private String endPower;
private List<String> stationIds;
@@ -142,26 +148,8 @@ public class QueryStationDTO extends BaseEntity {
*/
private String parkingLockFlag;
@Data
public static class OtherOptions {
/**
* 充电方式
* 1 - 直流
* 2 - 交流
*/
private String chargeMode;
/**
* 充电桩功率
* 1 - 快充30-180kw
* 2 - 慢充(<30kw
* 3 - 超充≥180kw
*/
private List<String> pilePower;
/**
* 我的收藏
*/
private String myCollectionFlag;
}
/**
* 我的收藏
*/
private String myCollectionFlag;
}

View File

@@ -38,6 +38,7 @@ import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationOrderQuantityInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
import com.jsowell.pile.vo.web.PileDetailVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.system.service.SysDeptService;
import com.jsowell.system.service.SysUserService;
@@ -624,7 +625,7 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
// 小程序站点列表页只展示对外开放的站点
dto.setPublicFlag(Constants.ONE);
String myCollectionFlag = dto.getOtherOptions().getMyCollectionFlag();
String myCollectionFlag = dto.getMyCollectionFlag();
// 先判断是否选择我的收藏中的站点
if (StringUtils.isNotBlank(myCollectionFlag)) {
// 不为空先将要查询的站点idList添加进参数
@@ -632,6 +633,23 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
List<String> stationIds = memberStationRelationService.getStationIdListByMemberId(dto.getMemberId());
dto.setStationIds(stationIds);
}
// 看筛选条件
String chargeSpeed = dto.getChargeSpeed();
if (StringUtils.isNotBlank(chargeSpeed)) {
// 充电速度
if (StringUtils.equals(Constants.ONE, chargeSpeed)) {
// 快充30-180kw
dto.setStartPower("30");
dto.setEndPower("180");
}else if (StringUtils.equals(Constants.TWO, chargeSpeed)) {
// 慢充(<30kw
dto.setStartPower("0");
dto.setEndPower("30");
}else {
dto.setStartPower("180");
dto.setEndPower("999");
}
}
// 分页
PageHelper.startPage(pageNum, pageSize);
// 根据前端传的参数进行筛选查询(默认根据距离排序)
@@ -699,8 +717,15 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
}
stationVOList.add(stationVO);
}
if (distance != 0.00) {
String sortType = dto.getSortType();
if (StringUtils.equals(Constants.ONE, sortType)) {
// 低价优先
stationVOList.sort((x1, x2) -> {
Double a = Double.valueOf(x1.getTotalPrice());
Double b = Double.valueOf(x2.getTotalPrice());
return a.compareTo(b);
});
} else if (distance != 0.00) {
// 对集合按照距离排序,距离小的在前
stationVOList.sort((o1, o2) -> {
Double a = Double.valueOf(o1.getDistance());
@@ -708,13 +733,15 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
return a.compareTo(b);
});
}
// if () {
//
// }
return null;
// 返回结果集
PageResponse pageResponse = PageResponse.builder()
.pageNum(pageInfo.getPageNum())
.pageSize(pageInfo.getPageSize())
.list(stationVOList)
.pages(pageInfo.getPages())
.total(pageInfo.getTotal())
.build();
return pageResponse;
}

View File

@@ -347,8 +347,16 @@
pile_station_info t1
left JOIN pile_basic_info t2 ON t1.id = t2.station_id and t2.del_flag = '0'
left JOIN pile_merchant_info t3 ON t3.id = t1.merchant_id and t3.del_flag = '0'
left join pile_model_info t4 on t2.model_id = t4.id and t2.del_flag = '0'
where
t1.del_flag = '0'
<if test="stationDTO.chargeMode != null and stationDTO.chargeMode != ''">
and t4.speed_type = #{stationDTO.chargeMode,jdbcType=VARCHAR}
</if>
<if test="stationDTO.startPower != null and stationDTO.startPower != '' and stationDTO.endPower != null and stationDTO.endPower != ''">
and t4.rated_power between #{stationDTO.startPower,jdbcType=VARCHAR} and #{stationDTO.endPower,jdbcType=VARCHAR}
</if>
<if test="stationDTO.stationName != null and stationDTO.stationName != ''">
and t1.station_name LIKE '%${stationDTO.stationName}%'
</if>