mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
Merge branch 'dev-new' into dev-new-rabbitmq
# Conflicts: # jsowell-admin/src/main/java/com/jsowell/api/uniapp/customer/TempController.java # jsowell-admin/src/test/java/SpringBootTestController.java
This commit is contained in:
117
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/GanSuController.java
vendored
Normal file
117
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/GanSuController.java
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 甘肃省平台Controller
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2024/11/9 13:22:05
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/gansu")
|
||||
public class GanSuController extends ThirdPartyBaseController{
|
||||
private final String platformName = "甘肃省平台";
|
||||
|
||||
@Autowired
|
||||
@Qualifier("ganSuPlatformServiceImpl")
|
||||
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发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电站信息
|
||||
* 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("查询充电站信息发生异常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电站状态信息
|
||||
* 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("查询充电站状态信息发生异常");
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class NeiMengGuController extends ThirdPartyBaseController {
|
||||
*/
|
||||
@PostMapping("/v1/supervise_query_stations_info")
|
||||
public CommonResult<?> queryStationsInfo(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||
logger.info("{}-查询运营商信息 params:{}", platformName, JSON.toJSONString(dto));
|
||||
logger.info("{}-查询充换电站信息 params:{}", platformName, JSON.toJSONString(dto));
|
||||
try {
|
||||
// 校验令牌
|
||||
boolean verifyToken = verifyToken(request.getHeader("Authorization"));
|
||||
@@ -105,7 +105,6 @@ public class NeiMengGuController extends ThirdPartyBaseController {
|
||||
// 校验失败
|
||||
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
|
||||
}
|
||||
|
||||
// 校验签名
|
||||
if (!verifySignature(dto)) {
|
||||
// 签名错误
|
||||
@@ -113,11 +112,11 @@ public class NeiMengGuController extends ThirdPartyBaseController {
|
||||
}
|
||||
QueryStationInfoDTO paramDTO = parseParamsDTO(dto, QueryStationInfoDTO.class);
|
||||
Map<String, String> map = platformLogic.queryStationsInfo(paramDTO);
|
||||
logger.info("{}-查询运营商信息 result:{}", platformName, JSON.toJSONString(map));
|
||||
return CommonResult.success(0, "请求令牌成功!", map.get("Data"), map.get("Sig"));
|
||||
logger.info("{}-查询充换电站信息 result:{}", platformName, JSON.toJSONString(map));
|
||||
return CommonResult.success(0, "成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("{}-查询运营商信息 异常", platformName, e);
|
||||
return CommonResult.failed("查询运营商信息发生异常");
|
||||
logger.error("{}-查询充换电站信息 异常", platformName, e);
|
||||
return CommonResult.failed("查询充换电站信息发生异常");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.Map;
|
||||
@RequestMapping("/suzhou")
|
||||
public class SuZhouPlatformController extends ThirdPartyBaseController{
|
||||
|
||||
private final String platformName = "苏州省平台";
|
||||
private final String platformName = "苏州市平台";
|
||||
|
||||
@Autowired
|
||||
@Qualifier("suZhouPlatformServiceImpl")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.api.uniapp.customer;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.jsowell.adapay.dto.BalancePaymentRequestDTO;
|
||||
import com.jsowell.adapay.service.AdapayService;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
@@ -596,4 +597,56 @@ public class TempController extends BaseController {
|
||||
rabbitTemplate.convertAndSend(dto.getExchange(), dto.getRoutingKey(), dto.getData());
|
||||
return new RestApiResponse<>();
|
||||
}
|
||||
|
||||
/* 计算订单耗电量
|
||||
* dto.setStationId("657");
|
||||
* dto.setStartTime("2024-10-23 00:00:00");
|
||||
* dto.setEndTime("2024-11-07 23:59:59");
|
||||
*/
|
||||
@PostMapping("/calculateOrderElectricity")
|
||||
public RestApiResponse<?> calculateOrderElectricity(@RequestBody QueryOrderDTO dto) {
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
tempService.calculateOrderElectricity(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (Exception e) {
|
||||
logger.error("计算订单耗电量error", e);
|
||||
response = new RestApiResponse<>();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验订单是否为并充订单
|
||||
* https://localhost:8080/temp/checkCombinedChargingOrder
|
||||
*/
|
||||
@PostMapping("/checkCombinedChargingOrder")
|
||||
public RestApiResponse<?> checkCombinedChargingOrder(@RequestBody QueryOrderDTO dto) {
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
Map<String, List<String>> map = tempService.checkCombinedChargingOrder(dto.getOrderCodeList());
|
||||
response = new RestApiResponse<>(map);
|
||||
} catch (Exception e) {
|
||||
logger.error("校验订单是否为并充订单error", e);
|
||||
response = new RestApiResponse<>();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 并充订单数据修正
|
||||
* https://localhost:8080/temp/correctCombinedChargingOrder
|
||||
*/
|
||||
@PostMapping("/correctCombinedChargingOrder")
|
||||
public RestApiResponse<?> correctCombinedChargingOrder(@RequestBody QueryOrderDTO dto) {
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
List<String> list = tempService.correctCombinedChargingOrder(dto);
|
||||
response = new RestApiResponse<>(ImmutableMap.of("correctOrderCodeList", list));
|
||||
} catch (Exception e) {
|
||||
logger.error("校验订单是否为并充订单error", e);
|
||||
response = new RestApiResponse<>();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user