From a094a866d0537347c688964aa19ba543d72b4bb5 Mon Sep 17 00:00:00 2001 From: Lemon Date: Sat, 11 Jan 2025 16:06:25 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E6=96=B0=E8=BF=90?= =?UTF-8?q?=E5=BE=AE=E5=B9=B3=E5=8F=B0Controller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XinYunWeiPlatformController.java | 191 ++++++++++++++++++ .../thirdparty/ThirdPlatformTypeEnum.java | 2 +- ...java => XinYunWeiPlatformServiceImpl.java} | 20 +- 3 files changed, 202 insertions(+), 11 deletions(-) create mode 100644 jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunWeiPlatformController.java rename jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/{XinYunPlatformServiceImpl.java => XinYunWeiPlatformServiceImpl.java} (98%) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunWeiPlatformController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunWeiPlatformController.java new file mode 100644 index 000000000..2404fd43e --- /dev/null +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunWeiPlatformController.java @@ -0,0 +1,191 @@ +package com.jsowell.api.thirdparty; + +import com.alibaba.fastjson2.JSON; +import com.jsowell.common.annotation.Anonymous; +import com.jsowell.common.enums.thirdparty.ThirdPartyReturnCodeEnum; +import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; +import com.jsowell.pile.dto.QueryEquipChargeStatusDTO; +import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.thirdparty.CommonParamsDTO; +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 javax.servlet.http.HttpServletRequest; +import java.util.Map; + +/** + * 新运微平台Controller + * + * @author Lemon + * @Date 2025/1/11 15:55:34 + */ +@Anonymous +@RestController +@RequestMapping("/xinyunwei") +public class XinYunWeiPlatformController extends ThirdPartyBaseController{ + private final String platformName = "新运微平台"; + + private final String platformType = ThirdPlatformTypeEnum.XIN_YUN_WEI_PLATFORM.getTypeCode(); + + @Autowired + @Qualifier("xinYunWeiPlatformServiceImpl") + private ThirdPartyPlatformService platformLogic; + + /** + * getToken + */ + @PostMapping("/v1/query_token") + public CommonResult queryToken(@RequestBody CommonParamsDTO dto) { + // logger.info("{}-请求令牌 params:{}", platformName, JSON.toJSONString(dto)); + try { + Map map = platformLogic.queryToken(dto); + logger.info("{}-请求令牌, params:{}, result:{}", platformName, JSON.toJSONString(dto), JSON.toJSONString(map)); + return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("{}-获取token接口, 异常, params:{}", platformName, JSON.toJSONString(dto), e); + return CommonResult.failed("获取token发生异常"); + } + } + + /** + * 查询充电站信息 + * query_stations_info + */ + @PostMapping("/v1/query_stations_info") + public CommonResult query_stations_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("{}-查询充电站信息 params:{}", platformName, JSON.toJSONString(dto)); + try { + // 校验令牌 + if (!verifyToken(request.getHeader("Authorization"))) { + // 校验失败 + return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR); + } + dto.setPlatformType(platformType); + + // 校验签名 + if (!verifySignature(dto)) { + // 签名错误 + return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR); + } + + // 解析入参 + QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class); + + // 执行逻辑 + Map map = platformLogic.queryStationsInfo(queryStationInfoDTO); + + return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.info("{}-查询充电站信息 error:", platformName, e); + } + return CommonResult.failed("查询充电站信息发生异常"); + } + + /** + * 查询充电站状态信息 + * query_station_status + */ + @PostMapping("/v1/query_station_status") + public CommonResult queryStationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("{}-查询充电站状态信息 params:{}", platformName, JSON.toJSONString(dto)); + try { + // 校验令牌 + if (!verifyToken(request.getHeader("Authorization"))) { + // 校验失败 + return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR); + } + dto.setPlatformType(platformType); + + // 校验签名 + if (!verifySignature(dto)) { + // 签名错误 + return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR); + } + + // 解析入参 + QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class); + + // 执行逻辑 + Map map = platformLogic.queryStationStatus(queryStationInfoDTO); + + return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("{}-查询充电站状态信息 error:", platformName, e); + } + return CommonResult.failed("查询充电站状态信息发生异常"); + } + + /** + * 查询充电站统计信息 + * query_station_stats + */ + @PostMapping("/v1/query_station_stats") + public CommonResult queryStationStats(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("{}-查询充电站统计信息 params:{}", platformName, JSON.toJSONString(dto)); + try { + // 校验令牌 + if (!verifyToken(request.getHeader("Authorization"))) { + // 校验失败 + return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR); + } + dto.setPlatformType(platformType); + + // 校验签名 + if (!verifySignature(dto)) { + // 签名错误 + return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR); + } + + // 解析入参 + QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class); + + // 执行逻辑 + Map map = platformLogic.queryStationStats(queryStationInfoDTO); + + return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("{}-查询充电站统计信息 error:", platformName, e); + } + return CommonResult.failed("查询充电站统计信息发生异常"); + } + + /** + * 查询充电状态 + * query_equip_charge_status + */ + @PostMapping("/v1/query_equip_charge_status") + public CommonResult queryEquipChargeStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("{}-查询充电状态 params:{}", platformName, JSON.toJSONString(dto)); + try { + // 校验令牌 + if (!verifyToken(request.getHeader("Authorization"))) { + // 校验失败 + return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR); + } + dto.setPlatformType(platformType); + + // 校验签名 + if (!verifySignature(dto)) { + // 签名错误 + return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR); + } + + // 解析入参 + QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = parseParamsDTO(dto, QueryEquipChargeStatusDTO.class); + + // 执行逻辑 + Map map = platformLogic.queryEquipChargeStatus(queryEquipChargeStatusDTO); + + return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("{}-查询充电状态 error:", platformName, e); + } + return CommonResult.failed("查询充电状态发生异常"); + } +} 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 c12f189ca..0c0701a67 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 @@ -30,7 +30,7 @@ public enum ThirdPlatformTypeEnum { NAN_RUI_PLATFORM("19", "南瑞平台", ""), GUANG_XI_PLATFORM("20", "广西平台", "450000000"), - XIN_YUN_PLATFORM("21", "新运平台", ""), + XIN_YUN_WEI_PLATFORM("21", "新运微平台", ""), ; private String typeCode; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunWeiPlatformServiceImpl.java similarity index 98% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunWeiPlatformServiceImpl.java index 87ca6217e..40b7e8758 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunWeiPlatformServiceImpl.java @@ -60,7 +60,7 @@ import java.util.stream.Collectors; * @Date 2025/1/10 8:28:43 */ @Service -public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { +public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private PileStationInfoService pileStationInfoService; @@ -80,7 +80,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { private RedisCache redisCache; // 平台类型 - private final String thirdPlatformType = ThirdPlatformTypeEnum.XIN_YUN_PLATFORM.getTypeCode(); + private final String thirdPlatformType = ThirdPlatformTypeEnum.XIN_YUN_WEI_PLATFORM.getTypeCode(); @Override public void afterPropertiesSet() throws Exception { @@ -104,7 +104,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { // token缓存key值 String redisKey = operatorId + "_token:"; // 通过operatorId 查出 operatorSecret - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); if (thirdPartySecretInfoVO == null) { failReason = 1; succStat = 1; @@ -164,7 +164,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { return null; } // ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId()); - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); PageInfo pageInfo = new PageInfo<>(stationInfos); List resultList = new ArrayList<>(); for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { @@ -231,7 +231,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { List stationIds = dto.getStationIds(); List StationStatusInfos = new ArrayList<>(); List ConnectorStatusInfos = new ArrayList<>(); - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); ConnectorStatusInfo connectorStatusInfo; for (String stationId : stationIds) { @@ -299,7 +299,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public Map queryStationStats(QueryStationInfoDTO dto) { - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); // 根据站点id 查出这段时间的充电量 List list = orderBasicInfoService.getAccumulativeInfoForLianLian(dto); if (CollectionUtils.isEmpty(list)) { @@ -390,7 +390,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { if (orderInfo == null) { return null; } - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode()); // 通过订单号查询实时数据 List realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode()); @@ -454,7 +454,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) { - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); String operatorId = Constants.OPERATORID_JIANG_SU; String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); @@ -512,7 +512,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { BigDecimal voltage = realTimeMonitorData.getOutputVoltage() == null ? BigDecimal.ZERO : new BigDecimal(realTimeMonitorData.getOutputVoltage()); String soc = realTimeMonitorData.getSOC() == null ? Constants.ZERO : realTimeMonitorData.getSOC(); // 查询相关配置信息 - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); String operatorId = Constants.OPERATORID_JIANG_SU; String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); @@ -621,7 +621,7 @@ public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { * * @return */ - private ThirdPartySecretInfoVO getXinYunPlatformSecretInfo() { + private ThirdPartySecretInfoVO getXinYunWeiPlatformSecretInfo() { // 通过第三方平台类型查询相关配置信息 ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType); if (thirdPartySecretInfoVO == null) { From 569b78bca6a965eadb99107d9ad3edf03ed619a9 Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 13 Jan 2025 09:15:43 +0800 Subject: [PATCH 2/5] =?UTF-8?q?update=20=E6=96=B0=E8=BF=90=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ler.java => XinYunPlatformController.java} | 12 +++++------ .../thirdparty/ThirdPlatformTypeEnum.java | 2 +- ...pl.java => XinYunPlatformServiceImpl.java} | 20 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) rename jsowell-admin/src/main/java/com/jsowell/api/thirdparty/{XinYunWeiPlatformController.java => XinYunPlatformController.java} (96%) rename jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/{XinYunWeiPlatformServiceImpl.java => XinYunPlatformServiceImpl.java} (98%) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunWeiPlatformController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunPlatformController.java similarity index 96% rename from jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunWeiPlatformController.java rename to jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunPlatformController.java index 2404fd43e..03444eba5 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunWeiPlatformController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/XinYunPlatformController.java @@ -20,21 +20,21 @@ import javax.servlet.http.HttpServletRequest; import java.util.Map; /** - * 新运微平台Controller + * 新运平台Controller * * @author Lemon * @Date 2025/1/11 15:55:34 */ @Anonymous @RestController -@RequestMapping("/xinyunwei") -public class XinYunWeiPlatformController extends ThirdPartyBaseController{ - private final String platformName = "新运微平台"; +@RequestMapping("/xinyun") +public class XinYunPlatformController extends ThirdPartyBaseController{ + private final String platformName = "新运平台"; - private final String platformType = ThirdPlatformTypeEnum.XIN_YUN_WEI_PLATFORM.getTypeCode(); + private final String platformType = ThirdPlatformTypeEnum.XIN_YUN_PLATFORM.getTypeCode(); @Autowired - @Qualifier("xinYunWeiPlatformServiceImpl") + @Qualifier("xinYunPlatformServiceImpl") private ThirdPartyPlatformService platformLogic; /** 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 0c0701a67..64fced732 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 @@ -30,7 +30,7 @@ public enum ThirdPlatformTypeEnum { NAN_RUI_PLATFORM("19", "南瑞平台", ""), GUANG_XI_PLATFORM("20", "广西平台", "450000000"), - XIN_YUN_WEI_PLATFORM("21", "新运微平台", ""), + XIN_YUN_PLATFORM("21", "新运平台", "MADKXL8FX"), ; private String typeCode; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunWeiPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java similarity index 98% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunWeiPlatformServiceImpl.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java index 40b7e8758..87ca6217e 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunWeiPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinYunPlatformServiceImpl.java @@ -60,7 +60,7 @@ import java.util.stream.Collectors; * @Date 2025/1/10 8:28:43 */ @Service -public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { +public class XinYunPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private PileStationInfoService pileStationInfoService; @@ -80,7 +80,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { private RedisCache redisCache; // 平台类型 - private final String thirdPlatformType = ThirdPlatformTypeEnum.XIN_YUN_WEI_PLATFORM.getTypeCode(); + private final String thirdPlatformType = ThirdPlatformTypeEnum.XIN_YUN_PLATFORM.getTypeCode(); @Override public void afterPropertiesSet() throws Exception { @@ -104,7 +104,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { // token缓存key值 String redisKey = operatorId + "_token:"; // 通过operatorId 查出 operatorSecret - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); if (thirdPartySecretInfoVO == null) { failReason = 1; succStat = 1; @@ -164,7 +164,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { return null; } // ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId()); - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); PageInfo pageInfo = new PageInfo<>(stationInfos); List resultList = new ArrayList<>(); for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { @@ -231,7 +231,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { List stationIds = dto.getStationIds(); List StationStatusInfos = new ArrayList<>(); List ConnectorStatusInfos = new ArrayList<>(); - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); ConnectorStatusInfo connectorStatusInfo; for (String stationId : stationIds) { @@ -299,7 +299,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public Map queryStationStats(QueryStationInfoDTO dto) { - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); // 根据站点id 查出这段时间的充电量 List list = orderBasicInfoService.getAccumulativeInfoForLianLian(dto); if (CollectionUtils.isEmpty(list)) { @@ -390,7 +390,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { if (orderInfo == null) { return null; } - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode()); // 通过订单号查询实时数据 List realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode()); @@ -454,7 +454,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { */ @Override public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) { - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); String operatorId = Constants.OPERATORID_JIANG_SU; String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); @@ -512,7 +512,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { BigDecimal voltage = realTimeMonitorData.getOutputVoltage() == null ? BigDecimal.ZERO : new BigDecimal(realTimeMonitorData.getOutputVoltage()); String soc = realTimeMonitorData.getSOC() == null ? Constants.ZERO : realTimeMonitorData.getSOC(); // 查询相关配置信息 - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunWeiPlatformSecretInfo(); + ThirdPartySecretInfoVO thirdPartySecretInfoVO = getXinYunPlatformSecretInfo(); String operatorId = Constants.OPERATORID_JIANG_SU; String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); @@ -621,7 +621,7 @@ public class XinYunWeiPlatformServiceImpl implements ThirdPartyPlatformService { * * @return */ - private ThirdPartySecretInfoVO getXinYunWeiPlatformSecretInfo() { + private ThirdPartySecretInfoVO getXinYunPlatformSecretInfo() { // 通过第三方平台类型查询相关配置信息 ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType); if (thirdPartySecretInfoVO == null) { From d691a993e18084b57b5b4af0143440caed248d14 Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 13 Jan 2025 10:47:10 +0800 Subject: [PATCH 3/5] =?UTF-8?q?bugfix=20=E8=B4=B5=E5=B7=9E=E7=9C=81?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GuiZhouPlatformServiceImpl.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java index fc22b3128..6699638aa 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java @@ -446,15 +446,17 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { StationStatusInfo stationStatusInfo = new StationStatusInfo(); PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId); + PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(String.valueOf(stationInfo.getId())); + String organizationCode = pileMerchantInfoVO.getOrganizationCode(); stationStatusInfo.setOperatorId(Constants.OPERATORID_JIANG_SU); - stationStatusInfo.setEquipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationInfo.getOrganizationCode())); + stationStatusInfo.setEquipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(organizationCode)); stationStatusInfo.setStationId(stationId); ConnectorStatusInfo connectorStatusInfo; for (ConnectorInfoVO connectorInfoVO : voList) { connectorStatusInfo = ConnectorStatusInfo.builder() .operatorId(Constants.OPERATORID_JIANG_SU) - .equipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationInfo.getOrganizationCode())) + .equipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(organizationCode)) .stationId(connectorInfoVO.getStationId()) .equipmentId(connectorInfoVO.getPileSn()) .connectorID(connectorInfoVO.getPileConnectorCode()) @@ -544,7 +546,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix(); // 查询站点信息 PileStationVO stationInfo = pileStationInfoService.getStationInfo(orderInfo.getStationId()); - String organizationCode = stationInfo.getOrganizationCode(); + PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(String.valueOf(stationInfo.getId())); + String organizationCode = pileMerchantInfoVO.getOrganizationCode(); // 查询枪口实时状态 List chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode()); @@ -812,7 +815,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { } PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId); - String organizationCode = stationInfo.getOrganizationCode(); + PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(String.valueOf(stationInfo.getId())); + String organizationCode = pileMerchantInfoVO.getOrganizationCode(); // 创建对象 String startTime = DateUtils.getYesterdayStr(); @@ -995,7 +999,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { */ private ChargeOrderInfo transformChargeOrderInfo(OrderBasicInfo orderBasicInfo, OrderDetail orderDetail) { PileStationVO stationInfo = pileStationInfoService.getStationInfo(orderBasicInfo.getStationId()); - String organizationCode = stationInfo.getOrganizationCode(); + PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(String.valueOf(stationInfo.getId())); + String organizationCode = pileMerchantInfoVO.getOrganizationCode(); ChargeOrderInfo chargeOrderInfo = ChargeOrderInfo.builder() .operatorID(Constants.OPERATORID_JIANG_SU) From dbb005326b9a10f24aa8b067be8c448c2cf3876c Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 13 Jan 2025 10:54:24 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=20=E8=B4=B5=E5=B7=9E?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=A1=A5=E6=8E=A8=E8=AE=A2=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thirdparty/GuiZhouPlatformController.java | 10 ++++++++ .../impl/GuiZhouPlatformServiceImpl.java | 25 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/GuiZhouPlatformController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/GuiZhouPlatformController.java index 71f9a9084..ec192f0a9 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/GuiZhouPlatformController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/GuiZhouPlatformController.java @@ -7,6 +7,7 @@ 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.QueryOrderDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.common.CommonResult; @@ -209,4 +210,13 @@ public class GuiZhouPlatformController extends ThirdPartyBaseController { return response; } + + @PostMapping("/tempPushHistoryOrderInfo") + public RestApiResponse tempPushHistoryOrderInfo(@RequestBody QueryOrderDTO dto) { + RestApiResponse response = null; + String result = platformLogic.pushOrderInfo(dto); + response = new RestApiResponse<>(result); + return response; + } + } \ No newline at end of file diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java index 6699638aa..e2b9bc905 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java @@ -21,6 +21,7 @@ import com.jsowell.common.util.*; import com.jsowell.pile.domain.*; import com.jsowell.pile.dto.QueryConnectorListDTO; import com.jsowell.pile.dto.QueryOperatorInfoDTO; +import com.jsowell.pile.dto.QueryOrderDTO; import com.jsowell.pile.dto.QueryStationInfoDTO; import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.CommonParamsDTO; @@ -692,7 +693,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); - List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); + // List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 // List collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); // 再循环该list,拼装对应的充电价格、费率 @@ -710,6 +711,28 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { return result; } + @Override + public String pushOrderInfo(QueryOrderDTO dto) { + // ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo(); + + // 根据站点id, 开始时间,结束时间查询出所有的订单信息 + // List orderListVOS = orderBasicInfoService.selectOrderBasicInfoList(dto); + List orderCodes = orderBasicInfoService.tempGetOrderCodes(dto); + if (CollectionUtils.isEmpty(orderCodes)) { + return "订单信息为空"; + } + // List orderCodeList = orderListVOS.stream().map(OrderListVO::getOrderCode).collect(Collectors.toList()); + for (String orderCode : orderCodes) { + try { + String result = notificationChargeOrderInfoHistory(orderCode); + logger.info("订单:{} 推送结果:{}", orderCode, result); + }catch (Exception e) { + logger.error("订单:{} 推送error, ", orderCode, e); + } + } + return "Success"; + } + /** * 推送充换电站用能统计信息 supervise_notification_operation_stats_info * From 58a0d3947c3b4dd385350d3df99950521218f51d Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 13 Jan 2025 11:35:44 +0800 Subject: [PATCH 5/5] =?UTF-8?q?bugfix=20=20=E8=81=94=E8=81=94=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PileBasicInfoServiceImpl.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index 53c94f8cf..65601422f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -10,6 +10,7 @@ import com.jsowell.common.core.domain.vo.AuthorizedDeptVO; import com.jsowell.common.core.domain.ykc.*; import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.enums.DelFlagEnum; +import com.jsowell.common.enums.lianlian.LianLianPileStatusEnum; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.PileConnectorStatusEnum; import com.jsowell.common.enums.ykc.PileStatusEnum; @@ -1242,7 +1243,18 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { equipmentInfo.setEquipmentType(Integer.valueOf(pileDetailInfoVO.getSpeedType())); equipmentInfo.setEquipmentModel(pileDetailInfoVO.getModelName()); - equipmentInfo.setEquipmentStatus(Integer.valueOf(pileDetailInfoVO.getPileStatus())); + String pileStatus = pileDetailInfoVO.getPileStatus(); + if (StringUtils.equals(PileStatusEnum.ON_LINE.getValue(), pileStatus)) { + // 1-在线 + pileStatus = LianLianPileStatusEnum.NORMAL.getCode(); + } else if (StringUtils.equals(PileStatusEnum.OFF_LINE.getValue(), pileStatus)) { + // 2-离线 + pileStatus = LianLianPileStatusEnum.CLOSE_OFFLINE.getCode(); + } else if (StringUtils.equals(PileStatusEnum.FAULT.getValue(), pileStatus)) { + // 3-故障 + pileStatus = LianLianPileStatusEnum.UNDER_MAINTENANCE.getCode(); + } + equipmentInfo.setEquipmentStatus(Integer.valueOf(pileStatus)); equipmentInfo.setEquipmentPower(new BigDecimal(pileDetailInfoVO.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); equipmentInfo.setNewNationalStandard(1); equipmentInfo.setVinFlag(1);