From 9c278b05d14f1f121b4530b19f9a64ffe4bdb7ad Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 7 Apr 2025 15:01:16 +0800 Subject: [PATCH 01/18] =?UTF-8?q?update=20=20=E6=9F=A5=E8=AF=A2=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=B8=B8=E5=8E=BB=E7=AB=99=E7=82=B9=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/uniapp/customer/MemberController.java | 13 +++++++--- .../pile/PileStationInfoController.java | 2 ++ .../pile/mapper/OrderBasicInfoMapper.java | 10 -------- .../pile/mapper/PileStationInfoMapper.java | 10 ++++++++ .../pile/service/OrderBasicInfoService.java | 7 ------ .../pile/service/PileStationInfoService.java | 8 ++++++ .../impl/OrderBasicInfoServiceImpl.java | 12 --------- .../impl/PileStationInfoServiceImpl.java | 25 ++++++++++++++++--- .../mapper/pile/OrderBasicInfoMapper.xml | 18 ------------- .../mapper/pile/PileStationInfoMapper.xml | 18 +++++++++++++ 10 files changed, 68 insertions(+), 55 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/MemberController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/MemberController.java index ee1aee6fe..7b84672db 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/MemberController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/MemberController.java @@ -55,6 +55,10 @@ public class MemberController extends BaseController { @Autowired private OrderBasicInfoService orderBasicInfoService; + + @Autowired + private PileStationInfoService pileStationInfoService; + /** * 下发短信接口 business * http://localhost:8080/uniapp/member/sendSMS @@ -611,14 +615,15 @@ public class MemberController extends BaseController { /** * 查询用户常去站点(最近半年) */ - @GetMapping("/getUserFrequentedStationList") - public RestApiResponse queryUserFrequentedStation(HttpServletRequest request) { + @PostMapping("/getUserFrequentedStationList") + public RestApiResponse queryUserFrequentedStation(HttpServletRequest request, @RequestBody QueryStationDTO dto) { RestApiResponse response; try { String memberId = getMemberIdByAuthorization(request); + dto.setMemberId(memberId); //查询order_basic_info表,根据member_id,对应的station_id,,然后根据station_id查询pile_station_info表中的站点名称,最后统计每个站点的次数,查询当前时间前半年的记录 - List list = orderBasicInfoService.queryUserFrequentedStation(memberId); - response = new RestApiResponse<>(ImmutableMap.of("list", list)); + PageResponse pageResponse = pileStationInfoService.queryUserFrequentedStation(dto); + response = new RestApiResponse<>(pageResponse); } catch (BusinessException e) { logger.error("查询用户常去站点(最近半年) error", e); response = new RestApiResponse<>(e.getCode(), e.getMessage()); diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java index 9ffb11607..b2ff53216 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java @@ -398,4 +398,6 @@ public class PileStationInfoController extends BaseController { } return result; } + + // public AjaxResult checkStationAmap } 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 02755e366..e28689872 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 @@ -403,14 +403,4 @@ public interface OrderBasicInfoMapper { * @return */ List selectThirdPartyOrderList(@Param("dto") QueryStartChargeDTO dto); - - - /** - * 查询用户常用站点信息 - * @param memberId - * @param startTime - * @param endTime - * @return - */ - List queryUserFrequentedStation(@Param("memberId") String memberId ,@Param("startTime") String startTime ,@Param("endTime") String endTime); } \ No newline at end of file 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 1356307e4..52bcc3997 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 @@ -1,6 +1,7 @@ package com.jsowell.pile.mapper; import com.jsowell.pile.domain.PileStationInfo; +import com.jsowell.pile.domain.UserFrequentedStationInfo; import com.jsowell.pile.dto.QueryStationDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.dto.amap.GetStationInfoDTO; @@ -122,4 +123,13 @@ public interface PileStationInfoMapper { PileStationInfo queryInfoByDeptId(@Param("deptId") String deptId); List getStationInfosByMerchantIds(@Param("list") List merchantIds); + + /** + * 查询用户常用站点信息 + * @param memberId + * @param startTime + * @param endTime + * @return + */ + List queryUserFrequentedStation(@Param("memberId") String memberId ,@Param("startTime") String startTime ,@Param("endTime") String endTime); } 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 39165625c..3bc9e3817 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 @@ -544,13 +544,6 @@ public interface OrderBasicInfoService{ void retryRefundOrderList(List orderCoderList); - /** - * 查询用户常用充电站点信息 - * @param memberId - * @return - */ - List queryUserFrequentedStation(String memberId); - /** * 通过订单编号列表查询订单信息 * @param orderCodeList 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 5732c9213..a86adf2ad 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 @@ -2,6 +2,7 @@ package com.jsowell.pile.service; import com.jsowell.common.core.page.PageResponse; import com.jsowell.pile.domain.PileStationInfo; +import com.jsowell.pile.domain.UserFrequentedStationInfo; import com.jsowell.pile.dto.*; import com.jsowell.pile.dto.amap.GetStationInfoDTO; import com.jsowell.pile.dto.business.StationBusinessAnalyzeInfoDTO; @@ -203,4 +204,11 @@ public interface PileStationInfoService { * @return */ StationBusinessAnalyzeInfoVO getStationConnectorUsedInfo(StationBusinessAnalyzeInfoDTO dto); + + /** + * 查询用户常用充电站点信息 + * @param dto + * @return + */ + PageResponse queryUserFrequentedStation(QueryStationDTO dto); } 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 bb4a8254b..96a23b62d 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 @@ -4970,18 +4970,6 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { } - /** - * 查询用户常用站点信息 - * @param memberId - * @return - */ - @Override - public List queryUserFrequentedStation(String memberId) { - String endTime = DateUtils.getDate(); - String startTime = DateUtils.getHalfYearAgo(endTime); - return orderBasicInfoMapper.queryUserFrequentedStation(memberId, startTime, endTime); - } - @Override public List queryAfterSettleOrderDTOList(List orderCodeList) { return null; 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 086d332f9..d77a32267 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 @@ -16,10 +16,7 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; import com.jsowell.common.util.ip.AddressUtils; -import com.jsowell.pile.domain.PileBasicInfo; -import com.jsowell.pile.domain.PileStationInfo; -import com.jsowell.pile.domain.SettleOrderReport; -import com.jsowell.pile.domain.ThirdpartyParkingConfig; +import com.jsowell.pile.domain.*; import com.jsowell.pile.dto.FastCreateStationDTO; import com.jsowell.pile.dto.QueryStationDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; @@ -1394,4 +1391,24 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { vo.setBusinessOrderDetailInfoVOList(list); return vo; } + + /** + * 查询用户常用站点信息 + * @param dto + * @return + */ + @Override + public PageResponse queryUserFrequentedStation(QueryStationDTO dto) { + String endTime = DateUtils.getDate(); + String startTime = DateUtils.getHalfYearAgo(endTime); + List frequentedStationInfos = pileStationInfoMapper.queryUserFrequentedStation(dto.getMemberId(), startTime, endTime); + // 筛选出站点idList + List stationIdList = frequentedStationInfos.stream() + .map(UserFrequentedStationInfo::getStationId) + .collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(stationIdList)) { + dto.setStationIds(stationIdList); + } + return uniAppQueryStationInfoListV2(dto); + } } \ No newline at end of file diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index bb7f61921..399721f6b 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -3119,22 +3119,4 @@ - - \ No newline at end of file diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml index 27172f9d2..7f75b48a9 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileStationInfoMapper.xml @@ -706,4 +706,22 @@ + + \ No newline at end of file From 931ecd42c5c1d930ae1300da2cd24b7e6e4b9002 Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 7 Apr 2025 16:34:59 +0800 Subject: [PATCH 02/18] =?UTF-8?q?update=20=20=E5=B0=86pre=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=9E=E6=8E=A5=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=8E=9F=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-pre.yml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/jsowell-admin/src/main/resources/application-pre.yml b/jsowell-admin/src/main/resources/application-pre.yml index 17982b4c6..abd63f073 100644 --- a/jsowell-admin/src/main/resources/application-pre.yml +++ b/jsowell-admin/src/main/resources/application-pre.yml @@ -8,17 +8,17 @@ spring: # redis 配置 redis: # 地址 - host: r-uf6k0uet7mihr5z78f.redis.rds.aliyuncs.com -# host: 106.14.94.149 +# host: r-uf6k0uet7mihr5z78f.redis.rds.aliyuncs.com + host: 106.14.94.149 # 端口,默认为6379 port: 6379 # 数据库索引 database: 0 # 账号 - username: jsowell +# username: jsowell # 密码 - password: js@160829 -# password: js160829 +# password: js@160829 + password: js160829 # 连接超时时间 timeout: 10s lettuce: @@ -38,12 +38,12 @@ spring: druid: # 主库数据源 master: - 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://106.14.94.149:3306/jsowell_pre?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 -# username: jsowell_pre -# password: Js@160829 +# 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://106.14.94.149:3306/jsowell_pre?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: jsowell_pre + password: Js@160829 # 从库数据源 slave: # 从数据源开关/默认关闭 From 5bc268c922aa55ffd505d8894206eb3782a5deca Mon Sep 17 00:00:00 2001 From: "YAS\\29473" <2947326429@qq.com> Date: Tue, 8 Apr 2025 08:44:34 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E5=A2=9E=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/mapper/OrderBasicInfoMapper.java | 2 ++ .../pile/mapper/PileConnectorInfoMapper.java | 7 +++++++ .../pile/service/PileConnectorInfoService.java | 7 +++++++ .../impl/PileConnectorInfoServiceImpl.java | 16 ++++++++++++++++ .../service/impl/PileStationInfoServiceImpl.java | 16 ++++++++++++++++ .../com/jsowell/pile/vo/base/StationInfoVO.java | 10 ++++++++++ .../mapper/pile/OrderBasicInfoMapper.xml | 12 ++++++++++++ .../mapper/pile/PileConnectorInfoMapper.xml | 12 ++++++++++++ 8 files changed, 82 insertions(+) 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 e28689872..ffe3dc643 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 @@ -403,4 +403,6 @@ public interface OrderBasicInfoMapper { * @return */ List selectThirdPartyOrderList(@Param("dto") QueryStartChargeDTO dto); + + LocalDateTime queryOrderCreateTimeByStationId(String id); } \ No newline at end of file diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java index 0cbf9e8e4..5aea037a5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileConnectorInfoMapper.java @@ -135,4 +135,11 @@ public interface PileConnectorInfoMapper { * @return */ List batchSelectConnectorList(@Param("stationIds") List stationIds); + + /** + * 查询异常设备数量 + * @param stationId + * @return + */ + List queryAbnormalDeviceCount(String stationId); } 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 a7ed68530..4d48d9cb1 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 @@ -176,4 +176,11 @@ public interface PileConnectorInfoService { * @return */ public BusinessConnectorInfoVO getBusinessPileConnectorDetail(String pileConnectorCode); + + /** + * 查询异常设备数量 + * @param id + * @return + */ + int queryAbnormalDeviceCount(String id); } 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 bf8dd217b..66f06bdf1 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 @@ -1164,4 +1164,20 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService { vo.setBusinessConnectorDetail(detailVO); return vo; } + + + /** + * 统计异常设备数量 + * @param stationId + * @return + */ + @Override + public int queryAbnormalDeviceCount(String stationId) { + List list = pileConnectorInfoMapper.queryAbnormalDeviceCount(stationId); + if (CollectionUtils.isEmpty(list)){ + return 0; + } + Set set = new HashSet<>(list); + return set.size(); + } } 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 d77a32267..d30104ad5 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 @@ -25,6 +25,7 @@ import com.jsowell.pile.dto.business.StationBusinessAnalyzeInfoDTO; import com.jsowell.pile.dto.business.StationStatisticsInfoDTO; import com.jsowell.pile.dto.lutongyunting.BindParkingPlatformDTO; import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; +import com.jsowell.pile.mapper.OrderBasicInfoMapper; import com.jsowell.pile.mapper.PileStationInfoMapper; import com.jsowell.pile.service.*; import com.jsowell.pile.util.UserUtils; @@ -49,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.text.DecimalFormat; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.TimeUnit; @@ -100,6 +102,8 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { @Autowired private SettleOrderReportService settleOrderReportService; + @Autowired + private OrderBasicInfoMapper orderBasicInfoMapper; /** * 查询充电站信息 @@ -586,6 +590,18 @@ public class PileStationInfoServiceImpl implements PileStationInfoService { stationVO.setVipServicePrice(currentTimePriceDetails.getVipServicePrice()); stationVO.setVipTotalPrice(currentTimePriceDetails.getVipTotalPrice()); } + + //根据站点id查询订单最后一次交易时间 + LocalDateTime lastChargeTime = orderBasicInfoMapper.queryOrderCreateTimeByStationId(pileStationVO.getId()); + if (lastChargeTime != null) { + String s = lastChargeTime.toString(); + String replace = s.replace("T" , " "); + stationVO.setLastChargeTime(replace); + } + + //根据站点id查询异常设备数量 + stationVO.setAbnormalDeviceCount(pileConnectorInfoService.queryAbnormalDeviceCount(pileStationVO.getId())); + stationVOList.add(stationVO); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/StationInfoVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/StationInfoVO.java index eace4ffa5..a110a34f4 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/StationInfoVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/StationInfoVO.java @@ -133,6 +133,16 @@ public class StationInfoVO { */ private boolean collectedFlag; + /** + * 当前站点最近充电的一次时间 + */ + private String lastChargeTime; + + /** + * 异常设备数量 + */ + private int abnormalDeviceCount; + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 399721f6b..66512b7cf 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -3119,4 +3119,16 @@ + + \ No newline at end of file diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml index 4e5cf5e33..1cd4b3f08 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml @@ -305,4 +305,16 @@ #{stationId, jdbcType=VARCHAR} + + \ No newline at end of file From 8881d5512345a808fec61c32f72611343d623bd6 Mon Sep 17 00:00:00 2001 From: "YAS\\29473" <2947326429@qq.com> Date: Tue, 8 Apr 2025 09:11:39 +0800 Subject: [PATCH 04/18] update --- .../src/main/resources/mapper/pile/OrderBasicInfoMapper.xml | 2 ++ .../main/resources/mapper/pile/PileConnectorInfoMapper.xml | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml index 66512b7cf..97174ca91 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/OrderBasicInfoMapper.xml @@ -3125,6 +3125,8 @@ FROM order_basic_info WHERE + del_flag = '0' + and station_id = #{stationId} ORDER BY create_time DESC diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml index 1cd4b3f08..9dc1f336f 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileConnectorInfoMapper.xml @@ -311,10 +311,12 @@ t1.pile_sn FROM pile_connector_info t1 - LEFT JOIN pile_basic_info t2 ON t1.pile_sn = t2.sn + LEFT JOIN pile_basic_info t2 ON (t1.pile_sn = t2.sn and t2.del_flag = '0') WHERE - t1.status = '255' + t1.status in ('255','0') AND t2.station_id = #{stationId,jdbcType=VARCHAR} + AND + t1.del_flag = '0' \ No newline at end of file From ee92864b1968b1bc95780264c7a1cddc3bd77f98 Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 8 Apr 2025 09:27:25 +0800 Subject: [PATCH 05/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsowell/thirdparty/platform/util/HttpRequestUtil.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java index 8c03f2f5e..48a40a5a9 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java @@ -144,6 +144,10 @@ public class HttpRequestUtil { if (ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode().equals(thirdPlatformType)) { params.put("Portname", "wcc-pro"); } + if (ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode().equals(thirdPlatformType)) { + // 内蒙古平台 + params.put("PlatformID", operatorId); + } String sign = GBSignUtils.sign(params, sigSecret); params.put("Sig", sign); From b641e5cb86db478d2c6f486d1704d1bae72205ae Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 8 Apr 2025 10:16:43 +0800 Subject: [PATCH 06/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/ThirdPlatformTypeEnum.java | 2 +- .../service/ThirdPartyPlatformService.java | 1 + .../impl/NeiMengGuPlatformServiceImpl.java | 79 +++++++++++++++++-- .../platform/util/HttpRequestUtil.java | 1 + 4 files changed, 77 insertions(+), 6 deletions(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java index 1ba6534a7..a304c6a4c 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java @@ -18,7 +18,7 @@ public enum ThirdPlatformTypeEnum { HAI_NAN_1_PLATFORM("7", "海南一张网(监管平台)", "578725200"), HAI_NAN_2_PLATFORM("8", "海南一张网(充电平台)", "MAA9A0PP1"), HUA_WEI("9", "华为平台", "MA5GTQ528"), - NEI_MENG_GU_PLATFORM("10", "内蒙古平台", ""), + NEI_MENG_GU_PLATFORM("10", "内蒙古平台", "MAB03NTXZ"), QING_HAI_PLATFORM("11", "青海平台", "630000000"), DIAN_XING_PLATFORM("12", "宁波点行停车平台", ""), NING_XIA_PLATFORM("13", "宁夏平台", "MA01H3BQ9"), diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java index 8b1551d17..09517a058 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java @@ -7,6 +7,7 @@ import com.google.common.collect.Maps; import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.Constants; import com.jsowell.common.core.redis.RedisCache; +import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.JWTUtils; import com.jsowell.common.util.StringUtils; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index 5ca48cccd..ee9d15700 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -1,13 +1,17 @@ package com.jsowell.thirdparty.platform.service.impl; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; +import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum; import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; @@ -16,6 +20,7 @@ import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.*; +import com.jsowell.common.util.bean.BeanUtils; import com.jsowell.pile.domain.OrderBasicInfo; import com.jsowell.pile.domain.OrderDetail; import com.jsowell.pile.domain.ThirdPartyPlatformConfig; @@ -41,15 +46,13 @@ import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo; import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo; import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo; import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO; +import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO; import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO; import com.jsowell.thirdparty.platform.domain.*; import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory; -import com.jsowell.thirdparty.platform.util.Cryptos; -import com.jsowell.thirdparty.platform.util.Encodes; -import com.jsowell.thirdparty.platform.util.HttpRequestUtil; -import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils; +import com.jsowell.thirdparty.platform.util.*; import com.jsowell.thirdparty.service.ThirdpartySecretInfoService; import com.yi.business.geo.GeoCodeInfo; import com.yi.business.geo.TermRelationTreeCoordinate; @@ -61,6 +64,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.nio.charset.StandardCharsets; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -545,10 +549,75 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { String jsonString = JSON.toJSONString(info); // 获取令牌 String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); - String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, secretInfoVO.getPlatformType()); return result; } + @Override + public String getToken(String urlAddress, String operatorId, String operatorSecret, String dataSecretIv, String signSecret, String dataSecret) { + String token = ""; + // 先查询缓存有没有token + String tokenKey = CacheConstants.THIRD_PARTY_TOKEN_BY_OPERATOR_SECRET + operatorSecret; + RedisCache redisCache = BeanUtils.getBean(RedisCache.class); + String cacheToken = redisCache.getCacheObject(tokenKey); + if (StringUtils.isNotBlank(cacheToken)) { + token = cacheToken; + return token; + } + + try { + // 请求地址 + String requestUrl = urlAddress + "query_token"; + + // 请求data + Map data = new HashMap<>(); + data.put("PlatformID", operatorId); + data.put("OperatorSecret", operatorSecret); + data.put("DataSecretIV", dataSecretIv); + String dataJson = JSONUtil.toJsonStr(data); + + // 加密 + byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes(StandardCharsets.UTF_8), + dataSecret.getBytes(), dataSecretIv.getBytes()); + String strData = Encodes.encodeBase64(encryptText); + + Map request = new LinkedHashMap<>(); + request.put("PlatformID", operatorId); + request.put("Data", strData); + request.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date())); + request.put("Seq", "0001"); + + // 生成签名 + String sig = GBSignUtils.sign(request, signSecret); + request.put("Sig", sig); + + String tokenRequest = JSONUtil.toJsonStr(request); + + String response = HttpUtil.post(requestUrl, tokenRequest); + LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class); +// logger.info("获取令牌 result:{}", result); + + if (result.getRet() == 0) { + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) result.getData()), + dataSecret.getBytes(), dataSecretIv.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + Map resultMap = (Map) JSON.parse(dataStr); + token = String.valueOf(resultMap.get("AccessToken")); + if (resultMap.get("TokenAvailableTime") != null) { + int tokenAvailableTime = Integer.parseInt(String.valueOf(resultMap.get("TokenAvailableTime"))); + // 将token存入缓存 + redisCache.setCacheObject(tokenKey, token, tokenAvailableTime, TimeUnit.SECONDS); + } + // logger.info("token: {}", token); + } + // logger.info("获取令牌 result:{}, token: {}", result, token); + } catch (Exception e) { + return token; + } + return token; + } + /** * 充电订单推送 notification_charge_order_info * diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java index 48a40a5a9..4e5d5bdf4 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java @@ -146,6 +146,7 @@ public class HttpRequestUtil { } if (ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode().equals(thirdPlatformType)) { // 内蒙古平台 + params.remove("OperatorID"); params.put("PlatformID", operatorId); } From 62e7badbddd596e22b7e3007b2a60c20f045b250 Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 8 Apr 2025 15:52:32 +0800 Subject: [PATCH 07/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChargeAlgorithmService.java | 2 +- .../impl/NeiMengGuPlatformServiceImpl.java | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java index 46d281730..94bff2fef 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java @@ -134,7 +134,7 @@ public class ChargeAlgorithmService { data.setChargingDetailInfo(chargingDetailInfos); JSONObject jsonObject = new JSONObject(); - jsonObject.put("dataJason", data); + jsonObject.put("dataJson", data); log.info("发送请求前封装数据 data:{}", JSON.toJSONString(jsonObject)); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index ee9d15700..a76be4fbd 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -200,7 +200,8 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { map.put("ItemSize", pageInfo.getTotal()); map.put("OperatorInfos", operatorInfos); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); + Map resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(), + thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret()); return resultMap; } @@ -303,7 +304,8 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { map.put("PageCount", pageInfo.getPages()); map.put("ItemSize", pageInfo.getTotal()); map.put("StationInfos", resultList); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); + Map resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(), + thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret()); return resultMap; } @@ -409,7 +411,8 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // map.put("Total", total); map.put("StationStatusInfos", collect); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); + Map resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(), + thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret()); return resultMap; } @@ -460,7 +463,8 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 结果集 Map map = Maps.newHashMap(); map.put("StationStatusInfos", stationStatusInfos); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); + Map resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(), + thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret()); return resultMap; } @@ -483,7 +487,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 查询相关配置信息 ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo(); - String operatorId = thirdPartySecretInfoVO.getTheirOperatorId(); + String operatorId = Constants.OPERATORID_LIANLIAN; String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret(); @@ -536,7 +540,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { .build(); // 调用联联平台接口 - String operatorId = secretInfoVO.getTheirOperatorId(); + String operatorId = Constants.OPERATORID_LIANLIAN; String operatorSecret = secretInfoVO.getTheirOperatorSecret(); String signSecret = secretInfoVO.getTheirSigSecret(); String dataSecret = secretInfoVO.getTheirDataSecret(); @@ -635,7 +639,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 查询相关配置信息 ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo(); - String operatorId = thirdPartySecretInfoVO.getTheirOperatorId(); + String operatorId = Constants.OPERATORID_LIANLIAN; String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret(); @@ -696,7 +700,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // return null; // } - String operatorId = secretInfoVO.getTheirOperatorId(); + String operatorId = Constants.OPERATORID_LIANLIAN; String operatorSecret = secretInfoVO.getTheirOperatorSecret(); String signSecret = secretInfoVO.getTheirSigSecret(); String dataSecret = secretInfoVO.getTheirDataSecret(); @@ -757,7 +761,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 查询相关配置信息 ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo(); - String operatorId = thirdPartySecretInfoVO.getTheirOperatorId(); + String operatorId = Constants.OPERATORID_LIANLIAN; String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret(); @@ -816,7 +820,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 查询相关配置信息 ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo(); - String operatorId = thirdPartySecretInfoVO.getTheirOperatorId(); + String operatorId = Constants.OPERATORID_LIANLIAN; String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret(); @@ -954,7 +958,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { if (thirdPartySecretInfoVO == null) { throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL); } - thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_JIANG_SU); + thirdPartySecretInfoVO.setOurOperatorId(Constants.OPERATORID_LIANLIAN); return thirdPartySecretInfoVO; } From f871234f8ec14acf502e371e6d2b7ec49ceb07ff Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 8 Apr 2025 16:06:57 +0800 Subject: [PATCH 08/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/platform/util/HttpRequestUtil.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java index 4e5d5bdf4..f84621db6 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/util/HttpRequestUtil.java @@ -135,7 +135,12 @@ public class HttpRequestUtil { String encryptData = Encodes.encodeBase64(encryptText); Map params = Maps.newLinkedHashMap(); - params.put("OperatorID", operatorId); + if (ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode().equals(thirdPlatformType)) { + // 内蒙古平台 + params.put("PlatformID", operatorId); + }else { + params.put("OperatorID", operatorId); + } params.put("Data", encryptData); params.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date())); params.put("Seq", "001"); @@ -144,11 +149,7 @@ public class HttpRequestUtil { if (ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode().equals(thirdPlatformType)) { params.put("Portname", "wcc-pro"); } - if (ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode().equals(thirdPlatformType)) { - // 内蒙古平台 - params.remove("OperatorID"); - params.put("PlatformID", operatorId); - } + String sign = GBSignUtils.sign(params, sigSecret); params.put("Sig", sign); From 2b12f9e80b579b3351986224e5f131e798c19c42 Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 8 Apr 2025 16:14:51 +0800 Subject: [PATCH 09/18] =?UTF-8?q?update=20=20=E7=94=B5=E6=B1=A0=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E5=BA=94=E7=94=A8Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/domain/ChargeAlgorithmData.java | 50 +++++++++++++++++++ .../service/impl/ChargeAlgorithmService.java | 19 +++++++ 2 files changed, 69 insertions(+) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/ChargeAlgorithmData.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/ChargeAlgorithmData.java index 6b4ef6778..06efcfaec 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/ChargeAlgorithmData.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/ChargeAlgorithmData.java @@ -24,6 +24,56 @@ public class ChargeAlgorithmData { */ private String orderCode; + /** + * 站点详细地址 + */ + private String siteAddress; + + /** + * 站点编号 + */ + private String siteCode; + + /** + * 桩编号 + */ + private String pileCode; + + /** + * 枪编号 + */ + private String gunNo; + + /** + * 车主年龄段 + */ + private String age; + + /** + * 车主性别 + */ + private String gender; + + /** + * 用车场景 + */ + private String scene; + + /** + * 车辆使用年限 + */ + private String serviceLife; + + /** + * 车辆累计里程 + */ + private String odometer; + + /** + * 站点名称 + */ + private String siteName; + /** * 初始SOC */ diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java index 94bff2fef..1e6567158 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java @@ -12,8 +12,10 @@ import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.OrderSplitRecord; import com.jsowell.pile.service.OrderBasicInfoService; import com.jsowell.pile.service.PileBasicInfoService; +import com.jsowell.pile.service.PileStationInfoService; import com.jsowell.pile.thirdparty.ParameterConfigData; import com.jsowell.pile.vo.uniapp.customer.OrderVO; +import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.platform.domain.ChargeAlgorithmData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,6 +45,9 @@ public class ChargeAlgorithmService { @Autowired private PileBasicInfoService pileBasicInfoService; + @Autowired + private PileStationInfoService pileStationInfoService; + @Autowired private RedisCache redisCache; @@ -58,6 +63,9 @@ public class ChargeAlgorithmService { if (orderVO == null) { return "订单信息为空"; } + // 查询站点信息 + PileStationVO stationVO = pileStationInfoService.getStationInfo(orderVO.getStationId()); + // 计算充电时长 long chargingTime = DateUtils.intervalTime(orderVO.getStartTime(), orderVO.getEndTime()); String transactionCode = orderVO.getTransactionCode(); @@ -125,6 +133,17 @@ public class ChargeAlgorithmService { // .gunTemp("0") // 充电枪温度 .doorStatus(Constants.zero) // 舱门状态 + .siteAddress(stationVO.getAddress()) + .siteCode(stationVO.getId()) + .pileCode(orderVO.getPileSn()) + .gunNo(orderVO.getPileConnectorCode()) + .age("0") + .gender("0") + .scene("0") + .serviceLife("0") + .odometer("0") + .siteName(stationVO.getStationName()) + .build(); From 4e97b2a08331f03c043c58774fb265739ff0ad27 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 9 Apr 2025 10:02:43 +0800 Subject: [PATCH 10/18] =?UTF-8?q?update=20=20=E7=94=B5=E6=B1=A0=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E5=BA=94=E7=94=A8Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/thirdparty/common/NotificationService.java | 10 ++++++---- .../platform/service/impl/ChargeAlgorithmService.java | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java index 262f531f6..2c97c5e80 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java @@ -131,10 +131,12 @@ public class NotificationService { logger.error("平台类型:{}, 平台名称:{}, 站点id:{}, 订单编号:{}, 设备充电中状态变化推送error:{}", secretInfoVO.getPlatformType(), secretInfoVO.getPlatformName(), stationId, orderCode, e.getMessage()); } - try { - platformService.notificationEquipChargeStatus(orderCode); - }catch (Exception e){ - logger.error("notification_equip_charge_status error", e); + finally { + try { + platformService.notificationEquipChargeStatus(orderCode); + }catch (Exception e){ + logger.error("notification_equip_charge_status error", e); + } } } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java index 1e6567158..59fe2f367 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java @@ -24,10 +24,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -149,6 +146,10 @@ public class ChargeAlgorithmService { List chargingDetailInfos = transformData(transactionCode, chargerOutputInfoList, parameterConfigData, transactionRecordsData); + chargingDetailInfos.stream() + .filter(info -> info.getCurrentSoc() > 100) // 只处理 currentSoc > 100 的元素 + .forEach(info -> info.setCurrentSoc(100)); + Collections.reverse(chargingDetailInfos); data.setChargingDetailInfo(chargingDetailInfos); From 8e8b091747676f1a6739e4ffbcb7665c709eb702 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 9 Apr 2025 10:04:15 +0800 Subject: [PATCH 11/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/NeiMengGuPlatformServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index a76be4fbd..e16f4bfee 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -784,7 +784,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 转成对应的对象 QueryChargingStatusVO vo = JSONObject.parseObject(dataStr, QueryChargingStatusVO.class); - String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getValue(); + String url = urlAddress + "supervise_notification_equip_charge_status"; // 调用联联平台接口 String jsonString = JSON.toJSONString(vo); From 04419a7180d7616a1c482b7cc37a356b713fe3c2 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 9 Apr 2025 10:21:03 +0800 Subject: [PATCH 12/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/SupEquipChargeStatusInfo.java | 12 ++++ .../impl/NeiMengGuPlatformServiceImpl.java | 66 ++++++++++++++----- 2 files changed, 62 insertions(+), 16 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupEquipChargeStatusInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupEquipChargeStatusInfo.java index 3e454c554..b857bd1d0 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupEquipChargeStatusInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupEquipChargeStatusInfo.java @@ -187,6 +187,18 @@ public class SupEquipChargeStatusInfo { @JSONField(name = "ServiceMoney") private String serviceMoney; + /** + * 电池编码 + */ + @JSONField(name = "BatteryPackID") + private String batteryPackId; + + /** + * 当前电表读数 + */ + @JSONField(name = "CurrentMeter") + private String currentMeter; + /** * 时段数 * 参数范围:0~ 32 diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index e16f4bfee..1d352f4a0 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -16,6 +16,7 @@ import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum; import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.ykc.BillingTimeTypeEnum; +import com.jsowell.common.enums.ykc.OrderStatusEnum; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; @@ -758,6 +759,33 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { public String notificationEquipChargeStatus(String orderCode) { // 根据订单号查询订单信息 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); + // OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode()); + // 根据站点id查询运营商id + PileStationVO stationVO = pileStationInfoService.getStationInfo(orderInfo.getStationId()); + + // 查询枪口实时状态 + List chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode()); + RealTimeMonitorData realTimeMonitorData; + if (CollectionUtils.isEmpty(chargingRealTimeData)) { + realTimeMonitorData = RealTimeMonitorData.builder() + .chargingDegree(Constants.ZERO) + .connectorStatus("3") + .build(); + chargingRealTimeData.add(realTimeMonitorData); + } else { + realTimeMonitorData = chargingRealTimeData.get(0); + } + String orderStatus = orderInfo.getOrderStatus(); + if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderStatus)) { + // 充电中 + orderStatus = "2"; + } else if (StringUtils.equals(OrderStatusEnum.ORDER_COMPLETE.getValue(), orderStatus)) { + // 充电完成 + orderStatus = "4"; + } + BigDecimal current = realTimeMonitorData.getOutputCurrent() == null ? BigDecimal.ZERO : new BigDecimal(realTimeMonitorData.getOutputCurrent()); + BigDecimal voltage = realTimeMonitorData.getOutputVoltage() == null ? BigDecimal.ZERO : new BigDecimal(realTimeMonitorData.getOutputVoltage()); + String soc = realTimeMonitorData.getSOC() == null ? Constants.ZERO : realTimeMonitorData.getSOC(); // 查询相关配置信息 ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNeiMengGuPlatformSecretInfo(); @@ -768,25 +796,31 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv(); String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix(); - // 调用 查询充电状态方法 - QueryEquipChargeStatusDTO dto = new QueryEquipChargeStatusDTO(); - dto.setStartChargeSeq(orderCode); - dto.setOperatorID(thirdPartySecretInfoVO.getTheirOperatorId()); - Map map = queryEquipChargeStatus(dto); - if (map == null) { - return null; - } - String data = map.get("Data"); - // 解密data (此处解密需用 thirdparty_platform_config 的密钥配置) - byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data), - thirdPartySecretInfoVO.getOurDataSecret().getBytes(), thirdPartySecretInfoVO.getOurDataSecretIv().getBytes()); - String dataStr = new String(plainText, StandardCharsets.UTF_8); - // 转成对应的对象 - QueryChargingStatusVO vo = JSONObject.parseObject(dataStr, QueryChargingStatusVO.class); + SupEquipChargeStatusInfo equipChargeStatusInfo = SupEquipChargeStatusInfo.builder() + .operatorID(operatorId) + .equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationVO.getOrganizationCode())) + .stationID(orderInfo.getStationId()) + .equipmentID(orderInfo.getPileSn()) + .orderNo(orderInfo.getOrderCode()) + .orderStatus(Integer.parseInt(orderStatus)) + .connectorID(orderInfo.getPileConnectorCode()) + .equipmentClassification(1) // 车辆充电设备接口 + .pushTimeStamp(DateUtils.dateTimeNow()) + .connectorStatus(Integer.parseInt(realTimeMonitorData.getConnectorStatus())) + .currentA(current) + .voltageA(voltage) + .soc(new BigDecimal(soc)) + .startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime())) + .endTime(DateUtils.getDateTime()) + .totalPower(new BigDecimal(realTimeMonitorData.getChargingDegree())) + .batteryPackId("") + .currentMeter("") + + .build(); String url = urlAddress + "supervise_notification_equip_charge_status"; // 调用联联平台接口 - String jsonString = JSON.toJSONString(vo); + String jsonString = JSON.toJSONString(equipChargeStatusInfo); // 获取令牌 String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); From 74c39bc2be4f52d49ad69f8721e93bf5a8d2f665 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 9 Apr 2025 10:33:57 +0800 Subject: [PATCH 13/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/NeiMengGuPlatformServiceImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index 1d352f4a0..e0ce39cd2 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -506,7 +506,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { String jsonString = JSON.toJSONString(json); // 获取令牌 String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); - String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType); return result; } @@ -683,7 +683,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { JSONObject json = new JSONObject(); json.put("ChargeOrderInfo", orderInfo); String jsonString = JSON.toJSONString(json); - String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType); return result; } @@ -744,7 +744,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { JSONObject json = new JSONObject(); json.put("ChargeOrderInfo", orderInfo); String jsonString = JSON.toJSONString(json); - String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType); return result; } @@ -824,7 +824,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 获取令牌 String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); - String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType); return result; } @@ -890,7 +890,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { JSONObject json = new JSONObject(); json.put("ChargeOrderInfo", orderInfo); String jsonString = JSON.toJSONString(json); - String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType); return result; } From e1d2f028e02bad3383893f087278984297300325 Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 9 Apr 2025 13:42:02 +0800 Subject: [PATCH 14/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/NeiMengGuPlatformServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index e0ce39cd2..595384db4 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -715,7 +715,7 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { } // 推送地址 - String url = urlAddress + "notification_orderInfo"; + String url = urlAddress + "supervise_notification_charge_order_info"; // 拼装成内蒙古平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); From eb09d9dbd99be76aebfe2538eb8681877a128d1e Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 9 Apr 2025 16:09:09 +0800 Subject: [PATCH 15/18] =?UTF-8?q?update=20=20=20=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/NeiMengGuPlatformServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index 595384db4..e98e7b901 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -741,9 +741,9 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { return null; } // 调用联联平台接口 - JSONObject json = new JSONObject(); - json.put("ChargeOrderInfo", orderInfo); - String jsonString = JSON.toJSONString(json); + // JSONObject json = new JSONObject(); + // json.put("ChargeOrderInfo", orderInfo); + String jsonString = JSON.toJSONString(orderInfo); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType); return result; } From 90177f55a66cc5d5417e95863a18181a3055cbc1 Mon Sep 17 00:00:00 2001 From: "YAS\\29473" <2947326429@qq.com> Date: Wed, 9 Apr 2025 19:53:33 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=B1=87=E4=BB=98?= =?UTF-8?q?=E4=BC=9A=E5=91=98id=E6=9F=A5=E8=AF=A2=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=88=86=E8=B4=A6=E7=9A=84=E7=AB=99=E7=82=B9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pile/StationSplitConfigController.java | 25 +++++++++++++++++ .../pile/mapper/StationSplitConfigMapper.java | 8 ++++++ .../service/StationSplitConfigService.java | 8 +++++- .../impl/StationSplitConfigServiceImpl.java | 28 +++++++++++++++++++ .../jsowell/pile/vo/web/SplitConfigVO.java | 11 ++++++++ .../mapper/pile/StationSplitConfigMapper.xml | 9 ++++++ 6 files changed, 88 insertions(+), 1 deletion(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/StationSplitConfigController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/StationSplitConfigController.java index ae16a1fc4..ba607f4a4 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/StationSplitConfigController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/StationSplitConfigController.java @@ -3,7 +3,9 @@ package com.jsowell.web.controller.pile; import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.domain.AjaxResult; import com.jsowell.common.core.page.TableDataInfo; +import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; +import com.jsowell.common.response.RestApiResponse; import com.jsowell.pile.dto.SplitConfigDTO; import com.jsowell.pile.service.StationSplitConfigService; import com.jsowell.pile.vo.web.SplitConfigVO; @@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.List; +import java.util.Map; /** * 站点分成配置controller @@ -56,4 +59,26 @@ public class StationSplitConfigController extends BaseController { } return ajaxResult; } + + /** + * 根据汇付会员id查询配置分账的站点列表 + * /station/splitconfig/queryStationList + * @param adapayMemberId + * @return + */ + @PostMapping("/queryStationList") + public RestApiResponse>> queryStationList(String adapayMemberId) { + RestApiResponse response = null; + Map> result = null; + try { + result = stationSplitConfigService.queryStationList(adapayMemberId); + } catch (BusinessException e) { + logger.error("查询站点列表失败" , e); + response = new RestApiResponse<>(e.getCode() , e.getMessage()); + } catch (Exception e) { + logger.error("查询站点列表失败" , e); + response = new RestApiResponse<>(ReturnCodeEnum.CODE_FAILED); + } + return new RestApiResponse<>(result); + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/StationSplitConfigMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/StationSplitConfigMapper.java index adf38e062..d6f861fc0 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/StationSplitConfigMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/StationSplitConfigMapper.java @@ -1,6 +1,7 @@ package com.jsowell.pile.mapper; import com.jsowell.pile.domain.StationSplitConfig; +import com.jsowell.pile.vo.web.SplitConfigVO; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -26,4 +27,11 @@ public interface StationSplitConfigMapper { int deleteByMerchantIdAndStationId(@Param("merchantId") String merchantId, @Param("stationId") String stationId, @Param("updateBy") String updateBy, @Param("updateTime") Date updateTime); int deleteByStationId(@Param("stationId") String stationId, @Param("updateBy") String updateBy, @Param("updateTime") Date updateTime); + + /** + * 根据汇付会员id查询配置列表 + * @param adapayMemberId + * @return + */ + List queryStationList(String adapayMemberId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/StationSplitConfigService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/StationSplitConfigService.java index 40e5095e4..e9ac82fea 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/StationSplitConfigService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/StationSplitConfigService.java @@ -7,6 +7,7 @@ import com.jsowell.pile.vo.web.SplitConfigVO; import java.util.Date; import java.util.List; +import java.util.Map; /** * 站点分成配置service @@ -50,5 +51,10 @@ public interface StationSplitConfigService { */ List queryShareMembersByStationId(String stationId); - + /** + * 根据站点id查询站点分账配置信息 + * @param adapayMemberId + * @return + */ + Map> queryStationList(String adapayMemberId); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/StationSplitConfigServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/StationSplitConfigServiceImpl.java index 98531dce5..711aa7a5e 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/StationSplitConfigServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/StationSplitConfigServiceImpl.java @@ -27,8 +27,11 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; @Slf4j @Service @@ -286,4 +289,29 @@ public class StationSplitConfigServiceImpl implements StationSplitConfigService{ } return true; } + + /** + * 根据汇付会员id查询配置分账的站点列表 + * + * @param adapayMemberId + * @return + */ + @Override + public Map> queryStationList(String adapayMemberId) { + List stationList = stationSplitConfigMapper.queryStationList(adapayMemberId); + if (stationList == null || stationList.isEmpty()){ + throw new BusinessException("", "未查询到该汇付会员的分账配置信息"); + } + //按照站点id进行去重,再将id按照降序排序,因为站点id为String类型,所以需要先转换为int类型 + stationList = stationList.stream() + .filter(vo -> vo.getStationId() != null && vo.getStationId().matches("^\\d+")) + .distinct() + .sorted((o1, o2) -> Integer.parseInt(o1.getStationId()) - Integer.parseInt(o2.getStationId())) + .collect(Collectors.toList()); + + Map> stationMap = new HashMap<>(); + stationMap.put("stationList", stationList); + return stationMap; + } + } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/SplitConfigVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/SplitConfigVO.java index 3336117bd..211db6203 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/SplitConfigVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/SplitConfigVO.java @@ -39,4 +39,15 @@ public class SplitConfigVO { */ private String feeFlag; + /** + * 站点id + */ + private String stationId; + + /** + * 站点名称 + */ + private String stationName; + + } diff --git a/jsowell-pile/src/main/resources/mapper/pile/StationSplitConfigMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/StationSplitConfigMapper.xml index a956ac38d..88b6be720 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/StationSplitConfigMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/StationSplitConfigMapper.xml @@ -32,6 +32,15 @@ order by fee_flag + + insert into station_split_config From fd90a5e3129f1f5df22b803a9afef8fa17353827 Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 10 Apr 2025 09:09:49 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E5=86=85?= =?UTF-8?q?=E8=92=99=E5=8F=A4=E5=B9=B3=E5=8F=B0=E6=8E=A8=E9=80=81=E5=85=85?= =?UTF-8?q?=E6=8D=A2=E7=94=B5=E7=AB=99=E7=94=A8=E8=83=BD=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/thirdparty/NeiMengGuController.java | 26 +++++-- .../platform/domain/SupStationStatsInfo.java | 24 +++++++ .../impl/NeiMengGuPlatformServiceImpl.java | 68 +++++++++++++++++-- 3 files changed, 110 insertions(+), 8 deletions(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/NeiMengGuController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/NeiMengGuController.java index 7cb6e314b..8f841c8be 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/NeiMengGuController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/NeiMengGuController.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON; import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.enums.thirdparty.ThirdPartyReturnCodeEnum; import com.jsowell.common.exception.BusinessException; +import com.jsowell.common.response.RestApiResponse; import com.jsowell.pile.dto.QueryOperatorInfoDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.thirdparty.CommonParamsDTO; @@ -11,10 +12,7 @@ import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.Map; @@ -153,4 +151,24 @@ public class NeiMengGuController extends ThirdPartyBaseController { } } + /** + * 推送充换电站用能统计信息 notificationOperationStatsInfo + * @return + */ + @GetMapping("/v1/notificationOperationStatsInfo/{stationId}") + public RestApiResponse notificationOperationStatsInfo(@PathVariable String stationId) { + logger.info("{}-推送充换电站用能统计信息 params:{}", platformName, stationId); + RestApiResponse response = null; + try { + // 执行逻辑 + String result = platformLogic.notificationOperationStatsInfo(stationId); + response = new RestApiResponse<>(result); + } catch (Exception e) { + logger.error("{}-推送充换电站用能统计信息", platformName, e); + response = new RestApiResponse<>(e); + } + logger.info("{}-推送充换电站用能统计信息 result:{}", platformName, response); + return response; + } + } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupStationStatsInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupStationStatsInfo.java index 8ab818b72..993f1edb9 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupStationStatsInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupStationStatsInfo.java @@ -56,6 +56,30 @@ public class SupStationStatsInfo { @JSONField(name = "StationElectricity") private BigDecimal stationElectricity; + /** + * 累计充电量 + */ + @JSONField(name = "DailyChargeEnergy") + private BigDecimal dailyChargeEnergy; + + /** + * 累计其他电量 + */ + @JSONField(name = "DailyOtherEnergy") + private BigDecimal dailyOtherEnergy; + + /** + * 累计换电次数 + */ + @JSONField(name = "DailySwapNum") + private Integer dailySwapNum; + + /** + * 累计充电次数 + */ + @JSONField(name = "DailyChargeNum") + private Integer dailyChargeNum; + /** * 充换电站累计充电量 */ diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java index e98e7b901..a8215d158 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NeiMengGuPlatformServiceImpl.java @@ -34,6 +34,7 @@ import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.pile.util.MerchantUtils; +import com.jsowell.pile.vo.SupStationStatsVO; import com.jsowell.pile.vo.ThirdPartySecretInfoVO; import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.MerchantInfoVO; @@ -66,6 +67,7 @@ import java.math.RoundingMode; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.TimeUnit; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -836,7 +838,65 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public String notificationOperationStatsInfo(String stationId) { - return ThirdPartyPlatformService.super.notificationOperationStatsInfo(stationId); + List resultList = new ArrayList<>(); + // 根据站点id查询订单记录 (新建Service方法) + List orderVOS = orderBasicInfoService.queryOrderListByStationId(stationId); + // 根据订单信息汇总出站点充电数据 + BigDecimal stationTotalElectricity = BigDecimal.ZERO; // 充电站累计用电量 + int stationChargeTime = Constants.zero; // 充电站累计充电次数 + for (SupStationStatsVO orderVO : orderVOS) { + // 充电站累计用电量 + BigDecimal totalPower = orderVO.getTotalPower(); + if (totalPower == null || orderVO.getChargingTime() == null) { + continue; + } + stationTotalElectricity = stationTotalElectricity.add(totalPower); + // 充电站累计充电时长(分钟) + stationChargeTime += orderVO.getChargingTime(); + } + + // 创建对象 + String startTime = DateUtils.getYesterdayStr() + " 00:00:00"; + String endTime = DateUtils.getYesterdayStr() + " 23:59:59"; + SupStationStatsInfo supStationStatsInfo = SupStationStatsInfo.builder() + .stationId(stationId) + .operatorId(Constants.OPERATORID_JIANG_SU) + .equipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(orderVOS.get(0).getOrganizationCode())) + // .stationClassification(1) + .startTime(startTime) + .endTime(endTime) + .stationElectricity(stationTotalElectricity) + .dailyChargeEnergy(stationTotalElectricity) + .dailyOtherEnergy(new BigDecimal("0")) + .dailySwapNum(0) + .dailyChargeNum(orderVOS.size()) + .stationTotalChargeTime(stationChargeTime) + .stationTotalSwapTime(0) + .stationTotalWarningNum(0) + .build(); + resultList.add(supStationStatsInfo); + + JSONObject json = new JSONObject(); + json.put("StationStatsInfos", resultList); + String jsonString = JSON.toJSONString(json); + // 发送推送请求 + ThirdPartySecretInfoVO ningXiaSecretInfo = getNeiMengGuPlatformSecretInfo(); + + String operatorId = Constants.OPERATORID_LIANLIAN; + String operatorSecret = ningXiaSecretInfo.getTheirOperatorSecret(); + String signSecret = ningXiaSecretInfo.getTheirSigSecret(); + String dataSecret = ningXiaSecretInfo.getTheirDataSecret(); + String dataSecretIv = ningXiaSecretInfo.getTheirDataSecretIv(); + String urlAddress = ningXiaSecretInfo.getTheirUrlPrefix(); + String url = urlAddress + "supervise_notification_operation_stats_info"; + // 获取令牌 + String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); + if (StringUtils.isBlank(token)) { + return null; + } + // 调用平台接口 + String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType); + return result; } /** @@ -887,9 +947,9 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { return null; } // 调用联联平台接口 - JSONObject json = new JSONObject(); - json.put("ChargeOrderInfo", orderInfo); - String jsonString = JSON.toJSONString(json); + // JSONObject json = new JSONObject(); + // json.put("ChargeOrderInfo", orderInfo); + String jsonString = JSON.toJSONString(orderInfo); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType); return result; } From fd8b33d5db54ae4c68756f85a99bc7183649b8f3 Mon Sep 17 00:00:00 2001 From: Lemon Date: Thu, 10 Apr 2025 09:49:59 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E5=86=85?= =?UTF-8?q?=E8=92=99=E5=8F=A4=E5=B9=B3=E5=8F=B0=E6=8E=A8=E9=80=81=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=AE=A2=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/thirdparty/NeiMengGuController.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/NeiMengGuController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/NeiMengGuController.java index 8f841c8be..8ea231fa3 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/NeiMengGuController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/NeiMengGuController.java @@ -171,4 +171,24 @@ public class NeiMengGuController extends ThirdPartyBaseController { return response; } + /** + * 推送历史充电订单 notificationChargeOrderInfoHistory + * @return + */ + @GetMapping("/v1/notificationChargeOrderInfoHistory/{orderCode}") + public RestApiResponse notificationChargeOrderInfoHistory(@PathVariable String orderCode) { + logger.info("{}-推送历史充电订单 params:{}", platformName, orderCode); + RestApiResponse response = null; + try { + // 执行逻辑 + String result = platformLogic.notificationChargeOrderInfoHistory(orderCode); + response = new RestApiResponse<>(result); + } catch (Exception e) { + logger.error("{}-推送历史充电订单", platformName, e); + response = new RestApiResponse<>(e); + } + logger.info("{}-推送历史充电订单 result:{}", platformName, response); + return response; + } + }