mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
add 联联平台请求设备认证接口
This commit is contained in:
@@ -4,9 +4,11 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
||||
import com.jsowell.thirdparty.service.LianLianService;
|
||||
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
|
||||
import com.jsowell.thirdparty.vo.LianLianPageResponse;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -92,4 +94,24 @@ public class LianLianController extends BaseController {
|
||||
logger.info("联联平台查询统计信息 result :{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求设备认证
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/query_equip_auth")
|
||||
public RestApiResponse<?> query_equip_auth(@RequestBody QueryEquipmentDTO dto) {
|
||||
logger.info("联联平台请求设备认证 params :{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
EquipmentAuthVO equipmentAuthVO = lianLianService.query_equip_auth(dto);
|
||||
response = new RestApiResponse<>(equipmentAuthVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("联联平台请求设备认证 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("联联平台请求设备认证 result :{}", response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) throws ParseException {
|
||||
// String str = "2023-01-07 11:17:12";
|
||||
// Date date = parseDate(str);
|
||||
// String str1 = parseDateToStr(YYYY_MM_DD_HH_MM_SS, date);
|
||||
|
||||
@@ -133,6 +133,10 @@ public class YKCUtils {
|
||||
String s = transitionTemperature(bytes);
|
||||
System.out.println(s);
|
||||
|
||||
byte[] bytess = new byte[]{(byte) 0x80, (byte) 0x1A, 0x06, 0x00};
|
||||
String s1 = convertDecimalPoint(bytess, 5);
|
||||
System.out.println(s1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 联联平台请求设备认证
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/19 10:08
|
||||
*/
|
||||
@Data
|
||||
public class QueryEquipmentDTO {
|
||||
/**
|
||||
* 设备认证流水号
|
||||
* 格式“运营商 ID+yyyyMMddHHmmss+4 位随机数”,
|
||||
* 27 字符
|
||||
*/
|
||||
@JsonProperty(value = "EquipAuthSeq")
|
||||
private String EquipAuthSeq;
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorID")
|
||||
private String ConnectorID;
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.jsowell.thirdparty.service;
|
||||
|
||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
||||
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
|
||||
import com.jsowell.thirdparty.vo.LianLianPageResponse;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,5 +33,18 @@ public interface LianLianService {
|
||||
LianLianPageResponse query_station_status(List<String> StationIDs);
|
||||
|
||||
|
||||
/**
|
||||
* 查询统计信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
StationStatsInfo query_station_stats(QueryStationInfoDTO dto);
|
||||
|
||||
|
||||
/**
|
||||
* 请求设备认证
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
EquipmentAuthVO query_equip_auth(QueryEquipmentDTO dto);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
@@ -12,6 +13,7 @@ import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileConnectorInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileBasicInfoService;
|
||||
@@ -22,6 +24,7 @@ import com.jsowell.pile.service.IPileStationInfoService;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.thirdparty.domain.ConnectorChargeStatusInfo;
|
||||
import com.jsowell.thirdparty.domain.ConnectorInfo;
|
||||
@@ -34,6 +37,7 @@ import com.jsowell.thirdparty.domain.StationInfo;
|
||||
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
||||
import com.jsowell.thirdparty.domain.StationStatusInfo;
|
||||
import com.jsowell.thirdparty.service.LianLianService;
|
||||
import com.jsowell.thirdparty.vo.EquipmentAuthVO;
|
||||
import com.jsowell.thirdparty.vo.LianLianPageResponse;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -221,7 +225,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 查询统计信息
|
||||
* 查询统计信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@@ -305,6 +309,49 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
return stationStatsInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求设备认证
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public EquipmentAuthVO query_equip_auth(QueryEquipmentDTO dto) {
|
||||
EquipmentAuthVO vo = new EquipmentAuthVO();
|
||||
|
||||
String equipAuthSeq = dto.getEquipAuthSeq();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
// 通过运营商id + 枪口编码查询数据
|
||||
String merchantId = StringUtils.substring(equipAuthSeq, 0, 9);
|
||||
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
// 能查到为成功
|
||||
vo.setSuccStat(1); // 1-失败 0-成功
|
||||
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
||||
if (pileBasicInfo == null) {
|
||||
vo.setFailReason(2); // 设备检测失败
|
||||
vo.setFailReasonMsg("未查到该桩的数据");
|
||||
throw new BusinessException("", "");
|
||||
}
|
||||
if (pileBasicInfo.getMerchantId() == Long.parseLong(merchantId)) {
|
||||
vo.setSuccStat(0);
|
||||
// 查询当前数据
|
||||
PileConnectorInfoVO connectorInfo = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorCode);
|
||||
if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue(), String.valueOf(connectorInfo.getStatus()))
|
||||
|| StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), String.valueOf(connectorInfo.getStatus()))
|
||||
|| StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_APPOINTMENT_LOCK.getValue(), String.valueOf(connectorInfo.getStatus()))
|
||||
) {
|
||||
vo.setFailReason(0);
|
||||
} else {
|
||||
vo.setFailReason(1); // 1- 此设备尚未插枪;
|
||||
}
|
||||
vo.setFailReasonMsg("");
|
||||
}
|
||||
|
||||
vo.setEquipAuthSeq(equipAuthSeq);
|
||||
vo.setConnectorID(pileConnectorCode);
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取桩列表信息
|
||||
* @param pileStationInfo
|
||||
|
||||
52
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/EquipmentAuthVO.java
vendored
Normal file
52
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/vo/EquipmentAuthVO.java
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.jsowell.thirdparty.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 请求设备认证VO
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/19 9:57
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class EquipmentAuthVO {
|
||||
|
||||
/**
|
||||
* 设备认证流水号
|
||||
* 格式“运营商 ID+yyyyMMddHHmmss+4 位随机数”
|
||||
*/
|
||||
private String EquipAuthSeq;
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
private String ConnectorID;
|
||||
|
||||
/**
|
||||
* 成功状态
|
||||
* 0:成功;
|
||||
* 1:失败
|
||||
*/
|
||||
private int SuccStat;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
* 0:无;
|
||||
* 1:此设备尚未插枪;
|
||||
* 2:设备检测失败:
|
||||
* 3~99:自定义
|
||||
*/
|
||||
private int FailReason;
|
||||
|
||||
/**
|
||||
* 失败原因描述
|
||||
* 如果设备认证失败则必传,描述力求简单明了,用户一看即懂
|
||||
*/
|
||||
private String FailReasonMsg;
|
||||
}
|
||||
Reference in New Issue
Block a user