This commit is contained in:
YAS\29473
2025-10-16 16:36:46 +08:00
parent ca7992470b
commit 2c7b56b1d7

View File

@@ -3,22 +3,15 @@ package com.jsowell.api.thirdparty;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.dto.thirdparty.JCTCommonParamsDTO;
import com.jsowell.common.dto.thirdparty.JCTPushRealTimeInfoDTO;
import com.jsowell.common.dto.thirdparty.JCTQueryEquipmentDTO;
import com.jsowell.common.dto.thirdparty.JCTQueryStationInfoDTO;
import com.jsowell.common.enums.thirdparty.ThirdPartyReturnCodeEnum; import com.jsowell.common.enums.thirdparty.ThirdPartyReturnCodeEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.exception.BusinessException; import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.service.ThirdPartyService;
import com.jsowell.common.util.bean.BeanUtils;
import com.jsowell.pile.dto.*; import com.jsowell.pile.dto.*;
import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.thirdparty.platform.dto.RetryOrderDTO; import com.jsowell.thirdparty.platform.dto.RetryOrderDTO;
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -42,10 +35,6 @@ public class ChangZhouController extends ThirdPartyBaseController {
@Qualifier("changZhouPlatformServiceImpl") @Qualifier("changZhouPlatformServiceImpl")
private ThirdPartyPlatformService platformLogic; private ThirdPartyPlatformService platformLogic;
@DubboReference(group = "third", version = "1.0.0", timeout = 10000)
private ThirdPartyService thirdPartyService;
/** /**
* getToken * getToken
@@ -54,15 +43,8 @@ public class ChangZhouController extends ThirdPartyBaseController {
public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) { public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) {
logger.info("{}-请求令牌 params:{}" , platformName , JSON.toJSONString(dto)); logger.info("{}-请求令牌 params:{}" , platformName , JSON.toJSONString(dto));
try { try {
// Map<String, String> map = platformLogic.queryToken(dto); // Map<String, String> map = zdlService.generateToken(dto);
Map<String, String> map = platformLogic.queryToken(dto);
// 新方法
JCTCommonParamsDTO jctCommonParamsDTO = new JCTCommonParamsDTO();
BeanUtils.copyProperties(dto, jctCommonParamsDTO);
jctCommonParamsDTO.setPlatformType(platformType);
logger.info("请求参数转换后:{}" , JSON.toJSONString(jctCommonParamsDTO));
Map<String, String> map = thirdPartyService.queryToken(jctCommonParamsDTO);
logger.info("{}-请求令牌 result:{}" , platformName , map); logger.info("{}-请求令牌 result:{}" , platformName , map);
return CommonResult.success(0 , "请求令牌成功!" , map.get("Data") , map.get("Sig")); return CommonResult.success(0 , "请求令牌成功!" , map.get("Data") , map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
@@ -96,15 +78,8 @@ public class ChangZhouController extends ThirdPartyBaseController {
// 解析入参 // 解析入参
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto , QueryStationInfoDTO.class); QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto , QueryStationInfoDTO.class);
JCTQueryStationInfoDTO jctQueryStationInfoDTO = new JCTQueryStationInfoDTO();
BeanUtils.copyProperties(queryStationInfoDTO, jctQueryStationInfoDTO);
jctQueryStationInfoDTO.setPlatformType(platformType);
logger.info("请求参数转换后:{}" , JSON.toJSONString(jctQueryStationInfoDTO));
// 执行逻辑 // 执行逻辑
Map<String, String> map = thirdPartyService.queryStationsInfo(jctQueryStationInfoDTO); Map<String, String> map = platformLogic.queryStationsInfo(queryStationInfoDTO);
// 执行逻辑
// Map<String, String> map = platformLogic.queryStationsInfo(queryStationInfoDTO);
logger.info("{}-查询充电站信息 result:{}" , platformName , JSON.toJSONString(map)); logger.info("{}-查询充电站信息 result:{}" , platformName , JSON.toJSONString(map));
return CommonResult.success(0 , "查询充电站信息成功!" , map.get("Data") , map.get("Sig")); return CommonResult.success(0 , "查询充电站信息成功!" , map.get("Data") , map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
@@ -125,14 +100,7 @@ public class ChangZhouController extends ThirdPartyBaseController {
public RestApiResponse<?> notification_stationStatus(@RequestBody PushRealTimeInfoDTO pushRealTimeInfoDTO , HttpServletRequest request) { public RestApiResponse<?> notification_stationStatus(@RequestBody PushRealTimeInfoDTO pushRealTimeInfoDTO , HttpServletRequest request) {
RestApiResponse<?> response = null; RestApiResponse<?> response = null;
try { try {
// String result = platformLogic.notificationStationStatus(pushRealTimeInfoDTO); String result = platformLogic.notificationStationStatus(pushRealTimeInfoDTO);
JCTPushRealTimeInfoDTO jctPushRealTimeInfoDTO = new JCTPushRealTimeInfoDTO();
BeanUtils.copyProperties(pushRealTimeInfoDTO, jctPushRealTimeInfoDTO);
jctPushRealTimeInfoDTO.setPlatformType(platformType);
logger.info("请求参数转换后:{}" , JSON.toJSONString(jctPushRealTimeInfoDTO));
Map<String, String> result = thirdPartyService.notificationStationStatus(jctPushRealTimeInfoDTO);
logger.info("【{}】推送设备状态 result:{}" , this.getClass().getSimpleName() , result); logger.info("【{}】推送设备状态 result:{}" , this.getClass().getSimpleName() , result);
response = new RestApiResponse<>(result); response = new RestApiResponse<>(result);
} catch (BusinessException e) { } catch (BusinessException e) {
@@ -173,16 +141,8 @@ public class ChangZhouController extends ThirdPartyBaseController {
// 解析入参 // 解析入参
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto , QueryStationInfoDTO.class); QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto , QueryStationInfoDTO.class);
// 新方法 // 执行逻辑
JCTQueryStationInfoDTO jctQueryStationInfoDTO = new JCTQueryStationInfoDTO(); Map<String, String> map = platformLogic.queryStationStatus(queryStationInfoDTO);
BeanUtils.copyProperties(queryStationInfoDTO, jctQueryStationInfoDTO);
jctQueryStationInfoDTO.setPlatformType(platformType);
logger.info("请求参数转换后:{}" , JSON.toJSONString(jctQueryStationInfoDTO));
Map<String, String> map = thirdPartyService.queryStationStatus(jctQueryStationInfoDTO);
// 旧方法
// Map<String, String> map = platformLogic.queryStationStatus(queryStationInfoDTO);
logger.info("{}-设备接口状态查询 result:{}" , platformName , map); logger.info("{}-设备接口状态查询 result:{}" , platformName , map);
return CommonResult.success(0 , "设备接口状态查询成功!" , map.get("Data") , map.get("Sig")); return CommonResult.success(0 , "设备接口状态查询成功!" , map.get("Data") , map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
@@ -216,17 +176,8 @@ public class ChangZhouController extends ThirdPartyBaseController {
// 解析入参 // 解析入参
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto , QueryStationInfoDTO.class); QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto , QueryStationInfoDTO.class);
// 执行逻辑
// 新方法 Map<String, String> map = platformLogic.queryStationStats(queryStationInfoDTO);
JCTQueryStationInfoDTO jctQueryStationInfoDTO = new JCTQueryStationInfoDTO();
BeanUtils.copyProperties(queryStationInfoDTO, jctQueryStationInfoDTO);
jctQueryStationInfoDTO.setPlatformType(platformType);
logger.info("请求参数转换后:{}" , JSON.toJSONString(jctQueryStationInfoDTO));
Map<String, String> map = thirdPartyService.queryStationStats(jctQueryStationInfoDTO);
// 旧方法
// Map<String, String> map = platformLogic.queryStationStats(queryStationInfoDTO);
logger.info("{}-查询统计信息 result:{}" , platformName , map); logger.info("{}-查询统计信息 result:{}" , platformName , map);
return CommonResult.success(0 , "查询统计信息成功!" , map.get("Data") , map.get("Sig")); return CommonResult.success(0 , "查询统计信息成功!" , map.get("Data") , map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {
@@ -262,16 +213,8 @@ public class ChangZhouController extends ThirdPartyBaseController {
// 解析入参 // 解析入参
QueryEquipmentDTO queryEquipmentDTO = parseParamsDTO(dto , QueryEquipmentDTO.class); QueryEquipmentDTO queryEquipmentDTO = parseParamsDTO(dto , QueryEquipmentDTO.class);
// 新方法 // 执行逻辑
JCTQueryEquipmentDTO jctQueryEquipmentDTO = new JCTQueryEquipmentDTO(); Map<String, String> map = platformLogic.queryEquipAuth(queryEquipmentDTO);
BeanUtils.copyProperties(queryEquipmentDTO, jctQueryEquipmentDTO);
jctQueryEquipmentDTO.setPlatformType(platformType);
logger.info("请求参数转换后:{}" , JSON.toJSONString(jctQueryEquipmentDTO));
Map<String, String> map = thirdPartyService.queryEquipAuth(jctQueryEquipmentDTO);
// 旧方法
// Map<String, String> map = platformLogic.queryEquipAuth(queryEquipmentDTO);
logger.info("{}-请求设备认证 result:{}" , platformName , map); logger.info("{}-请求设备认证 result:{}" , platformName , map);
return CommonResult.success(0 , "请求设备认证成功!" , map.get("Data") , map.get("Sig")); return CommonResult.success(0 , "请求设备认证成功!" , map.get("Data") , map.get("Sig"));
} catch (Exception e) { } catch (Exception e) {