From 06ff787ceac7aec0c84356f6c992d64da358a9eb Mon Sep 17 00:00:00 2001 From: "YAS\\29473" <2947326429@qq.com> Date: Mon, 5 Jan 2026 11:38:13 +0800 Subject: [PATCH 01/11] update --- .../impl/OrderBasicInfoServiceImpl.java | 30 ++- .../mapper/pile/OrderBasicInfoMapper.xml | 176 +++++++++--------- 2 files changed, 110 insertions(+), 96 deletions(-) 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 030840eb5..d953ba674 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 @@ -6302,10 +6302,32 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { long orderCount = pageInfo.getTotal(); - // 3. 统计总金额(使用聚合 SQL,避免查询所有数据到内存 - OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO); - BigDecimal totalOrderAmount = statistics != null && statistics.getOrderAmount() != null - ? statistics.getOrderAmount() : BigDecimal.ZERO; + // 3. 统计总金额 (分批处理) + BigDecimal totalOrderAmount = BigDecimal.ZERO; + int batchSize = 500; // 每批最多 500 个站点ID + if (stationIdList.size() > batchSize) { + // 分批查询统计 + List> batches = Lists.partition(stationIdList, batchSize); + for (List batch : batches) { + QueryOrderDTO batchDTO = QueryOrderDTO.builder() + .stationIdList(batch) + .startTime(dto.getCreateTime()) + .endTime(dto.getEndTime()) + .orderStatus(dto.getOrderStatus()) + .startMode(dto.getStartMode()) + .stationName(dto.getStationName()) + .build(); + OrderStatisticsVO batchStatistics = orderBasicInfoMapper.countBusinessOrderStatistics(batchDTO); + if (batchStatistics != null && batchStatistics.getOrderAmount() != null) { + totalOrderAmount = totalOrderAmount.add(batchStatistics.getOrderAmount()); + } + } + } else { + // 直接查询 + OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO); + totalOrderAmount = statistics != null && statistics.getOrderAmount() != null + ? statistics.getOrderAmount() : BigDecimal.ZERO; + } //4. 转换为 BusinessOrderListVO List businessOrderList = orderListVOS.stream() diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 8ff44cc20..572b53354 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -1934,6 +1934,46 @@ 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 and t4.del_flag = '0' where t1.del_flag = '0' + + + and t1.station_id in + + #{stationId} + + + + and t1.station_id not in + + #{excludeStationId} + + + + and t1.create_time = ]]> #{startTime,jdbcType=VARCHAR} + + + and t1.create_time #{endTime,jdbcType=VARCHAR} + + + and t1.order_status = #{orderStatus,jdbcType=VARCHAR} + + + and t1.start_mode = #{startMode,jdbcType=VARCHAR} + + + and t3.station_name like concat('%', #{stationName,jdbcType=VARCHAR}, '%') + + + and t3.dept_id in + + #{stationDeptId} + + + + and t1.order_code = #{orderCode,jdbcType=VARCHAR} + + + and t1.transaction_code = #{transactionCode,jdbcType=VARCHAR} + and t1.pile_sn = #{pileSn,jdbcType=VARCHAR} @@ -1943,15 +1983,6 @@ and t1.member_id = #{memberId,jdbcType=VARCHAR} - - and t1.order_status = #{orderStatus,jdbcType=VARCHAR} - - - and t1.order_code = #{orderCode,jdbcType=VARCHAR} - - - and t1.transaction_code = #{transactionCode,jdbcType=VARCHAR} - and t2.mobile_number = #{mobileNumber,jdbcType=VARCHAR} @@ -1961,12 +1992,6 @@ and t1.station_id = #{stationId,jdbcType=VARCHAR} - - and t1.create_time = ]]> #{startTime,jdbcType=VARCHAR} - - - and t1.create_time #{endTime,jdbcType=VARCHAR} - and t1.settlement_time = ]]> #{startSettleTime,jdbcType=VARCHAR} @@ -1985,30 +2010,6 @@ and t1.pay_mode = #{payMode,jdbcType=VARCHAR} - - and t3.dept_id in - - #{stationDeptId} - - - - and t1.station_id not in - - #{excludeStationId} - - - - 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 @@ -2087,62 +2088,53 @@ resultType="com.jsowell.pile.vo.web.OrderStatisticsVO"> SELECT COUNT(*) AS orderCount, - IFNULL(SUM(order_amount), 0) AS orderAmount - FROM ( - 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 - AND t2.del_flag = '0' + IFNULL(SUM(t1.order_amount), 0) AS orderAmount + FROM order_basic_info t1 + 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 - AND t4.del_flag = '0' - WHERE t1.del_flag = '0' - - AND t1.order_status = #{orderStatus,jdbcType=VARCHAR} - - - AND t1.merchant_id = #{merchantId,jdbcType=VARCHAR} - - - AND t1.station_id = #{stationId,jdbcType=VARCHAR} - - - AND t1.create_time = ]]> #{startTime,jdbcType=VARCHAR} - - - AND t1.create_time #{endTime,jdbcType=VARCHAR} - - - AND t1.station_id IN - - #{stationId} - - - - AND t1.start_mode = #{startMode,jdbcType=VARCHAR} - - - AND t3.station_name LIKE CONCAT('%', #{stationName,jdbcType=VARCHAR}, '%') - - - AND t3.dept_id IN - - #{stationDeptId} - - - - AND t1.station_id NOT IN - - #{excludeStationId} - - - ) AS temp + + WHERE t1.del_flag = '0' + + AND t1.station_id IN + + #{stationId} + + + + AND t1.station_id NOT IN + + #{excludeStationId} + + + + AND t1.order_status = #{orderStatus,jdbcType=VARCHAR} + + + AND t1.start_mode = #{startMode,jdbcType=VARCHAR} + + + AND t1.create_time = ]]> #{startTime,jdbcType=VARCHAR} + + + AND t1.create_time #{endTime,jdbcType=VARCHAR} + + + AND t1.merchant_id = #{merchantId,jdbcType=VARCHAR} + + + AND t1.station_id = #{stationId,jdbcType=VARCHAR} + + + AND t3.station_name LIKE CONCAT('%', #{stationName,jdbcType=VARCHAR}, '%') + + + AND t3.dept_id IN + + #{stationDeptId} + + + + diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml index 9dc1f336f..66708a382 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml @@ -319,4 +319,27 @@ AND t1.del_flag = '0' + + \ No newline at end of file From f7bba2eefe2a3d6ba21f55eddd2cbe79e7458046 Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Tue, 6 Jan 2026 10:15:57 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E5=85=AC=E7=BD=91IP=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E7=A7=81=E7=BD=91IP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-admin/src/main/resources/application-prd.yml | 4 ++-- jsowell-admin/src/main/resources/application-pre.yml | 8 ++++---- .../main/java/com/jsowell/common/constant/Constants.java | 3 --- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/jsowell-admin/src/main/resources/application-prd.yml b/jsowell-admin/src/main/resources/application-prd.yml index 4ded886b9..5b4c6be6e 100644 --- a/jsowell-admin/src/main/resources/application-prd.yml +++ b/jsowell-admin/src/main/resources/application-prd.yml @@ -88,7 +88,7 @@ spring: # rabbitmq配置 prd rabbitmq: - host: 47.103.124.69 + host: 172.23.0.187 port: 5672 username: admin password: js160829@ @@ -265,7 +265,7 @@ dubbo: name: wcc-server qosEnable: false registry: - address: nacos://47.103.124.69:8848 + address: nacos://172.23.0.187:8848 parameters: namespace: 1c0429d3-2842-45a9-b3f3-11605c3fd06e username: nacos diff --git a/jsowell-admin/src/main/resources/application-pre.yml b/jsowell-admin/src/main/resources/application-pre.yml index 00a104759..7e8e8718f 100644 --- a/jsowell-admin/src/main/resources/application-pre.yml +++ b/jsowell-admin/src/main/resources/application-pre.yml @@ -9,7 +9,7 @@ spring: redis: # 地址 host: r-uf6k0uet7mihr5z78f.redis.rds.aliyuncs.com -# host: 47.117.244.159 +# host: 172.23.0.190 # 端口,默认为6379 port: 6379 # 数据库索引 @@ -41,7 +41,7 @@ spring: url: jdbc:mysql://rm-uf6ra51u33dc3798l.mysql.rds.aliyuncs.com:3306/jsowell_prd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: jsowell password: js@160829 -# url: jdbc:mysql://47.117.244.159:3306/jsowell_pre?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# url: jdbc:mysql://172.23.0.190:3306/jsowell_pre?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # username: jsowell_pre # password: Js@160829 # 从库数据源 @@ -93,7 +93,7 @@ spring: # rabbitmq配置 pre rabbitmq: - host: 47.117.244.159 + host: 172.23.0.190 port: 5672 username: guest password: guest @@ -270,7 +270,7 @@ dubbo: name: wcc-server qosEnable: false registry: - address: nacos://47.117.244.159:8848 + address: nacos://172.23.0.190:8848 parameters: namespace: c95d1cb4-8d46-48b5-9982-a6942c28e953 username: nacos diff --git a/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java b/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java index 3e7bd36dc..1076b7117 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java +++ b/jsowell-common/src/main/java/com/jsowell/common/constant/Constants.java @@ -60,9 +60,6 @@ public class Constants { // 默认端口号 public static final Integer SOCKET_PORT = 9011; - // 阿里云服务器地址 - public static final String updateServerIP = "47.103.124.69"; - // ftp端口号 public static final int port = 0x15; From 22865eae82efee95aede94b10fb7c53185107d11 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 7 Jan 2026 10:14:59 +0800 Subject: [PATCH 04/11] =?UTF-8?q?update=20=20=E6=9F=A5=E8=AF=A2=E6=9E=AA?= =?UTF-8?q?=E5=8F=A3=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=E3=80=81add=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=90=84=E7=8A=B6=E6=80=81=E6=9E=AA=E5=8F=A3?= =?UTF-8?q?=E6=B1=87=E6=80=BB=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessConnectorInfoController.java | 44 +++++- .../pile/mapper/OrderBasicInfoMapper.java | 2 +- .../pile/mapper/PileStationInfoMapper.java | 7 + .../pile/service/OrderBasicInfoService.java | 2 +- .../service/PileConnectorInfoService.java | 10 +- .../pile/service/PileStationInfoService.java | 7 +- .../impl/OrderBasicInfoServiceImpl.java | 14 +- .../impl/PileConnectorInfoServiceImpl.java | 128 ++++++++---------- .../impl/PileStationInfoServiceImpl.java | 10 ++ .../jsowell/pile/vo/base/ConnectorInfoVO.java | 7 + .../mapper/pile/OrderBasicInfoMapper.xml | 2 +- .../mapper/pile/PileStationInfoMapper.xml | 11 ++ 12 files changed, 157 insertions(+), 87 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java index e69aa4b42..ac0e08bd0 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/business/BusinessConnectorInfoController.java @@ -3,17 +3,24 @@ 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.PageResponse; import com.jsowell.common.response.RestApiResponse; import com.jsowell.pile.dto.business.QueryConnectorInfoDTO; import com.jsowell.pile.service.OrderBasicInfoService; import com.jsowell.pile.service.PileConnectorInfoService; +import com.jsowell.pile.service.PileStationInfoService; +import com.jsowell.pile.util.UserUtils; +import com.jsowell.pile.vo.base.ConnectorInfoVO; +import com.jsowell.pile.vo.base.LoginUserDetailVO; import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO; import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; /** * 运营端小程序枪口信息相关controller @@ -28,6 +35,9 @@ public class BusinessConnectorInfoController extends BaseController { @Autowired private PileConnectorInfoService pileConnectorInfoService; + @Autowired + private PileStationInfoService pileStationInfoService; + /** * 获取枪口信息列表 * @param dto @@ -37,8 +47,14 @@ public class BusinessConnectorInfoController extends BaseController { public RestApiResponse getBusinessConnectorInfoList(@RequestBody QueryConnectorInfoDTO dto) { RestApiResponse response = null; try { - BusinessConnectorInfoVO connectorInfoVO = pileConnectorInfoService.getConnectorListByStationAndStatus(dto); - response = new RestApiResponse<>(ImmutableMap.of("BusinessConnectorInfoVO", connectorInfoVO)); + // 获取登录账号信息 + LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); + List merchantIdList = loginUserDetail.getFirstMerchantIdList(); + if (CollectionUtils.isEmpty(dto.getStationIds())) { + dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList)); + } + PageResponse pageResponse = pileConnectorInfoService.getConnectorListByStationAndStatus(dto); + response = new RestApiResponse<>(ImmutableMap.of("pageResponse", pageResponse)); } catch (Exception e) { logger.error("获取枪口信息列表 error", e); response = new RestApiResponse<>(e); @@ -86,6 +102,30 @@ public class BusinessConnectorInfoController extends BaseController { } + /** + * 获取枪口状态统计接口 + * @param dto + * @return + */ + @PostMapping("/getStatusConnectorTotalNum") + public RestApiResponse getStatusConnectorTotalNum(@RequestBody QueryConnectorInfoDTO dto) { + RestApiResponse response = null; + try { + // 获取登录账号信息 + LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); + List merchantIdList = loginUserDetail.getFirstMerchantIdList(); + if (CollectionUtils.isEmpty(dto.getStationIds())) { + dto.setStationIds(pileStationInfoService.getStationIdsByMerchantIds(merchantIdList)); + } + Map map = pileConnectorInfoService.getConnectorStatusNum(dto.getStationIds(), null); + response = new RestApiResponse<>(ImmutableMap.of("connectorStatusNumMap", map)); + } catch (Exception e) { + logger.error("获取枪口状态统计接口 error", e); + response = new RestApiResponse<>(e); + } + logger.info("获取枪口状态统计接口 params:{}, result:{}", JSONObject.toJSONString(dto), response); + return response; + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderBasicInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderBasicInfoMapper.java index ac1b17c66..699786c8d 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderBasicInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/OrderBasicInfoMapper.java @@ -456,5 +456,5 @@ public interface OrderBasicInfoMapper { * @param chargingConnectorCodeList * @return */ - List batchQueryChargingConnectorInfo(@Param("pileConnectorCodes") List chargingConnectorCodeList); + List batchQueryChargingConnectorInfo(@Param("pileConnectorCodes") List chargingConnectorCodeList); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java index 390b0a1bc..10632fc7f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileStationInfoMapper.java @@ -133,4 +133,11 @@ public interface PileStationInfoMapper { * @return */ List queryUserFrequentedStation(@Param("memberId") String memberId ,@Param("startTime") String startTime ,@Param("endTime") String endTime); + + /** + * 通过运营商ids查询站点ids + * @param merchantIdList + * @return + */ + List getStationIdsByMerchantIds(@Param("merchantIds") List merchantIdList); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java index 2f3354732..652f23c70 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java @@ -658,7 +658,7 @@ public interface OrderBasicInfoService{ * @param chargingConnectorCodeList * @return */ - List batchQueryChargingConnectorInfo(List chargingConnectorCodeList); + List batchQueryChargingConnectorInfo(List chargingConnectorCodeList); /** * 批量查询充电枪实时数据 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java index 4d48d9cb1..8e7a783df 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileConnectorInfoService.java @@ -153,7 +153,7 @@ public interface PileConnectorInfoService { /** * 通过站点id和枪口状态查询枪口列表 */ - BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto); + PageResponse getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto); /** * 通过查询参数查询枪口信息 @@ -183,4 +183,12 @@ public interface PileConnectorInfoService { * @return */ int queryAbnormalDeviceCount(String id); + + /** + * 查询充电桩枪口状态数量 + * @param stationIds + * @param connectorStatus + * @return + */ + public Map getConnectorStatusNum(List stationIds, String connectorStatus); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java index 139cd9a5b..fb0cff20a 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileStationInfoService.java @@ -216,5 +216,10 @@ public interface PileStationInfoService { */ PageResponse queryUserFrequentedStation(QueryStationDTO dto); - + /** + * 通过运营商ids查询站点ids + * @param merchantIdList + * @return + */ + List getStationIdsByMerchantIds(List merchantIdList); } 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 c42971041..a61d2e044 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 @@ -6252,12 +6252,12 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { * @return */ @Override - public List batchQueryChargingConnectorInfo(List chargingConnectorCodeList) { + public List batchQueryChargingConnectorInfo(List chargingConnectorCodeList) { // 这个infoVOs只有简单数据,没有充电中数据 - List infoVOS = orderBasicInfoMapper.batchQueryChargingConnectorInfo(chargingConnectorCodeList); + List infoVOS = orderBasicInfoMapper.batchQueryChargingConnectorInfo(chargingConnectorCodeList); List transactionCodes = infoVOS.stream() - .map(BusinessOrderDetailInfoVO::getTransactionCode) + .map(PileConnectorInfoVO::getTransactionCode) .collect(Collectors.toList()); List list = getRealTimeMonitorDataList(transactionCodes); @@ -6267,14 +6267,14 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { x -> x, (existing, replacement) -> existing // 如果有重复key,保留第一个 )); - for (BusinessOrderDetailInfoVO infoVO : infoVOS) { + for (PileConnectorInfoVO infoVO : infoVOS) { String pileConnectorCode = infoVO.getPileConnectorCode(); if (pileConnectorCode != null && bMap.containsKey(pileConnectorCode)) { RealTimeMonitorData realTimeMonitorData = bMap.get(pileConnectorCode); - infoVO.setChargeDegree(realTimeMonitorData.getChargingDegree()); - infoVO.setChargeTime(realTimeMonitorData.getSumChargingTime()); - infoVO.setEndSOC(realTimeMonitorData.getSOC()); + infoVO.setChargingDegree(new BigDecimal(realTimeMonitorData.getChargingDegree())); + infoVO.setChargingTime(realTimeMonitorData.getSumChargingTime()); + infoVO.setSOC(realTimeMonitorData.getSOC()); infoVO.setTimeRemaining(realTimeMonitorData.getTimeRemaining()); } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index 8d0953a34..41f03024b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -41,6 +41,7 @@ import com.jsowell.pile.vo.base.LoginUserDetailVO; import com.jsowell.pile.vo.uniapp.business.BusinessConnectorDetailVO; import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO; import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO; +import com.jsowell.pile.vo.uniapp.customer.OrderVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileDetailVO; import com.jsowell.pile.vo.web.PileModelInfoVO; @@ -1062,33 +1063,60 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { * @return */ @Override - public BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto) { + public PageResponse getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto) { List list = new ArrayList<>(); - PileConnectorInfoVO info = null; + List stationIds = dto.getStationIds(); + int pageNum = dto.getPageNum() == 0 ? 1 : dto.getPageNum(); int pageSize = dto.getPageSize() == 0 ? 10 : dto.getPageSize(); - // 获取登录账号信息 - LoginUserDetailVO loginUserDetail = UserUtils.getLoginUserDetail(); - List merchantIdList = loginUserDetail.getFirstMerchantIdList(); - List stationInfos = pileStationInfoService.getStationInfosByMerchantIds(merchantIdList); - // 获取站点ids - List longStationIds = stationInfos.stream() - .map(PileStationInfo::getId) - .collect(Collectors.toList()); - List stationIds = longStationIds.stream() - .map(String::valueOf) // 或 s -> Long.parseLong(s) - .collect(Collectors.toList()); - - String connectorStatus = dto.getConnectorStatus(); - BusinessConnectorInfoVO vo = new BusinessConnectorInfoVO(); - // 根据站点ids、枪口状态查询枪口列表(有缓存) + // 分页查询符合条件站点的枪口列表 PageUtils.startPage(pageNum, pageSize); - // List connectorInfoVOS = batchSelectConnectorList(stationIds); - List connectorInfoVOS = pileConnectorInfoMapper.batchSelectConnectorListByStatus(stationIds, connectorStatus); + List connectorInfoVOS = pileConnectorInfoMapper.batchSelectConnectorListByStatus(stationIds, null); + PageInfo pageInfo = new PageInfo<>(connectorInfoVOS); + // 将分页列表中充电中的枪编码筛选出来 + List chargingPileConnectorCodeList = connectorInfoVOS.stream() + .filter(connectorInfoVO -> StringUtils.equals(connectorInfoVO.getConnectorStatus() + , PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue())) + .map(ConnectorInfoVO::getPileConnectorCode) + .collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(chargingPileConnectorCodeList)) { + // 批量查询充电中的各项信息 + List pileConnectorInfoVOS = orderBasicInfoService.batchQueryChargingConnectorInfo(chargingPileConnectorCodeList); + // 将获取到的充电信息详情根据枪口编码将信息set进对应的pageInfo.list中对应的值 + for (PileConnectorInfoVO pileConnectorInfoVO : pileConnectorInfoVOS) { + for (ConnectorInfoVO connectorInfoVO : connectorInfoVOS) { + if (StringUtils.equals(pileConnectorInfoVO.getPileConnectorCode(), connectorInfoVO.getPileConnectorCode())) { + connectorInfoVO.setOrderCode(pileConnectorInfoVO.getOrderCode()); + connectorInfoVO.setChargeTime(pileConnectorInfoVO.getChargingTime()); + connectorInfoVO.setChargeDegree(String.valueOf(pileConnectorInfoVO.getChargingDegree())); + connectorInfoVO.setTimeRemaining(pileConnectorInfoVO.getTimeRemaining()); + } + } + } + } + + return PageResponse.builder() + .pageNum(pageInfo.getPageNum()) + .pageSize(pageInfo.getPageSize()) + .total(pageInfo.getTotal()) + .pages(pageInfo.getPages()) + .list(connectorInfoVOS) + .build(); + } + + /** + * 获取站点各状态的枪口数量 + * @param stationIds + * @param connectorStatus + * @return + */ + public Map getConnectorStatusNum(List stationIds, String connectorStatus) { + Map map = new LinkedHashMap<>(); + List connectorInfoVOS = pileConnectorInfoMapper.batchSelectConnectorListByStatus(stationIds, connectorStatus); // 初始化对象 - List chargingConnectorCodeList = new ArrayList<>(); // 充电中枪口 pileConnectorCodeList int offlineNum = 0; int freeNum = 0; int occupiedNum = 0; @@ -1096,82 +1124,36 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { int faultNum = 0; for (ConnectorInfoVO connectorInfoVO : connectorInfoVOS) { - String pileConnectorCode = connectorInfoVO.getPileConnectorCode(); String status = connectorInfoVO.getConnectorStatus(); - info = new PileConnectorInfoVO(); if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue())) { // 离网 offlineNum += 1; - info.setPileConnectorCode(pileConnectorCode); - info.setStatus(Integer.parseInt(PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue())); - - list.add(info); } if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.FREE.getValue())) { // 空闲 freeNum += 1; - info.setPileConnectorCode(pileConnectorCode); - info.setStatus(Integer.parseInt(PileConnectorDataBaseStatusEnum.FREE.getValue())); - - list.add(info); } if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue())) { // 占用未充电 occupiedNum += 1; - info.setPileConnectorCode(pileConnectorCode); - info.setStatus(Integer.parseInt(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue())); - - list.add(info); } if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue())) { // 充电中 chargingNum += 1; - chargingConnectorCodeList.add(pileConnectorCode); } if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.FAULT.getValue())) { // 故障 faultNum += 1; - info.setPileConnectorCode(pileConnectorCode); - info.setStatus(Integer.parseInt(PileConnectorDataBaseStatusEnum.FAULT.getValue())); - - list.add(info); - } - - vo.setConnectorNum(connectorInfoVOS.size()); - vo.setOfflineConnectorNum(offlineNum); - vo.setFreeConnectorNum(freeNum); - vo.setOccupiedConnectorNum(occupiedNum); - vo.setChargingConnectorNum(chargingNum); - vo.setFaultConnectorNum(faultNum); - - } - // 如果充电中的枪列表不为空 - if (CollectionUtils.isNotEmpty(chargingConnectorCodeList)) { - // 根据充电中的枪口List批量获取充电中的枪口信息 - List infoVOS = orderBasicInfoService.batchQueryChargingConnectorInfo(chargingConnectorCodeList); - Map bMap = infoVOS.stream() - .collect(Collectors.toMap( - BusinessOrderDetailInfoVO::getPileConnectorCode, - x -> x, - (existing, replacement) -> existing // 如果有重复key,保留第一个 - )); - for (PileConnectorInfoVO pileConnectorInfoVO : list) { - String pileConnectorCode = pileConnectorInfoVO.getPileConnectorCode(); - if (pileConnectorCode != null && bMap.containsKey(pileConnectorCode)) { - BusinessOrderDetailInfoVO businessOrderDetailInfoVO = bMap.get(pileConnectorCode); - - pileConnectorInfoVO.setStatus(Integer.parseInt(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue())); - pileConnectorInfoVO.setChargingDegree(new BigDecimal(businessOrderDetailInfoVO.getChargeDegree())); - pileConnectorInfoVO.setChargingTime(businessOrderDetailInfoVO.getChargeTime()); - pileConnectorInfoVO.setSOC(businessOrderDetailInfoVO.getEndSOC()); - pileConnectorInfoVO.setTimeRemaining(businessOrderDetailInfoVO.getTimeRemaining()); - - } } } - vo.setPileConnectorInfoVOList(list); - return vo; + map.put("offlineNum", offlineNum); + map.put("freeNum", freeNum); + map.put("occupiedNum", occupiedNum); + map.put("chargingNum", chargingNum); + map.put("faultNum", faultNum); + + return map; } /** 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 82511f0a9..ec15ca07c 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 @@ -1623,4 +1623,14 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { return uniAppQueryStationInfoListV2(dto); } + /** + * 根据商户ids查询站点ids + * @param merchantIdList + * @return + */ + @Override + public List getStationIdsByMerchantIds(List merchantIdList) { + return pileStationInfoMapper.getStationIdsByMerchantIds(merchantIdList); + } + } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java index 5e4fa27ef..78d5673fb 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java @@ -66,4 +66,11 @@ public class ConnectorInfoVO { */ private String ratedVoltage; + private String orderCode; + + private String chargeDegree; + + private String chargeTime; + + private String timeRemaining; } diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 251d10fea..8118c1b9b 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -3523,7 +3523,7 @@ + + From 4eaab87985d925b7ef0a9459b5d5e20bb161ea53 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 7 Jan 2026 10:55:02 +0800 Subject: [PATCH 05/11] =?UTF-8?q?bugfix=20=20=E4=BF=AE=E5=A4=8D=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/service/impl/PileConnectorInfoServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index 41f03024b..529458f5b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -1066,13 +1066,14 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { public PageResponse getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto) { List list = new ArrayList<>(); List stationIds = dto.getStationIds(); + String status = dto.getConnectorStatus(); int pageNum = dto.getPageNum() == 0 ? 1 : dto.getPageNum(); int pageSize = dto.getPageSize() == 0 ? 10 : dto.getPageSize(); // 分页查询符合条件站点的枪口列表 PageUtils.startPage(pageNum, pageSize); - List connectorInfoVOS = pileConnectorInfoMapper.batchSelectConnectorListByStatus(stationIds, null); + List connectorInfoVOS = pileConnectorInfoMapper.batchSelectConnectorListByStatus(stationIds, status); PageInfo pageInfo = new PageInfo<>(connectorInfoVOS); // 将分页列表中充电中的枪编码筛选出来 From 32b1505ba4f91e4840f8d0808f7bdf0747c3229b Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 7 Jan 2026 13:53:33 +0800 Subject: [PATCH 06/11] =?UTF-8?q?update=20=20=E8=BF=90=E8=90=A5=E7=AB=AF?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=9F=A5=E8=AF=A2=E5=90=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=9E=AA=E5=8F=A3=E6=95=B0=E9=87=8F=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PileConnectorInfoServiceImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index 529458f5b..17dbffd14 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -1122,6 +1122,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { int freeNum = 0; int occupiedNum = 0; int chargingNum = 0; + int hangingNum = 0; int faultNum = 0; for (ConnectorInfoVO connectorInfoVO : connectorInfoVOS) { @@ -1135,6 +1136,10 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { // 空闲 freeNum += 1; } + if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_RESERVED_LOCK.getValue())) { + // 预约锁定(挂起) + hangingNum += 1; + } if (StringUtils.equals(status, PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue())) { // 占用未充电 occupiedNum += 1; @@ -1148,8 +1153,13 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { faultNum += 1; } } + // 全部数量 + int totalNum = offlineNum + freeNum + occupiedNum + chargingNum + faultNum + hangingNum; + + map.put("totalNum", totalNum); map.put("offlineNum", offlineNum); map.put("freeNum", freeNum); + map.put("hangingNum", hangingNum); map.put("occupiedNum", occupiedNum); map.put("chargingNum", chargingNum); map.put("faultNum", faultNum); From aa06218f4c4efff10ad7a2c8bd3ffba76497d8d9 Mon Sep 17 00:00:00 2001 From: "YAS\\29473" <2947326429@qq.com> Date: Wed, 7 Jan 2026 14:05:56 +0800 Subject: [PATCH 07/11] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9pre=E7=9A=84mq?= =?UTF-8?q?=E4=B8=BAprd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-pre.yml | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/jsowell-admin/src/main/resources/application-pre.yml b/jsowell-admin/src/main/resources/application-pre.yml index 7e8e8718f..36b61249e 100644 --- a/jsowell-admin/src/main/resources/application-pre.yml +++ b/jsowell-admin/src/main/resources/application-pre.yml @@ -92,11 +92,29 @@ spring: multi-statement-allow: true # rabbitmq配置 pre +# rabbitmq: +# host: 172.23.0.190 +# port: 5672 +# username: guest +# password: guest +# #这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调 +# publisher-confirm-type: correlated +# #保证交换机能把消息推送到队列中 +# publisher-returns: true +# virtual-host: / +# #这个配置是保证消费者会消费消息,手动确认 +# listener: +# simple: +# acknowledge-mode: manual +# template: +# mandatory: true + + # rabbitmq配置 prd rabbitmq: - host: 172.23.0.190 + host: 172.23.0.187 port: 5672 - username: guest - password: guest + username: admin + password: js160829@ #这个配置是保证提供者确保消息推送到交换机中,不管成不成功,都会回调 publisher-confirm-type: correlated #保证交换机能把消息推送到队列中 From 2920ecab0edbd04d2e8548d3a8c1a5844de5a4e5 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 7 Jan 2026 14:22:44 +0800 Subject: [PATCH 08/11] =?UTF-8?q?bugfix=20=20redis=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/jsowell/common/core/redis/RedisCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/core/redis/RedisCache.java b/jsowell-common/src/main/java/com/jsowell/common/core/redis/RedisCache.java index d3aa91741..f51d6f08f 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/core/redis/RedisCache.java +++ b/jsowell-common/src/main/java/com/jsowell/common/core/redis/RedisCache.java @@ -620,7 +620,7 @@ public class RedisCache { for (String key : keys) { if (StringUtils.isNotBlank(key)) { // 使用 index -1 获取 List 的最后一个元素 - T lastValue = (T) redisTemplate.opsForList().index(key, -1); + T lastValue = (T) redisTemplate.opsForHash().get(key, -1); if (lastValue != null) { result.put(key, lastValue); } From 84140e94a5f807083a041be73ca8d93d5011afab Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 7 Jan 2026 14:59:51 +0800 Subject: [PATCH 09/11] =?UTF-8?q?bugfix=20=20redis=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/common/core/redis/RedisCache.java | 50 ++++++++++++++++--- .../impl/OrderBasicInfoServiceImpl.java | 22 ++++++-- 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/core/redis/RedisCache.java b/jsowell-common/src/main/java/com/jsowell/common/core/redis/RedisCache.java index f51d6f08f..700a511b3 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/core/redis/RedisCache.java +++ b/jsowell-common/src/main/java/com/jsowell/common/core/redis/RedisCache.java @@ -619,10 +619,15 @@ public class RedisCache { Map result = new HashMap<>(); for (String key : keys) { if (StringUtils.isNotBlank(key)) { - // 使用 index -1 获取 List 的最后一个元素 - T lastValue = (T) redisTemplate.opsForHash().get(key, -1); - if (lastValue != null) { - result.put(key, lastValue); + try { + // 使用 index -1 获取 List 的最后一个元素 + T lastValue = (T) redisTemplate.opsForList().index(key, -1); + if (lastValue != null) { + result.put(key, lastValue); + } + } catch (Exception e) { + // 记录错误日志,方便排查问题 + logger.error("获取Redis List失败,key={}, 可能key的类型不是List", key, e); } } } @@ -640,8 +645,41 @@ public class RedisCache { if (StringUtils.isBlank(key)) { return null; } - // 使用 index -1 获取 List 的最后一个元素 - return (T) redisTemplate.opsForList().index(key, -1); + try { + // 使用 index -1 获取 List 的最后一个元素 + return (T) redisTemplate.opsForList().index(key, -1); + } catch (Exception e) { + // 记录错误日志,方便排查问题 + logger.error("获取Redis List失败,key={}, 可能key的类型不是List", key, e); + return null; + } + } + + /** + * 批量获取 Redis List 中每个 key 对应的最后一条数据 + * + * @param keys Redis 键集合 + * @return Map,key 为入参的 key 值,value 为对应 List 的最后一条数据 + */ + public Map multiGetLastListValueList(final List keys) { + if (keys == null || keys.isEmpty()) { + return new HashMap<>(); + } + + Map result = new HashMap<>(); + for (String key : keys) { + if (StringUtils.isNotBlank(key)) { + try { + // 使用 index -1 获取 List 的最后一个元素 + Object lastValue = redisTemplate.opsForList().index(key, -1); + result.put(key, lastValue); + } catch (Exception e) { + // 记录错误日志,方便排查问题 + logger.error("获取Redis List失败,key={}, 可能key的类型不是List", key, e); + } + } + } + return result; } } 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 7dd150422..a80e054e4 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 @@ -6412,10 +6412,24 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { redisKeys.add(CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + transactionCode); } // 批量查询多个key值的数据 key: redisKey, value: 最后一条实时数据 - Map map = redisCache.multiGetLastListValue(redisKeys); - // 循环该map - for (Map.Entry entry : map.entrySet()) { - resultList.add(entry.getValue()); + // 注意:数据在Redis中以Hash类型存储,field为时间字符串,需要获取所有field后取最新的一条 + for (String redisKey : redisKeys) { + try { + Map hashData = redisCache.getCacheMap(redisKey); + if (hashData != null && !hashData.isEmpty()) { + // 按时间排序,获取最新的一条数据 + String latestJson = hashData.entrySet().stream() + .max(Map.Entry.comparingByKey()) + .map(Map.Entry::getValue) + .orElse(null); + if (latestJson != null) { + RealTimeMonitorData data = JSON.parseObject(latestJson, RealTimeMonitorData.class); + resultList.add(data); + } + } + } catch (Exception e) { + logger.error("获取实时监控数据失败,redisKey={}", redisKey, e); + } } return resultList; } From bcbb07d596f4f1c535df147b73f698711990affa Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 7 Jan 2026 15:19:41 +0800 Subject: [PATCH 10/11] =?UTF-8?q?update=20=20=E8=BF=90=E8=90=A5=E7=AB=AF?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=9F=A5=E8=AF=A2=E6=9E=AA=E5=8F=A3?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9Esoc?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java | 1 + .../src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index 17dbffd14..b5bc6a343 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -1094,6 +1094,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { connectorInfoVO.setChargeTime(pileConnectorInfoVO.getChargingTime()); connectorInfoVO.setChargeDegree(String.valueOf(pileConnectorInfoVO.getChargingDegree())); connectorInfoVO.setTimeRemaining(pileConnectorInfoVO.getTimeRemaining()); + connectorInfoVO.setSoc(String.valueOf(pileConnectorInfoVO.getSOC())); } } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java index 78d5673fb..615d875fd 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/ConnectorInfoVO.java @@ -73,4 +73,6 @@ public class ConnectorInfoVO { private String chargeTime; private String timeRemaining; + + private String soc; } From 3be12178fd75b6a1b48e925ee1c5cbeaeef61383 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 7 Jan 2026 15:34:06 +0800 Subject: [PATCH 11/11] =?UTF-8?q?update=20=20=E8=BF=90=E8=90=A5=E7=AB=AF?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=9F=A5=E8=AF=A2=E5=85=85=E7=94=B5?= =?UTF-8?q?=E6=9E=AA=E5=8F=A3=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/service/impl/PileConnectorInfoServiceImpl.java | 8 +++++++- .../vo/uniapp/business/BusinessConnectorDetailVO.java | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index b5bc6a343..cd08ca083 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -1238,9 +1238,15 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { } RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0); String startSoc = orderBasicInfo.getStartSoc(); + Date chargeStartTime = orderBasicInfo.getChargeStartTime(); + String startTime = "-"; + if (chargeStartTime != null) { + // 转换成 字符串 + startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, chargeStartTime); + } String endSoc = realTimeMonitorData.getSOC(); - + detailVO.setChargeStartTime(startTime); detailVO.setStartSOC(startSoc); detailVO.setEndSOC(endSoc); detailVO.setChargeDegree(realTimeMonitorData.getChargingDegree()); // 充电度数 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorDetailVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorDetailVO.java index 41eda80dd..62f214f28 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorDetailVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/uniapp/business/BusinessConnectorDetailVO.java @@ -56,4 +56,9 @@ public class BusinessConnectorDetailVO { * 故障原因 */ private String faultReason; + + /** + * 充电开始时间 + */ + private String chargeStartTime; }