This commit is contained in:
2023-05-26 10:14:02 +08:00
6 changed files with 106 additions and 12 deletions

View File

@@ -7,10 +7,7 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.LianLianPushStationInfoDTO;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.dto.*;
import com.jsowell.thirdparty.domain.StationStatsInfo;
import com.jsowell.thirdparty.service.LianLianService;
import com.jsowell.thirdparty.vo.*;
@@ -62,6 +59,86 @@ public class LianLianController extends BaseController {
return response;
}
/**
* 联联平台设备状态变化推送
* http://localhost:8080/LianLian/pushStationStatus
* @param dto
* @return
*/
@PostMapping("/pushStationStatus")
public RestApiResponse<?> pushStationStatus(@RequestBody PushInfoParamDTO dto) {
logger.info("联联平台设备状态变化推送 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(String.valueOf(dto.getPileConnectorCode())) ||
StringUtils.isBlank(String.valueOf(dto.getStatus()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String result = lianLianService.pushConnectorStatus(dto.getPileConnectorCode(), dto.getStatus());
response = new RestApiResponse<>(result);
}catch (BusinessException e) {
logger.error("联联平台设备状态变化推送 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
}catch (Exception e) {
logger.error("联联平台设备状态变化推送 error", e);
response = new RestApiResponse<>(e);
}
logger.info("联联平台设备状态变化推送 result:{}", response);
return response;
}
/**
* 推送订单信息
* @param orderCode
* @return
*/
@GetMapping("/pushOrderInfo/{orderCode}")
public RestApiResponse<?> pushOrderInfo(@PathVariable("orderCode")String orderCode) {
logger.info("联联平台推送订单信息 params:{}", orderCode);
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(orderCode)) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String result = lianLianService.pushOrderInfo(orderCode);
response = new RestApiResponse<>(result);
}catch (BusinessException e) {
logger.error("联联平台推送订单信息 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
}catch (Exception e) {
logger.error("联联平台推送订单信息 error", e);
response = new RestApiResponse<>(e);
}
logger.info("联联平台推送订单信息 result:{}", response);
return response;
}
/**
* 设备充电中状态变化推送
* @return
*/
@GetMapping("/pushPileChargeStatusChange/{orderCode}")
public RestApiResponse<?> pushPileChargeStatusChange(@PathVariable("orderCode")String orderCode) {
logger.info("联联平台设备充电中状态变化推送 params:{}", orderCode);
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(orderCode)) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String result = lianLianService.pushPileChargeStatusChange(orderCode);
response = new RestApiResponse<>(result);
}catch (BusinessException e) {
logger.error("联联平台设备充电中状态变化推送 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
}catch (Exception e) {
logger.error("联联平台设备充电中状态变化推送 error", e);
response = new RestApiResponse<>(e);
}
logger.info("联联平台设备充电中状态变化推送 result:{}", response);
return response;
}
/**
* 联联平台查询充电站信息
* http://localhost:8080/LianLian/query_stations_info

View File

@@ -227,8 +227,8 @@ public class PileStationInfoController extends BaseController {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
lianLianService.pushStationInfo(dto);
response = new RestApiResponse<>();
String result = lianLianService.pushStationInfo(dto);
response = new RestApiResponse<>(result);
}catch (BusinessException e) {
logger.error("推送联联平台充电站信息 error",e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());