新增 宁波平台补推订单接口

This commit is contained in:
Lemon
2024-12-16 16:23:36 +08:00
parent 645016d579
commit 424d94d8a5
5 changed files with 71 additions and 23 deletions

View File

@@ -11,14 +11,12 @@ import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.response.RestApiResponse;
import com.jsowell.common.util.JWTUtils; import com.jsowell.common.util.JWTUtils;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.PushInfoParamDTO; import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
import com.jsowell.pile.dto.PushStationInfoDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.service.LianLianService; import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
import com.jsowell.thirdparty.platform.service.impl.ZhongDianLianPlatformServiceImpl;
import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.platform.util.Encodes;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
@@ -383,4 +381,12 @@ public class ZDLController extends ThirdPartyBaseController {
logger.info("宁波平台推送订单信息 result:{}", response); logger.info("宁波平台推送订单信息 result:{}", response);
return response; return response;
} }
@PostMapping("/tempPushHistoryOrderInfo")
public RestApiResponse<?> tempPushHistoryOrderInfo(@RequestBody QueryOrderDTO dto) {
RestApiResponse<?> response = null;
String result = platformLogic.pushOrderInfo(dto);
response = new RestApiResponse<>(result);
return response;
}
} }

View File

@@ -415,6 +415,10 @@ public interface ThirdPartyPlatformService extends InitializingBean {
throw new UnsupportedOperationException("This method is not yet implemented"); throw new UnsupportedOperationException("This method is not yet implemented");
} }
default String pushOrderInfo(com.jsowell.pile.dto.QueryOrderDTO dto){
throw new UnsupportedOperationException("This method is not yet implemented");
}
// -------------------------------------- 以下是公用方法 --------------------------------------- // // -------------------------------------- 以下是公用方法 --------------------------------------- //
/** /**
* 从联联平台获取令牌 * 从联联平台获取令牌

View File

@@ -149,7 +149,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
vo.setFailReason(failReason); vo.setFailReason(failReason);
vo.setSuccStat(succStat); vo.setSuccStat(succStat);
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(vo, thirdPartySecretInfoVO); Map<String, String> resultMap = ThirdPartyPlatformUtils.useOurSigSecretGenerateResultMap(vo, thirdPartySecretInfoVO);
return resultMap; return resultMap;
} }
@@ -187,7 +187,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
map.put("ItemSize", pageInfo.getTotal()); map.put("ItemSize", pageInfo.getTotal());
map.put("OperatorInfos", operatorInfos); map.put("OperatorInfos", operatorInfos);
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); Map<String, String> resultMap = ThirdPartyPlatformUtils.useOurSigSecretGenerateResultMap(map, thirdPartySecretInfoVO);
return resultMap; return resultMap;
} }
@@ -280,7 +280,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
map.put("PageCount", pageInfo.getPages()); map.put("PageCount", pageInfo.getPages());
map.put("ItemSize", pageInfo.getTotal()); map.put("ItemSize", pageInfo.getTotal());
map.put("StationInfos", resultList); map.put("StationInfos", resultList);
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); Map<String, String> resultMap = ThirdPartyPlatformUtils.useOurSigSecretGenerateResultMap(map, thirdPartySecretInfoVO);
return resultMap; return resultMap;
} }
@@ -426,7 +426,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("StationStatusInfos", stationStatusInfos); map.put("StationStatusInfos", stationStatusInfos);
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO); Map<String, String> resultMap = ThirdPartyPlatformUtils.useOurSigSecretGenerateResultMap(map, thirdPartySecretInfoVO);
return resultMap; return resultMap;
} }

View File

@@ -1,15 +1,12 @@
package com.jsowell.thirdparty.platform.service.impl; package com.jsowell.thirdparty.platform.service.impl;
import cn.hutool.core.util.PageUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.jsowell.common.constant.Constants; import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum; import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum; import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
@@ -25,9 +22,9 @@ import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO; import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO; import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
import com.jsowell.pile.vo.web.OrderListVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileModelInfoVO; import com.jsowell.pile.vo.web.PileModelInfoVO;
import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO; import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO;
@@ -40,10 +37,10 @@ import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.HttpRequestUtil; import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils; import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils;
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService; import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO;
import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.bouncycastle.crypto.CryptoException; import org.bouncycastle.crypto.CryptoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -62,6 +59,8 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
// 平台类型 // 平台类型
private final String thirdPlatformType = ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(); private final String thirdPlatformType = ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode();
Logger logger = LoggerFactory.getLogger(QingHaiPlatformServiceImpl.class);
@Autowired @Autowired
private ThirdpartySecretInfoService thirdpartySecretInfoService; private ThirdpartySecretInfoService thirdpartySecretInfoService;
@@ -169,7 +168,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
// 查询相关配置信息 // 查询相关配置信息
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret();
String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret();
String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret();
@@ -474,7 +473,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) { public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) {
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret();
String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret();
String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret();
@@ -510,7 +509,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
String operatorId = thirdPartySecretInfoVO.getOurOperatorId(); String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret(); String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret(); String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret(); String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
@@ -788,7 +787,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
return null; return null;
} }
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret();
String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret();
String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret();
@@ -825,7 +824,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
return null; return null;
} }
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret();
String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret();
String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret();
@@ -863,7 +862,7 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
// 查询相关配置信息 // 查询相关配置信息
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO(); ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
String operatorId = ningBoSecretInfoVO.getOurOperatorId(); String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret(); String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret();
String signSecret = ningBoSecretInfoVO.getTheirSigSecret(); String signSecret = ningBoSecretInfoVO.getTheirSigSecret();
String dataSecret = ningBoSecretInfoVO.getTheirDataSecret(); String dataSecret = ningBoSecretInfoVO.getTheirDataSecret();
@@ -970,6 +969,27 @@ public class ZhongDianLianPlatformServiceImpl implements ThirdPartyPlatformServi
return resultList; return resultList;
} }
@Override
public String pushOrderInfo(QueryOrderDTO dto) {
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
// 根据站点id 开始时间,结束时间查询出所有的订单信息
List<OrderListVO> orderListVOS = orderBasicInfoService.selectOrderBasicInfoList(dto);
if (CollectionUtils.isEmpty(orderListVOS)) {
return "订单信息为空";
}
List<String> orderCodeList = orderListVOS.stream().map(OrderListVO::getOrderCode).collect(Collectors.toList());
for (String orderCode : orderCodeList) {
try {
String result = notificationChargeOrderInfo(orderCode, ningBoSecretInfoVO);
logger.info("订单:{} 推送结果:{}", orderCode, result);
}catch (Exception e) {
logger.error("订单:{} 推送error, ", orderCode, e);
}
}
return "Success";
}
/** /**
* 获取宁波平台密钥信息 * 获取宁波平台密钥信息
* @return * @return

View File

@@ -16,7 +16,7 @@ import java.util.regex.Pattern;
public class ThirdPartyPlatformUtils { public class ThirdPartyPlatformUtils {
/** /**
* 生成结果集 * 生成结果集(使用对方SigSecret)
* @param obj 需要返回的数据 * @param obj 需要返回的数据
* @param secretInfo 密钥配置信息对象 * @param secretInfo 密钥配置信息对象
* @return 结果集 * @return 结果集
@@ -25,6 +25,16 @@ public class ThirdPartyPlatformUtils {
return generateResultMap(obj, secretInfo.getOurDataSecret(), secretInfo.getOurDataSecretIv(), secretInfo.getTheirSigSecret()); return generateResultMap(obj, secretInfo.getOurDataSecret(), secretInfo.getOurDataSecretIv(), secretInfo.getTheirSigSecret());
} }
/**
* 生成结果集使用我方SigSecret
* @param obj
* @param secretInfo
* @return
*/
public static Map<String, String> useOurSigSecretGenerateResultMap(Object obj, ThirdPartySecretInfoVO secretInfo) {
return generateResultMap(obj, secretInfo.getOurDataSecret(), secretInfo.getOurDataSecretIv(), secretInfo.getOurSigSecret());
}
/** /**
* 生成结果集 * 生成结果集
* @param obj 需要返回的数据 * @param obj 需要返回的数据
@@ -36,11 +46,11 @@ public class ThirdPartyPlatformUtils {
} }
/** /**
* 生成结果集 * 生成结果集(仅加密Data生成签名)
* @param obj 需要返回的数据 * @param obj 需要返回的数据
* @param dataSecret 消息密钥 * @param dataSecret 消息密钥
* @param dataSecretIv 消息密钥初始化向量 * @param dataSecretIv 消息密钥初始化向量
* @param signSecret 签名密钥 * @param signSecret 对方签名密钥
* @return 结果集 * @return 结果集
*/ */
public static Map<String, String> generateResultMap(Object obj, String dataSecret, String dataSecretIv, String signSecret) { public static Map<String, String> generateResultMap(Object obj, String dataSecret, String dataSecretIv, String signSecret) {
@@ -54,6 +64,14 @@ public class ThirdPartyPlatformUtils {
return resultMap; return resultMap;
} }
/**
* 生成结果集(将 Ret、Msg、Data进行加密生成签名)
* @param obj
* @param dataSecret
* @param dataSecretIv
* @param signSecret 对方签名密钥
* @return
*/
public static Map<String, String> generateResultMapV2(Object obj, String dataSecret, String dataSecretIv, String signSecret) { public static Map<String, String> generateResultMapV2(Object obj, String dataSecret, String dataSecretIv, String signSecret) {
Map<String, String> resultMap = Maps.newHashMap(); Map<String, String> resultMap = Maps.newHashMap();
// 加密数据 // 加密数据