mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
新增 苏州市平台相关Service、controller
This commit is contained in:
118
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SuZhouPlatformController.java
vendored
Normal file
118
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SuZhouPlatformController.java
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* 苏州市平台
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2024/9/24 8:51:04
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/suzhou")
|
||||
public class SuZhouPlatformController extends ThirdPartyBaseController{
|
||||
|
||||
private final String platformName = "苏州省平台";
|
||||
|
||||
@Autowired
|
||||
@Qualifier("suZhouPlatformServiceImpl")
|
||||
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 = 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_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);
|
||||
}
|
||||
|
||||
// 校验签名
|
||||
if (!verifySignature(dto)) {
|
||||
// 签名错误
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
|
||||
}
|
||||
|
||||
// 解析入参
|
||||
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class);
|
||||
|
||||
// 执行逻辑
|
||||
Map<String, String> 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/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<String, String> 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("查询充电站状态信息发生异常");
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,9 @@ public class ShareprofitGroupController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运营商分润组列表 new
|
||||
*/
|
||||
@PostMapping("/getShareprofitGroupList")
|
||||
public RestApiResponse<?> getShareprofitGroupList(@RequestBody ShareprofitGroup shareprofitGroup) {
|
||||
RestApiResponse<?> response = null;
|
||||
|
||||
@@ -24,8 +24,8 @@ public class ThirdPartyNotificationController extends BaseController {
|
||||
public AjaxResult notificationStationInfo(@RequestBody NotificationDTO dto) {
|
||||
AjaxResult result;
|
||||
try {
|
||||
notificationService.notificationStationInfo(dto);
|
||||
result = AjaxResult.success();
|
||||
String postResult = notificationService.notificationStationInfo(dto);
|
||||
result = AjaxResult.success(postResult);
|
||||
} catch (BusinessException e) {
|
||||
logger.error("充电站信息变化推送失败", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
|
||||
@@ -9,7 +9,7 @@ spring:
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 192.168.2.46
|
||||
host: 192.168.2.2
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
@@ -36,7 +36,7 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://192.168.2.46:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: jsowell_dev
|
||||
# url: jdbc:mysql://192.168.2.46:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: jsowell_prd_copy
|
||||
|
||||
Reference in New Issue
Block a user