From 1232418627a64d58f080f3106829fbaec4fa5f4f Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 26 Mar 2025 16:47:20 +0800 Subject: [PATCH] =?UTF-8?q?update=20=20=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=9F=A5=E8=AF=A2=E7=AB=99=E7=82=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsowell/pile/dto/QueryStationDTO.java | 40 ++++++---------- .../impl/PileStationInfoServiceImpl.java | 47 +++++++++++++++---- .../mapper/pile/PileStationInfoMapper.xml | 8 ++++ 3 files changed, 59 insertions(+), 36 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/QueryStationDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/QueryStationDTO.java index 6451b1907..9c41b82bc 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/QueryStationDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/QueryStationDTO.java @@ -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 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 pilePower; - - /** - * 我的收藏 - */ - private String myCollectionFlag; - } + /** + * 我的收藏 + */ + private String myCollectionFlag; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java index 2c0e41436..00631a203 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java @@ -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 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; } diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml index 9c0569a60..25698d79e 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml @@ -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' + + and t4.speed_type = #{stationDTO.chargeMode,jdbcType=VARCHAR} + + + and t4.rated_power between #{stationDTO.startPower,jdbcType=VARCHAR} and #{stationDTO.endPower,jdbcType=VARCHAR} + + and t1.station_name LIKE '%${stationDTO.stationName}%'