mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-10 13:00:02 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -237,22 +237,62 @@ public class LianLianController extends BaseController {
|
|||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/query_equip_auth")
|
// @PostMapping("/query_equip_auth")
|
||||||
public RestApiResponse<?> query_equip_auth(@RequestBody QueryEquipmentDTO dto) {
|
// public RestApiResponse<?> query_equip_auth(@RequestBody QueryEquipmentDTO dto) {
|
||||||
logger.info("联联平台请求设备认证 params :{}", JSONObject.toJSONString(dto));
|
// logger.info("联联平台请求设备认证 params :{}", JSONObject.toJSONString(dto));
|
||||||
RestApiResponse<?> response;
|
// RestApiResponse<?> response;
|
||||||
|
// try {
|
||||||
|
// EquipmentAuthVO equipmentAuthVO = lianLianService.query_equip_auth(dto);
|
||||||
|
// response = new RestApiResponse<>(equipmentAuthVO);
|
||||||
|
// }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 request
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/v1/query_equip_auth")
|
||||||
|
public CommonResult<?> query_equip_auth(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
|
||||||
|
logger.info("联联平台请求设备认证 param:{}", JSONObject.toJSONString(dto));
|
||||||
try {
|
try {
|
||||||
EquipmentAuthVO equipmentAuthVO = lianLianService.query_equip_auth(dto);
|
// 校验令牌
|
||||||
response = new RestApiResponse<>(equipmentAuthVO);
|
String token = request.getHeader("Authorization");
|
||||||
}catch (BusinessException e) {
|
if (!JWTUtils.checkThirdPartyToken(token)) {
|
||||||
logger.error("联联平台请求设备认证 error",e);
|
// 校验失败
|
||||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
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");
|
||||||
|
// 解密data
|
||||||
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), operatorSecret.getBytes(), operatorSecret.getBytes());
|
||||||
|
String dataStr = new String(plainText, "UTF-8");
|
||||||
|
// 转换成相应对象
|
||||||
|
QueryEquipmentDTO queryEquipmentDTO = JSONObject.parseObject(dataStr, QueryEquipmentDTO.class);
|
||||||
|
queryEquipmentDTO.setOperatorID(dto.getOperatorID());
|
||||||
|
Map<String, String> map = lianLianService.query_equip_auth(queryEquipmentDTO);
|
||||||
|
|
||||||
|
return CommonResult.success(0, "请求设备认证成功!", map.get("Data"), map.get("Sig"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("联联平台请求设备认证 error", e);
|
logger.info("联联平台请求设备认证 error:", e);
|
||||||
response = new RestApiResponse<>(e);
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info("联联平台请求设备认证 result :{}", response);
|
return CommonResult.failed("请求设备认证发生异常");
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,4 +24,7 @@ public class QueryEquipmentDTO {
|
|||||||
*/
|
*/
|
||||||
@JsonProperty(value = "ConnectorID")
|
@JsonProperty(value = "ConnectorID")
|
||||||
private String ConnectorID;
|
private String ConnectorID;
|
||||||
|
|
||||||
|
@JsonProperty(value = "OperatorID")
|
||||||
|
private String OperatorID;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public interface LianLianService {
|
|||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
EquipmentAuthVO query_equip_auth(QueryEquipmentDTO dto);
|
Map<String, String> query_equip_auth(QueryEquipmentDTO dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求开始充电
|
* 请求开始充电
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public EquipmentAuthVO query_equip_auth(QueryEquipmentDTO dto) {
|
public Map<String, String> query_equip_auth(QueryEquipmentDTO dto) {
|
||||||
EquipmentAuthVO vo = new EquipmentAuthVO();
|
EquipmentAuthVO vo = new EquipmentAuthVO();
|
||||||
|
|
||||||
String equipAuthSeq = dto.getEquipAuthSeq();
|
String equipAuthSeq = dto.getEquipAuthSeq();
|
||||||
@@ -506,7 +506,11 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
if (pileBasicInfo == null) {
|
if (pileBasicInfo == null) {
|
||||||
vo.setFailReason(2); // 设备检测失败
|
vo.setFailReason(2); // 设备检测失败
|
||||||
vo.setFailReasonMsg("未查到该桩的数据");
|
vo.setFailReasonMsg("未查到该桩的数据");
|
||||||
throw new BusinessException("", "");
|
return null;
|
||||||
|
}
|
||||||
|
DockingPlatformConfig configInfo = dockingPlatformConfigService.getInfoByOperatorId(dto.getOperatorID());
|
||||||
|
if (configInfo == null) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
if (pileBasicInfo.getMerchantId() == Long.parseLong(merchantId)) {
|
if (pileBasicInfo.getMerchantId() == Long.parseLong(merchantId)) {
|
||||||
vo.setSuccStat(0);
|
vo.setSuccStat(0);
|
||||||
@@ -526,7 +530,19 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
vo.setEquipAuthSeq(equipAuthSeq);
|
vo.setEquipAuthSeq(equipAuthSeq);
|
||||||
vo.setConnectorID(pileConnectorCode);
|
vo.setConnectorID(pileConnectorCode);
|
||||||
|
|
||||||
return vo;
|
// 加密
|
||||||
|
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||||
|
// 加密数据
|
||||||
|
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(),
|
||||||
|
configInfo.getOperatorSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||||
|
String encryptData = Encodes.encodeBase64(encryptText);
|
||||||
|
|
||||||
|
resultMap.put("Data", encryptData);
|
||||||
|
// 生成sig
|
||||||
|
String resultSign = GBSignUtils.sign(resultMap, configInfo.getOperatorSecret());
|
||||||
|
resultMap.put("Sig", resultSign);
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
package com.jsowell.thirdparty.lianlian.vo;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联联平台分页反参
|
|
||||||
*
|
|
||||||
* @author JS-ZZA
|
|
||||||
* @date 2023/4/10 15:24
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class LianLianPageResponse implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -8425633122529553009L;
|
|
||||||
/**
|
|
||||||
* 当前页数
|
|
||||||
*/
|
|
||||||
private int PageNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页码总数
|
|
||||||
*/
|
|
||||||
private int PageCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 总记录条数
|
|
||||||
*/
|
|
||||||
private int ItemSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据集合
|
|
||||||
*/
|
|
||||||
private List<?> list;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user