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 new file mode 100644 index 000000000..7aeca9054 --- /dev/null +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/GuiZhouPlatformController.java @@ -0,0 +1,153 @@ +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.exception.BusinessException; +import com.jsowell.pile.dto.QueryOperatorInfoDTO; +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; + +/** + * 浙江省平台 + */ +@Anonymous +@RestController +@RequestMapping("/guizhou") +public class GuiZhouPlatformController extends ThirdPartyBaseController { + private final String platformName = "贵州省平台"; + + @Autowired + @Qualifier("guiZhouPlatformServiceImpl") + 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(0, "请求令牌成功!", map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("{}-获取token接口, 异常, params:{}", platformName, JSON.toJSONString(dto), e); + return CommonResult.failed("获取token发生异常"); + } + } + + /** + * 查询运营商信息 + * supervise_query_operator_info + */ + @PostMapping("/v1/supervise_query_operator_info") + public CommonResult queryOperatorInfo(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + logger.info("{}-查询运营商信息 params:{}", platformName, JSON.toJSONString(dto)); + try { + // 校验令牌 + boolean verifyToken = verifyToken(request.getHeader("Authorization")); + if (!verifyToken) { + // 校验失败 + return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR); + } + + // 校验签名 + if (!verifySignature(dto)) { + // 签名错误 + return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR); + } + + // 解析入参 + QueryOperatorInfoDTO paramDTO = parseParamsDTO(dto, QueryOperatorInfoDTO.class); + + // 执行逻辑 + Map map = platformLogic.queryOperatorInfo(paramDTO); + logger.info("{}-查询运营商信息 result:{}", platformName, JSON.toJSONString(map)); + return CommonResult.success(0, "操作成功!", map.get("Data"), map.get("Sig")); + } catch (BusinessException e) { + return CommonResult.failed(Integer.parseInt(e.getCode()), e.getMessage()); + } catch (Exception e) { + logger.error("{}-查询运营商信息 异常", platformName, e); + return CommonResult.failed("查询运营商信息发生异常"); + } + } + + /** + * 查询充电站信息 + * supervise_query_stations_info + */ + @PostMapping("/v1/supervise_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); + } + + // 校验签名 + if (!verifySignature(dto)) { + // 签名错误 + return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR); + } + + // 解析入参 + QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class); + + // 执行逻辑 + Map map = platformLogic.queryStationsInfo(queryStationInfoDTO); + + return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.info("{}-查询充电站信息 error:", platformName, e); + } + return CommonResult.failed("查询充电站信息发生异常"); + } + + /** + * 查询充电站状态信息 + * supervise_query_station_status + */ + @PostMapping("/v1/supervise_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); + } + + // 校验签名 + if (!verifySignature(dto)) { + // 签名错误 + return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR); + } + + // 解析入参 + QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class); + + // 执行逻辑 + Map map = platformLogic.queryStationStatus(queryStationInfoDTO); + + return CommonResult.success(0, "查询充电站状态信息成功!", map.get("Data"), map.get("Sig")); + } catch (Exception e) { + logger.error("{}-查询充电站状态信息 error:", platformName, e); + } + return CommonResult.failed("查询充电站状态信息发生异常"); + } +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServicelmp.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServiceImp.java similarity index 99% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServicelmp.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServiceImp.java index 0f7fc5e0f..6b8e64478 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServicelmp.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/NanRuiPlatfromServiceImp.java @@ -27,7 +27,6 @@ import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.pile.vo.ThirdPartySecretInfoVO; import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; -import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import com.jsowell.pile.vo.nanrui.JiangSuOrderInfoVO; import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails; import com.jsowell.pile.vo.web.PileConnectorInfoVO; @@ -60,7 +59,7 @@ import java.util.stream.Collectors; * 南瑞 */ @Service -public class NanRuiPlatfromServicelmp implements ThirdPartyPlatformService { +public class NanRuiPlatfromServiceImp implements ThirdPartyPlatformService { private final String thirdPlatformType = ThirdPlatformTypeEnum.NAN_RUI_PLATFORM.getTypeCode(); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServicelmpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServiceImpl.java similarity index 99% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServicelmpl.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServiceImpl.java index 0eea30caa..661a9531c 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServicelmpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/XinDiantuPlatfromServiceImpl.java @@ -61,7 +61,7 @@ import java.util.stream.Collectors; * 新电途 */ @Service -public class XinDiantuPlatfromServicelmpl implements ThirdPartyPlatformService { +public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService { private final String thirdPlatformType = ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(); @Autowired diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServicelmpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServiceImpl.java similarity index 99% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServicelmpl.java rename to jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServiceImpl.java index ee33af942..7dcd8cbf1 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServicelmpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/YongChengbochePlatfromServiceImpl.java @@ -55,7 +55,7 @@ import java.util.stream.Collectors; * 甬城泊车 */ @Service -public class YongChengbochePlatfromServicelmpl implements ThirdPartyPlatformService { +public class YongChengbochePlatfromServiceImpl implements ThirdPartyPlatformService { private final String thirdPlatformType = ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(); @Autowired