mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-10 18:30:02 +08:00
新增 苏州市平台相关Service、controller
This commit is contained in:
118
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SuZhouPlatformController.java
vendored
Normal file
118
jsowell-admin/src/main/java/com/jsowell/api/thirdparty/SuZhouPlatformController.java
vendored
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 苏州市平台
|
||||||
|
*
|
||||||
|
* @author Lemon
|
||||||
|
* @Date 2024/9/24 8:51:04
|
||||||
|
*/
|
||||||
|
@Anonymous
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/suzhou")
|
||||||
|
public class SuZhouPlatformController extends ThirdPartyBaseController{
|
||||||
|
|
||||||
|
private final String platformName = "苏州省平台";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("suZhouPlatformServiceImpl")
|
||||||
|
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发生异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询充电站信息
|
||||||
|
* supervise_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("查询充电站信息发生异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询充电站状态信息
|
||||||
|
* supervise_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("查询充电站状态信息发生异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,6 +47,9 @@ public class ShareprofitGroupController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询运营商分润组列表 new
|
||||||
|
*/
|
||||||
@PostMapping("/getShareprofitGroupList")
|
@PostMapping("/getShareprofitGroupList")
|
||||||
public RestApiResponse<?> getShareprofitGroupList(@RequestBody ShareprofitGroup shareprofitGroup) {
|
public RestApiResponse<?> getShareprofitGroupList(@RequestBody ShareprofitGroup shareprofitGroup) {
|
||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public class ThirdPartyNotificationController extends BaseController {
|
|||||||
public AjaxResult notificationStationInfo(@RequestBody NotificationDTO dto) {
|
public AjaxResult notificationStationInfo(@RequestBody NotificationDTO dto) {
|
||||||
AjaxResult result;
|
AjaxResult result;
|
||||||
try {
|
try {
|
||||||
notificationService.notificationStationInfo(dto);
|
String postResult = notificationService.notificationStationInfo(dto);
|
||||||
result = AjaxResult.success();
|
result = AjaxResult.success(postResult);
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
logger.error("充电站信息变化推送失败", e);
|
logger.error("充电站信息变化推送失败", e);
|
||||||
result = AjaxResult.error(e.getMessage());
|
result = AjaxResult.error(e.getMessage());
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ spring:
|
|||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 192.168.2.46
|
host: 192.168.2.2
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
@@ -36,7 +36,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://192.168.2.46:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: jsowell_dev
|
username: jsowell_dev
|
||||||
# url: jdbc:mysql://192.168.2.46:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://192.168.2.46:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# username: jsowell_prd_copy
|
# username: jsowell_prd_copy
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public enum ThirdPlatformTypeEnum {
|
|||||||
NING_XIA_PLATFORM("13", "宁夏平台", "MA01H3BQ9"),
|
NING_XIA_PLATFORM("13", "宁夏平台", "MA01H3BQ9"),
|
||||||
SHEN_ZHEN_PLATFORM("14", "深圳平台", ""),
|
SHEN_ZHEN_PLATFORM("14", "深圳平台", ""),
|
||||||
ZHE_JIANG_PLATFORM("15", "浙江省平台", "002485048"),
|
ZHE_JIANG_PLATFORM("15", "浙江省平台", "002485048"),
|
||||||
|
SU_ZHOU_PLATFORM("16", "苏州市平台", ""),
|
||||||
;
|
;
|
||||||
|
|
||||||
private String typeCode;
|
private String typeCode;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class NotificationService {
|
|||||||
* 充电站信息变化推送
|
* 充电站信息变化推送
|
||||||
* notification_stationInfo
|
* notification_stationInfo
|
||||||
*/
|
*/
|
||||||
public void notificationStationInfo(NotificationDTO dto) {
|
public String notificationStationInfo(NotificationDTO dto) {
|
||||||
String stationId = dto.getStationId();
|
String stationId = dto.getStationId();
|
||||||
String platformType = dto.getPlatformType();
|
String platformType = dto.getPlatformType();
|
||||||
|
|
||||||
@@ -43,9 +43,10 @@ public class NotificationService {
|
|||||||
// 通过stationId 查询该站点需要对接的平台配置
|
// 通过stationId 查询该站点需要对接的平台配置
|
||||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
// 调用相应平台的处理方法
|
// 调用相应平台的处理方法
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||||
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
||||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||||
@@ -53,11 +54,13 @@ public class NotificationService {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||||
platformService.notificationStationInfo(stationId);
|
String postResult = platformService.notificationStationInfo(stationId);
|
||||||
|
result.append(postResult).append("\n");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("充电站信息变化推送error", e);
|
logger.error("充电站信息变化推送error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -151,4 +151,12 @@ public class SupEquipChargeStatusInfo {
|
|||||||
*/
|
*/
|
||||||
@JSONField(name = "ChargeCurrent")
|
@JSONField(name = "ChargeCurrent")
|
||||||
private BigDecimal chargeCurrent;
|
private BigDecimal chargeCurrent;
|
||||||
|
|
||||||
|
|
||||||
|
@JSONField(name = "StartChargeSeq")
|
||||||
|
private String startChargeSeq;
|
||||||
|
|
||||||
|
|
||||||
|
@JSONField(name = "StartChargeSeqStat")
|
||||||
|
private Integer startChargeSeqStat;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,585 @@
|
|||||||
|
package com.jsowell.thirdparty.platform.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.jsowell.common.constant.Constants;
|
||||||
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
|
import com.jsowell.common.enums.lianlian.StationPaymentEnum;
|
||||||
|
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
|
||||||
|
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||||
|
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||||
|
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||||
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
|
import com.jsowell.common.exception.BusinessException;
|
||||||
|
import com.jsowell.common.util.*;
|
||||||
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
|
import com.jsowell.pile.domain.OrderDetail;
|
||||||
|
import com.jsowell.pile.domain.PileStationInfo;
|
||||||
|
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||||
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||||
|
import com.jsowell.pile.service.*;
|
||||||
|
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||||
|
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||||
|
import com.jsowell.pile.util.MerchantUtils;
|
||||||
|
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||||
|
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||||
|
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||||
|
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||||
|
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||||
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||||
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
|
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo;
|
||||||
|
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
|
||||||
|
import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo;
|
||||||
|
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
||||||
|
import com.jsowell.thirdparty.platform.common.ChargeOrderInfo;
|
||||||
|
import com.jsowell.thirdparty.platform.common.StationInfo;
|
||||||
|
import com.jsowell.thirdparty.platform.domain.SupEquipChargeStatusInfo;
|
||||||
|
import com.jsowell.thirdparty.platform.domain.SupStationInfo;
|
||||||
|
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||||
|
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||||
|
import com.jsowell.thirdparty.platform.util.*;
|
||||||
|
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 苏州市平台Service
|
||||||
|
*
|
||||||
|
* @author Lemon
|
||||||
|
* @Date 2024/9/18 14:41:28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SuZhouPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileBasicInfoService pileBasicInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileMerchantInfoService pileMerchantInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileConnectorInfoService pileConnectorInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderBasicInfoService orderBasicInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PileStationInfoService pileStationInfoService;
|
||||||
|
|
||||||
|
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
// 平台类型
|
||||||
|
private final String thirdPlatformType = ThirdPlatformTypeEnum.SU_ZHOU_PLATFORM.getTypeCode();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
ThirdPartyPlatformFactory.register(thirdPlatformType, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求令牌 query_token
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryToken(CommonParamsDTO dto) {
|
||||||
|
String operatorId = dto.getOperatorID();
|
||||||
|
// 通过operatorId 查出 operatorSecret
|
||||||
|
ThirdPartySecretInfoVO suZhouSecretInfo = getSuZhouSecretInfo();
|
||||||
|
|
||||||
|
String operatorSecret = suZhouSecretInfo.getOurOperatorSecret();
|
||||||
|
String dataSecret = suZhouSecretInfo.getOurDataSecret();
|
||||||
|
String dataSecretIv = suZhouSecretInfo.getOurDataSecretIv();
|
||||||
|
String signSecret = suZhouSecretInfo.getOurSigSecret();
|
||||||
|
|
||||||
|
// 解密data 获取参数中的OperatorSecret
|
||||||
|
try {
|
||||||
|
String decrypt = Cryptos.decrypt(dto.getData(), dataSecret, dataSecretIv);
|
||||||
|
String inputOperatorSecret = null;
|
||||||
|
if (StringUtils.isNotBlank(decrypt)) {
|
||||||
|
inputOperatorSecret = JSON.parseObject(decrypt).getString("OperatorSecret");
|
||||||
|
}
|
||||||
|
if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) {
|
||||||
|
throw new RuntimeException("密钥不一致");
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
throw new BusinessException("2", "密钥错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成token
|
||||||
|
String token = JWTUtils.createToken(operatorId, operatorSecret, JWTUtils.ttlMillis);
|
||||||
|
|
||||||
|
// 组装返回参数
|
||||||
|
AccessTokenVO vo = new AccessTokenVO();
|
||||||
|
vo.setAccessToken(token);
|
||||||
|
vo.setOperatorID(operatorId);
|
||||||
|
vo.setTokenAvailableTime((int) (JWTUtils.ttlMillis / 1000));
|
||||||
|
vo.setFailReason(0);
|
||||||
|
vo.setSuccStat(0);
|
||||||
|
|
||||||
|
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||||
|
// 加密数据
|
||||||
|
byte[] encryptText = Cryptos.aesEncrypt(JSON.toJSONString(vo).getBytes(),
|
||||||
|
dataSecret.getBytes(), dataSecretIv.getBytes());
|
||||||
|
String encryptData = Encodes.encodeBase64(encryptText); // data
|
||||||
|
resultMap.put("Ret", "0");
|
||||||
|
resultMap.put("Msg", "请求令牌成功!");
|
||||||
|
resultMap.put("Data", encryptData);
|
||||||
|
// 生成sig
|
||||||
|
String resultSign = GBSignUtils.sign(resultMap, signSecret);
|
||||||
|
resultMap.put("Sig", resultSign);
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询站点信息 query_stationInfo
|
||||||
|
* @param dto 查询站点信息dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryStationsInfo(QueryStationInfoDTO dto) {
|
||||||
|
int pageNo = dto.getPageNo() == null ? 1 : dto.getPageNo();
|
||||||
|
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||||
|
|
||||||
|
PageUtils.startPage(pageNo, pageSize);
|
||||||
|
List<ThirdPartyStationInfoVO> stationInfos = pileStationInfoService.getStationInfosByThirdParty(dto);
|
||||||
|
if (CollectionUtils.isEmpty(stationInfos)) {
|
||||||
|
// 未查到数据
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||||
|
if (thirdPartySecretInfoVO == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||||
|
List<SupStationInfo> resultList = new ArrayList<>();
|
||||||
|
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
|
||||||
|
SupStationInfo stationInfo = new SupStationInfo();
|
||||||
|
String stationId = String.valueOf(pileStationInfo.getId());
|
||||||
|
stationInfo.setStationID(stationId);
|
||||||
|
// MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId()));
|
||||||
|
stationInfo.setOperatorID(Constants.OPERATORID_LIANLIAN); // 组织机构代码
|
||||||
|
stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId()));
|
||||||
|
stationInfo.setStationName(pileStationInfo.getStationName());
|
||||||
|
stationInfo.setIsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()));
|
||||||
|
stationInfo.setIsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()));
|
||||||
|
stationInfo.setCountryCode(pileStationInfo.getCountryCode());
|
||||||
|
stationInfo.setAreaCode(pileStationInfo.getAreaCode());
|
||||||
|
stationInfo.setAddress(pileStationInfo.getAddress());
|
||||||
|
stationInfo.setServiceTel(pileStationInfo.getStationTel());
|
||||||
|
stationInfo.setStationType(Integer.valueOf(pileStationInfo.getStationType()));
|
||||||
|
stationInfo.setParkNums(Integer.valueOf(pileStationInfo.getParkNums()));
|
||||||
|
stationInfo.setStationLng(new BigDecimal(pileStationInfo.getStationLng()));
|
||||||
|
stationInfo.setStationLat(new BigDecimal(pileStationInfo.getStationLat()));
|
||||||
|
stationInfo.setConstruction(Integer.valueOf(pileStationInfo.getConstruction()));
|
||||||
|
stationInfo.setOpenAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()));
|
||||||
|
// stationInfo.setMinElectricityPrice(pileStationInfo); // 最低充电电费率
|
||||||
|
// stationInfo.setElectricityFee(); // 电费 xx元/度
|
||||||
|
// stationInfo.setServiceFee(); // 服务费 xx元/度
|
||||||
|
stationInfo.setParkFree(Integer.valueOf(pileStationInfo.getParkFree()));
|
||||||
|
stationInfo.setPayment(pileStationInfo.getPayment());
|
||||||
|
stationInfo.setSupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()));
|
||||||
|
// stationInfo.setParkFeeType(pileStationInfo); // 停车收费类型
|
||||||
|
stationInfo.setToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()));
|
||||||
|
stationInfo.setStoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag()));
|
||||||
|
stationInfo.setRestaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()));
|
||||||
|
stationInfo.setLoungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag()));
|
||||||
|
stationInfo.setCanopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag()));
|
||||||
|
stationInfo.setPrinterFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()));
|
||||||
|
stationInfo.setBarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()));
|
||||||
|
stationInfo.setParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()));
|
||||||
|
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
|
||||||
|
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||||
|
stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||||
|
}
|
||||||
|
resultList.add(stationInfo);
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("PageNo", pageInfo.getPageNum());
|
||||||
|
map.put("PageCount", pageInfo.getPages());
|
||||||
|
map.put("ItemSize", pageInfo.getTotal());
|
||||||
|
map.put("StationInfos", resultList);
|
||||||
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态变化推送 notification_stationStatus
|
||||||
|
* @param stationId 站点id
|
||||||
|
* @param pileConnectorCode 充电桩枪口编号
|
||||||
|
* @param status 枪口状态
|
||||||
|
* @param secretInfoVO 密钥信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) {
|
||||||
|
// 查询相关配置信息
|
||||||
|
ThirdPartySecretInfoVO suZhouSecretInfo = getSuZhouSecretInfo();
|
||||||
|
|
||||||
|
String operatorId = suZhouSecretInfo.getTheirOperatorId();
|
||||||
|
String operatorSecret = suZhouSecretInfo.getTheirOperatorSecret();
|
||||||
|
String signSecret = suZhouSecretInfo.getTheirSigSecret();
|
||||||
|
String dataSecret = suZhouSecretInfo.getTheirDataSecret();
|
||||||
|
String dataSecretIv = suZhouSecretInfo.getTheirDataSecretIv();
|
||||||
|
String urlAddress = suZhouSecretInfo.getTheirUrlPrefix();
|
||||||
|
|
||||||
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_STATUS.getValue();
|
||||||
|
ConnectorStatusInfo info = ConnectorStatusInfo.builder()
|
||||||
|
.connectorID(pileConnectorCode)
|
||||||
|
.status(Integer.parseInt(status))
|
||||||
|
.build();
|
||||||
|
// 调用联联平台接口
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("ConnectorStatusInfo", info);
|
||||||
|
String jsonString = JSON.toJSONString(json);
|
||||||
|
// 获取令牌
|
||||||
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备接口状态查询 query_station_status
|
||||||
|
* @param dto 查询站点信息dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> queryStationStatus(QueryStationInfoDTO dto) {
|
||||||
|
List<String> stationIds = dto.getStationIds();
|
||||||
|
List<StationStatusInfo> StationStatusInfos = new ArrayList<>();
|
||||||
|
List<Object> connectorStatusInfos = new ArrayList<>();
|
||||||
|
|
||||||
|
// 查询密钥信息
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getSuZhouSecretInfo();
|
||||||
|
|
||||||
|
ConnectorStatusInfo connectorStatusInfo;
|
||||||
|
for (String stationId : stationIds) {
|
||||||
|
StationStatusInfo stationStatusInfo = new StationStatusInfo();
|
||||||
|
stationStatusInfo.setStationId(stationId);
|
||||||
|
// 根据站点id查询
|
||||||
|
List<ConnectorInfoVO> list = pileConnectorInfoService.getConnectorListForLianLian(Long.parseLong(stationId));
|
||||||
|
for (ConnectorInfoVO connectorInfoVO : list) {
|
||||||
|
|
||||||
|
String connectorStatus = connectorInfoVO.getConnectorStatus();
|
||||||
|
if (StringUtils.equals(connectorStatus, PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue())) {
|
||||||
|
// 充电中
|
||||||
|
ConnectorChargeStatusInfo info = new ConnectorChargeStatusInfo();
|
||||||
|
OrderBasicInfo orderBasicInfo = orderBasicInfoService.queryChargingByPileConnectorCode(connectorInfoVO.getPileConnectorCode());
|
||||||
|
if (orderBasicInfo == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
|
||||||
|
if (CollectionUtils.isNotEmpty(chargingRealTimeData)) {
|
||||||
|
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
|
||||||
|
info.setStartChargeSeq(orderBasicInfo.getOrderCode());
|
||||||
|
info.setConnectorID(orderBasicInfo.getPileConnectorCode());
|
||||||
|
info.setConnectorStatus(Integer.valueOf(connectorInfoVO.getConnectorStatus()));
|
||||||
|
info.setCurrentA(new BigDecimal(realTimeMonitorData.getOutputCurrent()));
|
||||||
|
info.setVoltageA(new BigDecimal(realTimeMonitorData.getOutputVoltage()));
|
||||||
|
info.setSoc(new BigDecimal(realTimeMonitorData.getSOC()));
|
||||||
|
info.setStartTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()));
|
||||||
|
info.setEndTime(DateUtils.getDateTime()); // 本次采样时间
|
||||||
|
info.setTotalPower(new BigDecimal(realTimeMonitorData.getChargingDegree())); // 累计充电量
|
||||||
|
info.setTotalMoney(new BigDecimal(realTimeMonitorData.getChargingAmount()));
|
||||||
|
connectorStatusInfos.add(info);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 其他
|
||||||
|
connectorStatusInfo = new ConnectorStatusInfo();
|
||||||
|
connectorStatusInfo.setConnectorID(connectorInfoVO.getPileConnectorCode());
|
||||||
|
connectorStatusInfo.setStatus(Integer.parseInt(connectorInfoVO.getConnectorStatus()));
|
||||||
|
connectorStatusInfos.add(connectorStatusInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stationStatusInfo.setConnectorStatusInfos(connectorStatusInfos);
|
||||||
|
StationStatusInfos.add(stationStatusInfo);
|
||||||
|
}
|
||||||
|
// 将 StationStatusInfos 分页
|
||||||
|
int pageNum = 1;
|
||||||
|
int pageSize = 10;
|
||||||
|
List<StationStatusInfo> collect = StationStatusInfos.stream()
|
||||||
|
.skip((pageNum - 1) * pageSize)
|
||||||
|
.limit(pageSize)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
int total = StationStatusInfos.size();
|
||||||
|
// int pages = PageUtil.totalPage(total, pageSize);
|
||||||
|
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("Total", total);
|
||||||
|
map.put("StationStatusInfos", collect);
|
||||||
|
|
||||||
|
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String notificationEquipChargeStatus(String orderCode) {
|
||||||
|
// 根据订单号查询订单信息
|
||||||
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
|
ThirdPartySecretInfoVO suZhouSecretInfo = getSuZhouSecretInfo();
|
||||||
|
|
||||||
|
String operatorId = suZhouSecretInfo.getOurOperatorId();
|
||||||
|
String operatorSecret = suZhouSecretInfo.getTheirOperatorSecret();
|
||||||
|
String signSecret = suZhouSecretInfo.getTheirSigSecret();
|
||||||
|
String dataSecret = suZhouSecretInfo.getTheirDataSecret();
|
||||||
|
String dataSecretIv = suZhouSecretInfo.getTheirDataSecretIv();
|
||||||
|
String urlAddress = suZhouSecretInfo.getTheirUrlPrefix();
|
||||||
|
|
||||||
|
// 查询充电枪口状态
|
||||||
|
PileConnectorInfoVO connectorInfo = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode());
|
||||||
|
if (Objects.isNull(connectorInfo)) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
String merchantId = connectorInfo.getMerchantId();
|
||||||
|
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
|
||||||
|
if (Objects.isNull(merchantInfoVO)) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
|
||||||
|
}
|
||||||
|
String orderStatus = orderInfo.getOrderStatus();
|
||||||
|
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderStatus)) {
|
||||||
|
// 充电中
|
||||||
|
orderStatus = "2";
|
||||||
|
}else if (StringUtils.equals(OrderStatusEnum.ORDER_COMPLETE.getValue(), orderStatus)) {
|
||||||
|
// 充电完成
|
||||||
|
orderStatus = "4";
|
||||||
|
}
|
||||||
|
String dateTimeNow = DateUtils.getDateTime();
|
||||||
|
|
||||||
|
SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder()
|
||||||
|
.startChargeSeq(orderCode)
|
||||||
|
.startChargeSeqStat(Integer.parseInt(orderStatus))
|
||||||
|
// .operatorID(Constants.JSOWELL_OPERATORID)
|
||||||
|
// .equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode()))
|
||||||
|
// .stationID(orderInfo.getStationId())
|
||||||
|
// .equipmentID(orderInfo.getPileSn())
|
||||||
|
// .orderNo(orderCode)
|
||||||
|
// .orderStatus(Integer.parseInt(orderStatus))
|
||||||
|
.connectorID(orderInfo.getPileConnectorCode())
|
||||||
|
// .equipmentClassification(1)
|
||||||
|
// .pushTimeStamp(dateTimeNow)
|
||||||
|
.connectorStatus(connectorInfo.getStatus())
|
||||||
|
.currentA(connectorInfo.getCurrent())
|
||||||
|
.voltageA(connectorInfo.getVoltage())
|
||||||
|
.soc(new BigDecimal(Constants.ZERO))
|
||||||
|
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()))
|
||||||
|
.endTime(dateTimeNow)
|
||||||
|
.totalPower(connectorInfo.getInstantPower())
|
||||||
|
|
||||||
|
.build();
|
||||||
|
if (StringUtils.isNotBlank(connectorInfo.getSOC())) {
|
||||||
|
supEquipChargeStatusInfo.setSoc(new BigDecimal(connectorInfo.getSOC()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_EQUIP_CHARGE_STATUS;
|
||||||
|
// 调用联联平台接口
|
||||||
|
String jsonString = JSON.toJSONString(supEquipChargeStatusInfo);
|
||||||
|
|
||||||
|
// 获取令牌
|
||||||
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送充电订单 notification_charge_order_info
|
||||||
|
* @param orderCode
|
||||||
|
* @param secretInfoVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
|
||||||
|
// 根据订单号查询出信息
|
||||||
|
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
|
if (orderBasicInfo == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String operatorId = Constants.OPERATORID_JIANG_SU;
|
||||||
|
String operatorSecret = secretInfoVO.getTheirOperatorSecret();
|
||||||
|
String signSecret = secretInfoVO.getTheirSigSecret();
|
||||||
|
String dataSecret = secretInfoVO.getTheirDataSecret();
|
||||||
|
String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
|
||||||
|
String urlAddress = secretInfoVO.getTheirUrlPrefix();
|
||||||
|
|
||||||
|
// 推送地址
|
||||||
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_CHARGE_ORDER_INFO;
|
||||||
|
|
||||||
|
// 根据订单号查询订单详情
|
||||||
|
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||||
|
if (orderDetail == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChargeOrderInfo chargeOrderInfo = ChargeOrderInfo.builder()
|
||||||
|
.startChargeSeq(orderCode)
|
||||||
|
.connectorId(orderBasicInfo.getPileConnectorCode())
|
||||||
|
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()))
|
||||||
|
.endTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime()))
|
||||||
|
.totalPower(orderDetail.getTotalUsedElectricity())
|
||||||
|
.totalElecMoney(orderDetail.getTotalElectricityAmount())
|
||||||
|
.totalSeviceMoney(orderDetail.getTotalServiceAmount())
|
||||||
|
.totalMoney(orderDetail.getTotalOrderAmount())
|
||||||
|
.stopReason(2)
|
||||||
|
|
||||||
|
.build();
|
||||||
|
// 获取令牌
|
||||||
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 调用联联平台接口
|
||||||
|
String jsonString = JSON.toJSONString(chargeOrderInfo);
|
||||||
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送充电站信息 notification_station_info
|
||||||
|
* @param stationId 充电站id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String notificationStationInfo(String stationId) {
|
||||||
|
// 通过站点id查询站点信息
|
||||||
|
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.parseLong(stationId));
|
||||||
|
|
||||||
|
ThirdPartySecretInfoVO suZhouSecretInfo = getSuZhouSecretInfo();
|
||||||
|
String operatorId = suZhouSecretInfo.getOurOperatorId();
|
||||||
|
String operatorSecret = suZhouSecretInfo.getTheirOperatorSecret();
|
||||||
|
String signSecret = suZhouSecretInfo.getTheirSigSecret();
|
||||||
|
String dataSecret = suZhouSecretInfo.getTheirDataSecret();
|
||||||
|
String dataSecretIv = suZhouSecretInfo.getTheirDataSecretIv();
|
||||||
|
String urlAddress = suZhouSecretInfo.getTheirUrlPrefix();
|
||||||
|
|
||||||
|
// 组装联联平台所需要的数据格式
|
||||||
|
StationInfo info = StationInfo.builder()
|
||||||
|
.stationID(stationId)
|
||||||
|
.operatorID(operatorId)
|
||||||
|
.stationName(pileStationInfo.getStationName())
|
||||||
|
.isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
|
||||||
|
.isPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
|
||||||
|
.countryCode(pileStationInfo.getCountryCode())
|
||||||
|
.address(pileStationInfo.getAddress())
|
||||||
|
.serviceTel(pileStationInfo.getStationTel())
|
||||||
|
.stationType(Integer.valueOf(pileStationInfo.getStationType()))
|
||||||
|
.stationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
|
||||||
|
.parkNums(Integer.valueOf(pileStationInfo.getParkNums()))
|
||||||
|
.stationLng(new BigDecimal(pileStationInfo.getStationLng()))
|
||||||
|
.stationLat(new BigDecimal(pileStationInfo.getStationLat()))
|
||||||
|
.construction(Integer.valueOf(pileStationInfo.getConstruction()))
|
||||||
|
.openAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()))
|
||||||
|
.minElectricityPrice(new BigDecimal(Constants.ZERO))
|
||||||
|
.electricityFee(Constants.ZERO)
|
||||||
|
.serviceFee(Constants.ZERO)
|
||||||
|
.parkFree(Integer.valueOf(pileStationInfo.getParkFree()))
|
||||||
|
.supportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
|
||||||
|
.parkFeeType(0)
|
||||||
|
.toiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
|
||||||
|
.storeFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
|
||||||
|
.restaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
|
||||||
|
.loungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag()))
|
||||||
|
.canopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag()))
|
||||||
|
.printerFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()))
|
||||||
|
.barrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()))
|
||||||
|
.parkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()))
|
||||||
|
// .parkNums()
|
||||||
|
// .supportOrder()
|
||||||
|
.build();
|
||||||
|
String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213
|
||||||
|
// 根据逗号分组
|
||||||
|
String[] split = StringUtils.split(areaCode, ",");
|
||||||
|
// 只取最后一部分 330213
|
||||||
|
String subAreaCode = split[split.length - 1];
|
||||||
|
info.setAreaCode(subAreaCode);
|
||||||
|
// 截取运营商组织机构代码(去除最后一位后的最后九位)
|
||||||
|
String organizationCode = "";
|
||||||
|
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPlatformType)) {
|
||||||
|
// 联联平台先使用自己运营商的组织机构代码
|
||||||
|
organizationCode = Constants.OPERATORID_LIANLIAN;
|
||||||
|
info.setEquipmentOwnerID(organizationCode);
|
||||||
|
} else {
|
||||||
|
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId()));
|
||||||
|
organizationCode = merchantInfo.getOrganizationCode();
|
||||||
|
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||||
|
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||||
|
info.setEquipmentOwnerID(equipmentOwnerId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.equals("36", String.valueOf(pileStationInfo.getMerchantId()))) {
|
||||||
|
// 远大
|
||||||
|
info.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA);
|
||||||
|
}
|
||||||
|
if (MerchantUtils.isXiXiaoMerchant(String.valueOf(pileStationInfo.getMerchantId()))) {
|
||||||
|
// 如果是希晓运营商,则把equipmentOwnerID换成希晓
|
||||||
|
info.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO);
|
||||||
|
}
|
||||||
|
String payment = StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment());
|
||||||
|
info.setPayment(payment);
|
||||||
|
if (StringUtils.isNotBlank(pileStationInfo.getParkingNumber())) {
|
||||||
|
info.setIsPublicParkingLot(1);
|
||||||
|
info.setParkingLotNumber(pileStationInfo.getParkingNumber());
|
||||||
|
}
|
||||||
|
// 户号
|
||||||
|
if (StringUtils.isNotBlank(pileStationInfo.getAccountNumber())) {
|
||||||
|
info.setAccountNumber(pileStationInfo.getAccountNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 容量
|
||||||
|
if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) {
|
||||||
|
info.setCapacity(pileStationInfo.getCapacity().setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||||
|
}
|
||||||
|
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
|
||||||
|
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||||
|
info.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用联联平台接口
|
||||||
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_INFO;
|
||||||
|
|
||||||
|
String jsonStr = JSON.toJSONString(info);
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
data.put("StationInfo", jsonStr);
|
||||||
|
|
||||||
|
String jsonString = JSON.toJSONString(data);
|
||||||
|
|
||||||
|
// 获取令牌
|
||||||
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
|
||||||
|
, dataSecretIv, operatorId, signSecret);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取苏州平台密钥
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ThirdPartySecretInfoVO getSuZhouSecretInfo() {
|
||||||
|
String thirdPartyType = ThirdPlatformTypeEnum.SU_ZHOU_PLATFORM.getTypeCode();
|
||||||
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPartyType);
|
||||||
|
if (thirdPartySecretInfoVO == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||||
|
}
|
||||||
|
return thirdPartySecretInfoVO;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user