This commit is contained in:
Lemon
2024-04-01 16:17:07 +08:00
31 changed files with 633 additions and 381 deletions

View File

@@ -16,8 +16,8 @@ import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

View File

@@ -12,8 +12,8 @@ import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.huawei.HuaWeiService;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

View File

@@ -16,8 +16,8 @@ import com.jsowell.thirdparty.huawei.HuaweiServiceV2;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@@ -4,21 +4,22 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.JWTUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.service.ThirdPartyPlatformConfigService;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
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 org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.nio.charset.StandardCharsets;
@@ -217,84 +218,136 @@ public class LianLianController extends BaseController {
}
/**
* 联联平台设备状态变化推送
* http://localhost:8080/LianLian/pushStationStatus
* 充电站信息变化推送 notification_stationInfo
* http://localhost:8080/LianLian/notificationStationInfo
*/
@PostMapping("/notificationStationInfo")
public RestApiResponse<?> notificationStationInfo(@RequestBody PushInfoParamDTO dto) {
logger.info("联联平台充电站信息变化推送 params:{}", JSON.toJSONString(dto));
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String result = lianLianService.notificationStationInfo(dto.getStationId());
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;
}
/**
* 联联平台设备状态变化推送 notification_stationStatus
* http://localhost:8080/LianLian/notificationStationStatus
* @param dto
* @return
*/
// @PostMapping("/pushStationStatus")
// public RestApiResponse<?> pushStationStatus(@RequestBody PushInfoParamDTO dto) {
// logger.info("联联平台设备状态变化推送 params:{}", JSON.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.notificationStationStatus(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;
// }
@PostMapping("/notificationStationStatus")
public RestApiResponse<?> notificationStationStatus(@RequestBody PushInfoParamDTO dto) {
logger.info("联联平台设备状态变化推送 params:{}", JSON.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.notificationStationStatus(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;
}
/**
* 推送订单信息
* 站点费率变化推送 notification_stationFee
* http://localhost:8080/LianLian/notificationStationFee
*/
@PostMapping("/notificationStationFee")
public RestApiResponse<?> notificationStationFee(@RequestBody PushInfoParamDTO dto) {
logger.info("联联平台站点费率变化推送 params:{}", JSON.toJSONString(dto));
RestApiResponse<?> response = null;
try {
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String result = lianLianService.notificationStationFee(dto.getStationId());
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;
}
/**
* 设备充电中状态变化推送 notification_connector_charge_status
* http://localhost:8080/LianLian/notificationConnectorChargeStatus
* @return
*/
@GetMapping("/notificationConnectorChargeStatus/{orderCode}")
public RestApiResponse<?> notificationConnectorChargeStatus(@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);
String result = lianLianService.notificationConnectorChargeStatus(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;
}
/**
* 推送订单信息 notification_orderInfo
* http://localhost:8080/LianLian/notificationOrderInfo/
* @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.notificationOrderInfo(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);
// String result = lianLianService.notificationEquipChargeStatus(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;
// }
@GetMapping("/notificationOrderInfo/{orderCode}")
public RestApiResponse<?> notificationOrderInfo(@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.notificationOrderInfo(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;
}
/**
* 请求设备认证
@@ -302,50 +355,50 @@ public class LianLianController extends BaseController {
* @param dto
* @return
*/
// @PostMapping("/v1/query_equip_auth")
// public CommonResult<?> query_equip_auth(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
// logger.info("联联平台请求设备认证 param:{}", JSON.toJSONString(dto));
// try {
// // 校验令牌
// String token = request.getHeader("Authorization");
// if (!JWTUtils.checkThirdPartyToken(token)) {
// // 校验失败
// return CommonResult.failed("令牌校验错误");
// }
// // 校验签名
// // Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// // if (resultMap == null) {
// // // 签名错误
// // return CommonResult.failed("签名校验错误");
// // }
// // String operatorSecret = resultMap.get("OperatorSecret");
// // String dataString = resultMap.get("Data");
// // String dataSecret = resultMap.get("DataSecret");
// // String dataSecretIV = resultMap.get("DataSecretIV");
//
// // 查询配置信息
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
// String operatorSecret = platformConfig.getOperatorSecret();
// String dataString = dto.getData();
// String dataSecret = platformConfig.getDataSecret();
// String dataSecretIV = platformConfig.getDataSecretIv();
//
// // 解密data
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
// String dataStr = new String(plainText, StandardCharsets.UTF_8);
// // 转换成相应对象
// QueryEquipmentDTO queryEquipmentDTO = JSONObject.parseObject(dataStr, QueryEquipmentDTO.class);
// queryEquipmentDTO.setOperatorID(dto.getOperatorID());
// // Map<String, String> map = lianLianService.query_equip_auth(queryEquipmentDTO);
// Map<String, String> map = lianLianService.queryEquipAuth(queryEquipmentDTO);
//
// return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig"));
// } catch (Exception e) {
// logger.info("联联平台请求设备认证 error:", e);
// e.printStackTrace();
// }
// return CommonResult.failed("请求设备认证发生异常");
// }
@PostMapping("/v1/query_equip_auth")
public CommonResult<?> query_equip_auth(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("联联平台请求设备认证 param:{}", JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败
return CommonResult.failed("令牌校验错误");
}
// 校验签名
// Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// if (resultMap == null) {
// // 签名错误
// return CommonResult.failed("签名校验错误");
// }
// String operatorSecret = resultMap.get("OperatorSecret");
// String dataString = resultMap.get("Data");
// String dataSecret = resultMap.get("DataSecret");
// String dataSecretIV = resultMap.get("DataSecretIV");
// 查询配置信息
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
String operatorSecret = platformConfig.getOperatorSecret();
String dataString = dto.getData();
String dataSecret = platformConfig.getDataSecret();
String dataSecretIV = platformConfig.getDataSecretIv();
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryEquipmentDTO queryEquipmentDTO = JSONObject.parseObject(dataStr, QueryEquipmentDTO.class);
queryEquipmentDTO.setOperatorID(dto.getOperatorID());
// Map<String, String> map = lianLianService.query_equip_auth(queryEquipmentDTO);
Map<String, String> map = lianLianService.queryEquipAuth(queryEquipmentDTO);
return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.info("联联平台请求设备认证 error:", e);
e.printStackTrace();
}
return CommonResult.failed("请求设备认证发生异常");
}
/**
* 请求启动充电
@@ -353,49 +406,49 @@ public class LianLianController extends BaseController {
* @param dto
* @return
*/
// @PostMapping("/v1/query_start_charge")
// public CommonResult<?> query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
// logger.info("联联平台请求启动充电 params :{}", JSON.toJSONString(dto));
// try {
// // 校验令牌
// String token = request.getHeader("Authorization");
// if (!JWTUtils.checkThirdPartyToken(token)) {
// // 校验失败
// return CommonResult.failed("令牌校验错误");
// }
// // 校验签名
// // Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// // if (resultMap == null) {
// // // 签名错误
// // return CommonResult.failed("签名校验错误");
// // }
// // String operatorSecret = resultMap.get("OperatorSecret");
// // String dataString = resultMap.get("Data");
// // String dataSecret = resultMap.get("DataSecret");
// // String dataSecretIV = resultMap.get("DataSecretIV");
//
// // 查询配置信息
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
// String operatorSecret = platformConfig.getOperatorSecret();
// String dataString = dto.getData();
// String dataSecret = platformConfig.getDataSecret();
// String dataSecretIV = platformConfig.getDataSecretIv();
//
// // 解密data
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
// String dataStr = new String(plainText, StandardCharsets.UTF_8);
// // 转换成相应对象
// QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class);
// queryStartChargeDTO.setOperatorId(dto.getOperatorID());
// // Map<String, String> map = lianLianService.query_start_charge(queryStartChargeDTO);
// Map<String, String> map = lianLianService.queryStartCharge(queryStartChargeDTO);
//
// return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig"));
// } catch (Exception e) {
// logger.error("联联平台请求启动充电 error", e);
// }
// return CommonResult.failed("请求启动充电发生异常");
// }
@PostMapping("/v1/query_start_charge")
public CommonResult<?> query_start_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("联联平台请求启动充电 params :{}", JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败
return CommonResult.failed("令牌校验错误");
}
// 校验签名
// Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// if (resultMap == null) {
// // 签名错误
// return CommonResult.failed("签名校验错误");
// }
// String operatorSecret = resultMap.get("OperatorSecret");
// String dataString = resultMap.get("Data");
// String dataSecret = resultMap.get("DataSecret");
// String dataSecretIV = resultMap.get("DataSecretIV");
// 查询配置信息
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
String operatorSecret = platformConfig.getOperatorSecret();
String dataString = dto.getData();
String dataSecret = platformConfig.getDataSecret();
String dataSecretIV = platformConfig.getDataSecretIv();
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class);
queryStartChargeDTO.setOperatorId(dto.getOperatorID());
// Map<String, String> map = lianLianService.query_start_charge(queryStartChargeDTO);
Map<String, String> map = lianLianService.queryStartCharge(queryStartChargeDTO);
return CommonResult.success(0, "请求启动充电成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("联联平台请求启动充电 error", e);
}
return CommonResult.failed("请求启动充电发生异常");
}
/**
* 查询充电状态
@@ -403,49 +456,49 @@ public class LianLianController extends BaseController {
* @param dto
* @return
*/
// @PostMapping("/v1/query_equip_charge_status")
// public CommonResult<?> query_equip_charge_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
// logger.info("联联平台查询充电状态 params :{}", JSON.toJSONString(dto));
// try {
// // 校验令牌
// String token = request.getHeader("Authorization");
// if (!JWTUtils.checkThirdPartyToken(token)) {
// // 校验失败
// return CommonResult.failed("令牌校验错误");
// }
// // 校验签名
// // Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// // if (resultMap == null) {
// // // 签名错误
// // return CommonResult.failed("签名校验错误");
// // }
// // String operatorSecret = resultMap.get("OperatorSecret");
// // String dataString = resultMap.get("Data");
// // String dataSecret = resultMap.get("DataSecret");
// // String dataSecretIV = resultMap.get("DataSecretIV");
//
// // 查询配置信息
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
// String operatorSecret = platformConfig.getOperatorSecret();
// String dataString = dto.getData();
// String dataSecret = platformConfig.getDataSecret();
// String dataSecretIV = platformConfig.getDataSecretIv();
//
// // 解密data
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
// String dataStr = new String(plainText, StandardCharsets.UTF_8);
// // 转换成相应对象
// QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class);
// queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID());
// // Map<String, String> map = lianLianService.query_equip_charge_status(queryEquipChargeStatusDTO);
// Map<String, String> map = lianLianService.queryEquipChargeStatus(queryEquipChargeStatusDTO);
//
// return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig"));
// } catch (Exception e) {
// logger.error("联联平台查询充电状态 error", e);
// }
// return CommonResult.failed("联联平台查询充电状态发生异常");
// }
@PostMapping("/v1/query_equip_charge_status")
public CommonResult<?> query_equip_charge_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("联联平台查询充电状态 params :{}", JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败
return CommonResult.failed("令牌校验错误");
}
// 校验签名
// Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// if (resultMap == null) {
// // 签名错误
// return CommonResult.failed("签名校验错误");
// }
// String operatorSecret = resultMap.get("OperatorSecret");
// String dataString = resultMap.get("Data");
// String dataSecret = resultMap.get("DataSecret");
// String dataSecretIV = resultMap.get("DataSecretIV");
// 查询配置信息
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
String operatorSecret = platformConfig.getOperatorSecret();
String dataString = dto.getData();
String dataSecret = platformConfig.getDataSecret();
String dataSecretIV = platformConfig.getDataSecretIv();
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryEquipChargeStatusDTO queryEquipChargeStatusDTO = JSONObject.parseObject(dataStr, QueryEquipChargeStatusDTO.class);
queryEquipChargeStatusDTO.setOperatorID(dto.getOperatorID());
// Map<String, String> map = lianLianService.query_equip_charge_status(queryEquipChargeStatusDTO);
Map<String, String> map = lianLianService.queryEquipChargeStatus(queryEquipChargeStatusDTO);
return CommonResult.success(0, "查询充电状态成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("联联平台查询充电状态 error", e);
}
return CommonResult.failed("联联平台查询充电状态发生异常");
}
/**
* 请求停止充电
@@ -453,49 +506,49 @@ public class LianLianController extends BaseController {
* @param dto
* @return
*/
// @PostMapping("/v1/query_stop_charge")
// public CommonResult<?> query_stop_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
// logger.info("联联平台请求停止充电 params :{}", JSON.toJSONString(dto));
// try {
// // 校验令牌
// String token = request.getHeader("Authorization");
// if (!JWTUtils.checkThirdPartyToken(token)) {
// // 校验失败
// return CommonResult.failed("令牌校验错误");
// }
// // 校验签名
// // Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// // if (resultMap == null) {
// // // 签名错误
// // return CommonResult.failed("签名校验错误");
// // }
// // String operatorSecret = resultMap.get("OperatorSecret");
// // String dataString = resultMap.get("Data");
// // String dataSecret = resultMap.get("DataSecret");
// // String dataSecretIV = resultMap.get("DataSecretIV");
//
// // 查询配置信息
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
// String operatorSecret = platformConfig.getOperatorSecret();
// String dataString = dto.getData();
// String dataSecret = platformConfig.getDataSecret();
// String dataSecretIV = platformConfig.getDataSecretIv();
//
// // 解密data
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
// String dataStr = new String(plainText, StandardCharsets.UTF_8);
// // 转换成相应对象
// QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class);
// queryStartChargeDTO.setOperatorId(dto.getOperatorID());
// // Map<String, String> map = lianLianService.query_stop_charge(queryStartChargeDTO);
// Map<String, String> map = lianLianService.queryStopCharge(queryStartChargeDTO);
//
// return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig"));
// } catch (Exception e) {
// logger.error("联联平台请求停止充电 error", e);
// }
// return CommonResult.failed("联联平台请求停止充电发生异常");
// }
@PostMapping("/v1/query_stop_charge")
public CommonResult<?> query_stop_charge(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("联联平台请求停止充电 params :{}", JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败
return CommonResult.failed("令牌校验错误");
}
// 校验签名
// Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// if (resultMap == null) {
// // 签名错误
// return CommonResult.failed("签名校验错误");
// }
// String operatorSecret = resultMap.get("OperatorSecret");
// String dataString = resultMap.get("Data");
// String dataSecret = resultMap.get("DataSecret");
// String dataSecretIV = resultMap.get("DataSecretIV");
// 查询配置信息
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
String operatorSecret = platformConfig.getOperatorSecret();
String dataString = dto.getData();
String dataSecret = platformConfig.getDataSecret();
String dataSecretIV = platformConfig.getDataSecretIv();
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
QueryStartChargeDTO queryStartChargeDTO = JSONObject.parseObject(dataStr, QueryStartChargeDTO.class);
queryStartChargeDTO.setOperatorId(dto.getOperatorID());
// Map<String, String> map = lianLianService.query_stop_charge(queryStartChargeDTO);
Map<String, String> map = lianLianService.queryStopCharge(queryStartChargeDTO);
return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("联联平台请求停止充电 error", e);
}
return CommonResult.failed("联联平台请求停止充电发生异常");
}
@@ -505,62 +558,61 @@ public class LianLianController extends BaseController {
* @param dto
* @return
*/
// @PostMapping("/v1/notification_order_settlement_info")
// public CommonResult<?> notification_order_settlement_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
// logger.info("联联平台推送订单结算信息 params:{}", JSON.toJSONString(dto));
// try {
// // 校验令牌
// String token = request.getHeader("Authorization");
// if (!JWTUtils.checkThirdPartyToken(token)) {
// // 校验失败
// return CommonResult.failed("令牌校验错误");
// }
// // 校验签名
// // Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// // if (resultMap == null) {
// // // 签名错误
// // return CommonResult.failed("签名校验错误");
// // }
// // String operatorSecret = resultMap.get("OperatorSecret");
// // String dataString = resultMap.get("Data");
// // String dataSecret = resultMap.get("DataSecret");
// // String dataSecretIV = resultMap.get("DataSecretIV");
//
// // 查询配置信息
// ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
// String operatorSecret = platformConfig.getOperatorSecret();
// String dataString = dto.getData();
// String dataSecret = platformConfig.getDataSecret();
// String dataSecretIV = platformConfig.getDataSecretIv();
//
// // 解密data
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
// String dataStr = new String(plainText, StandardCharsets.UTF_8);
// // 转换成相应对象
// PushOrderSettlementDTO pushOrderSettlementDTO = JSONObject.parseObject(dataStr, PushOrderSettlementDTO.class);
// pushOrderSettlementDTO.setOperatorId(dto.getOperatorID());
// Map<String, String> map = lianLianService.pushOrderSettlementInfo(pushOrderSettlementDTO);
// // Map<String, String> map = lianLianService.notificationOrderInfo(pushOrderSettlementDTO);
//
// return CommonResult.success(0, "推送订单结算信息成功!", map.get("Data"), map.get("Sig"));
// } catch (Exception e) {
// logger.info("联联平台推送订单结算信息 error:", e);
// e.printStackTrace();
// }
// return CommonResult.failed("推送订单结算信息发生异常");
// }
@PostMapping("/v1/notification_order_settlement_info")
public CommonResult<?> notification_order_settlement_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("联联平台推送订单结算信息 params:{}", JSON.toJSONString(dto));
try {
// 校验令牌
String token = request.getHeader("Authorization");
if (!JWTUtils.checkThirdPartyToken(token)) {
// 校验失败
return CommonResult.failed("令牌校验错误");
}
// 校验签名
// Map<String, String> resultMap = lianLianService.checkoutSign(dto);
// if (resultMap == null) {
// // 签名错误
// return CommonResult.failed("签名校验错误");
// }
// String operatorSecret = resultMap.get("OperatorSecret");
// String dataString = resultMap.get("Data");
// String dataSecret = resultMap.get("DataSecret");
// String dataSecretIV = resultMap.get("DataSecretIV");
// @GetMapping("/pushStationFee/{stationId}")
// public RestApiResponse<?> pushStationFee(@PathVariable("stationId") String stationId) {
// RestApiResponse<?> response = null;
// try {
// // String result = lianLianService.pushStationFee(stationId);
// String result = lianLianService.notificationStationFee(stationId);
// response = new RestApiResponse<>(result);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return response;
// }
// 查询配置信息
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
String operatorSecret = platformConfig.getOperatorSecret();
String dataString = dto.getData();
String dataSecret = platformConfig.getDataSecret();
String dataSecretIV = platformConfig.getDataSecretIv();
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
String dataStr = new String(plainText, StandardCharsets.UTF_8);
// 转换成相应对象
PushOrderSettlementDTO pushOrderSettlementDTO = JSONObject.parseObject(dataStr, PushOrderSettlementDTO.class);
pushOrderSettlementDTO.setOperatorId(dto.getOperatorID());
Map<String, String> map = lianLianService.notificationOrderSettlementInfo(pushOrderSettlementDTO);
return CommonResult.success(0, "推送订单结算信息成功!", map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.info("联联平台推送订单结算信息 error:", e);
e.printStackTrace();
}
return CommonResult.failed("推送订单结算信息发生异常");
}
@GetMapping("/pushStationFee/{stationId}")
public RestApiResponse<?> pushStationFee(@PathVariable("stationId") String stationId) {
RestApiResponse<?> response = null;
try {
// String result = lianLianService.pushStationFee(stationId);
String result = lianLianService.notificationStationFee(stationId);
response = new RestApiResponse<>(result);
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
}

View File

@@ -17,8 +17,8 @@ import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.nanrui.service.NRService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@@ -10,8 +10,8 @@ import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.ningxiajiaotou.service.NXJTService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -12,8 +12,8 @@ import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.*;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.xindiantu.service.XDTService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@@ -13,8 +13,8 @@ import com.jsowell.pile.dto.*;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO;
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -15,8 +15,8 @@ import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;