mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 01:50:17 +08:00
新增 四川平台协议联调接口
This commit is contained in:
202
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SiChuanController.java
vendored
Normal file
202
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SiChuanController.java
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
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.*;
|
||||
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.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 四川对接接口
|
||||
*/
|
||||
@RestController
|
||||
@Anonymous
|
||||
@RequestMapping("/sichuan")
|
||||
public class SiChuanController extends ThirdPartyBaseController {
|
||||
private final String platformName = "";
|
||||
|
||||
|
||||
private final String platformType = ThirdPlatformTypeEnum.SI_CHUAN_PLATFORM.getTypeCode();
|
||||
|
||||
|
||||
@Autowired
|
||||
@Qualifier("siChuanPlatformServiceImpl")
|
||||
private ThirdPartyPlatformService platformLogic;
|
||||
|
||||
|
||||
/**
|
||||
* getToken
|
||||
*/
|
||||
@PostMapping("/v1/query_token")
|
||||
public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-请求令牌 params:{}" , platformName , JSON.toJSONString(dto));
|
||||
try {
|
||||
// Map<String, String> map = zdlService.generateToken(dto);
|
||||
Map<String, String> map = platformLogic.queryToken(dto);
|
||||
logger.info("{}-请求令牌 result:{}" , platformName , map);
|
||||
return CommonResult.success(0 , "请求令牌成功!" , map.get("Data") , map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("{}-请求令牌 error:" , platformName , e);
|
||||
return CommonResult.failed("获取token发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运营商信息
|
||||
* supervise_query_operator_info
|
||||
*/
|
||||
@PostMapping("/v1/supervise_query_operator_info")
|
||||
public CommonResult<?> supervise_query_operator_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);
|
||||
}
|
||||
|
||||
// 解析入参
|
||||
QueryOperatorInfoDTO queryOperatorInfoDTO = parseParamsDTO(dto , QueryOperatorInfoDTO.class);
|
||||
|
||||
// 执行逻辑
|
||||
Map<String, String> map = platformLogic.queryOperatorInfo(queryOperatorInfoDTO);
|
||||
logger.info("{}-查询运营商信息 result:{}" , platformName , map);
|
||||
return CommonResult.success(0 , "查询运营商信息成功!" , map.get("Data") , map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("{}-查询运营商信息 error:" , platformName , e);
|
||||
}
|
||||
return CommonResult.failed("查询运营商信息发生异常");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站信息
|
||||
* supervise_query_stations_info
|
||||
*/
|
||||
@PostMapping("/v1/supervise_query_stations_info")
|
||||
public CommonResult<?> supervise_query_stations_info(HttpServletRequest request , @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-查询充电站信息 params:{}" , platformName , JSON.toJSONString(dto));
|
||||
try {
|
||||
logger.info("{}-携带的token:{}",platformName, request.getHeader("Authorization"));
|
||||
// 校验令牌
|
||||
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<String, String> map = platformLogic.queryStationsInfo(queryStationInfoDTO);
|
||||
logger.info("{}-查询充电站信息 result:{}" , platformName , JSON.toJSONString(map));
|
||||
return CommonResult.success(0 , "查询充电站信息成功!" , map.get("Data") , map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("{}-查询充电站信息 error:" , platformName , e);
|
||||
}
|
||||
return CommonResult.failed("查询充电站信息发生异常");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备接口状态查询 query_station_status
|
||||
*
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/supervise_query_station_status")
|
||||
public CommonResult<?> query_stations_status(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<String, String> map = platformLogic.queryStationStatus(queryStationInfoDTO);
|
||||
logger.info("{}-设备接口状态查询 result:{}" , platformName , map);
|
||||
return CommonResult.success(0 , "设备接口状态查询成功!" , map.get("Data") , map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("{}-设备接口状态查询 error:" , platformName , e);
|
||||
}
|
||||
return CommonResult.failed("设备接口状态查询发生异常");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询补贴发放信息
|
||||
* supervise_query_subsidy_grant_info
|
||||
* @param request
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
/* @PostMapping("/v1/supervise_query_subsidy_grant_info")
|
||||
public CommonResult<?> supervise_query_subsidy_grant_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 querySubsidyGrantInfoDTO = parseParamsDTO(dto , QueryStationInfoDTO.class);
|
||||
|
||||
// 执行逻辑
|
||||
Map<String, String> map = platformLogic.querySubsidyGrantInfo(querySubsidyGrantInfoDTO);
|
||||
logger.info("{}-查询补贴发放信息 result:{}" , platformName , map);
|
||||
return CommonResult.success(0 , "查询补贴发放信息成功!" , map.get("Data") , map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.info("{}-查询补贴发放信息 error:" , platformName , e);
|
||||
}
|
||||
return CommonResult.failed("查询补贴发放信息发生异常");
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -103,6 +103,8 @@ public class Constants {
|
||||
// public static final String OPERATORID_GUI_ZHOU = "MAC9K4RRX";
|
||||
|
||||
public static final String MANUFACTURER_NAME = "举视(江苏)新能源设备制造有限公司";
|
||||
//设备所属公司
|
||||
public static final String Equipment_Owner_Name = "举视(上海)新能源科技有限公司";
|
||||
|
||||
|
||||
public static final String OPERATORID_XI_XIAO = "MAC13L2Q9";
|
||||
|
||||
@@ -36,6 +36,7 @@ public enum ThirdPlatformTypeEnum {
|
||||
WEI_WANG_XIN_DIAN("23", "微网新电", "MA005DBW1"),
|
||||
HU_ZHOU_PLATFORM("24", "湖州市监管平台", "MA27U00HZ"),
|
||||
CHANG_ZHOU_PLATFORM("25", "新运常畅充", "0585PCW57"),
|
||||
SI_CHUAN_PLATFORM("26", "四川省平台", ""),
|
||||
;
|
||||
|
||||
private String typeCode;
|
||||
|
||||
@@ -173,6 +173,9 @@ public class NotificationService {
|
||||
platformService.notificationChargeOrderInfo(orderCode);
|
||||
//停止充电结果推送
|
||||
platformService.notificationStopChargeResult(orderCode);
|
||||
//推送充换电站用能统计信息
|
||||
platformService.notificationOperationStatsInfo(stationId);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("充电订单信息推送error", e);
|
||||
}
|
||||
|
||||
@@ -131,5 +131,42 @@ public class SupStationInfo extends StationInfo {
|
||||
@JSONField(name = "SupportingFacilities")
|
||||
private String supportingFacilities;
|
||||
|
||||
/**
|
||||
* 设备所属方名称
|
||||
*/
|
||||
@JSONField(name = "EquipmentOwnerName")
|
||||
private String equipmentOwnerName;
|
||||
|
||||
/**
|
||||
* 供电类型
|
||||
* 1:直供电 2:转供电
|
||||
*/
|
||||
@JSONField(name = "SupplyType")
|
||||
private Integer supplyType;
|
||||
|
||||
/**
|
||||
* 供电局用户编号
|
||||
*/
|
||||
@JSONField(name = "ResidentNo")
|
||||
private String residentNo;
|
||||
|
||||
/**
|
||||
* 表号
|
||||
*/
|
||||
@JSONField(name = "WattHourMeterNo")
|
||||
private String wattHourMeterNo;
|
||||
|
||||
/**
|
||||
* 外电功率
|
||||
*/
|
||||
@JSONField(name = "ForwardPower")
|
||||
private String forwardPower;
|
||||
|
||||
/**
|
||||
* 充电站全省 唯一备案号
|
||||
*/
|
||||
@JSONField(name = "RecordUniqueNo")
|
||||
private String recordUniqueNo;
|
||||
|
||||
private List<PolicyInfo> PolicyInfos;
|
||||
}
|
||||
|
||||
@@ -260,6 +260,16 @@ public interface ThirdPartyPlatformService extends InitializingBean {
|
||||
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询补贴发放信息
|
||||
* supervise_query_subsidy_grant_info
|
||||
* @param querySubsidyGrantInfoDTO
|
||||
* @return
|
||||
*/
|
||||
default Map<String, String> querySubsidyGrantInfo(QueryStationInfoDTO querySubsidyGrantInfoDTO){
|
||||
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||
}
|
||||
|
||||
|
||||
// =================================================================================== //
|
||||
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user