update 联联接口

This commit is contained in:
Lemon
2023-06-02 11:37:30 +08:00
parent 4e6ee93eb0
commit 91847a9805
6 changed files with 83 additions and 15 deletions

View File

@@ -127,11 +127,11 @@ public interface LianLianService {
String pushChargeOrderInfo(String orderCode);
/**
* 推送订单结算信息
* 推送订单结算信息 (联联推给我们)
* @param dto
* @return
*/
String pushOrderSettlementInfo(PushOrderSettlementDTO dto);
Map<String, String> pushOrderSettlementInfo(PushOrderSettlementDTO dto);
/**
* 查询订单结算信息

View File

@@ -1163,17 +1163,17 @@ public class LianLianServiceImpl implements LianLianService {
}
/**
* 推送订单结算信息
* 推送订单结算信息 (联联推给我们)
*
* @param dto
* @return
*/
@Override
public String pushOrderSettlementInfo(PushOrderSettlementDTO dto) {
public Map<String, String> pushOrderSettlementInfo(PushOrderSettlementDTO dto) {
String orderCode = dto.getStartChargeSeq();
JSONObject json = new JSONObject();
json.put("StartChargeSeq", orderCode);
json.put("ConnectorID", dto.getConnectorID());
Map<String, Object> map = new LinkedHashMap<>();
map.put("StartChargeSeq", orderCode);
map.put("ConnectorID", dto.getConnectorID());
int confirmResult = Constants.one;
// 根据订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
@@ -1181,17 +1181,32 @@ public class LianLianServiceImpl implements LianLianService {
if (orderInfo == null || orderDetail == null) {
return null;
}
// 都不为空,根据传过来的数据进行修改数据库信息
// 通过operatorID 查出 operatorSecret
DockingPlatformConfig platformConfig = dockingPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
if (platformConfig == null) {
return null;
}
// orderInfo 和 orderDetail 都不为空,再根据传过来的数据进行修改数据库信息
confirmResult = Constants.zero;
orderDetail.setTotalUsedElectricity(dto.getTotalPower()); // 累计充电量
orderDetail.setTotalOrderAmount(dto.getTotalMoney()); // 累计总金额
orderBasicInfoService.updateOrderDetail(orderDetail);
json.put("ConfirmResult", confirmResult);
String jsonString = JSONObject.toJSONString(json);
map.put("ConfirmResult", confirmResult);
return jsonString;
Map<String, String> resultMap = Maps.newLinkedHashMap();
// 加密数据
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(map).getBytes(),
platformConfig.getOperatorSecret().getBytes(), platformConfig.getDataSecretIv().getBytes());
String encryptData = Encodes.encodeBase64(encryptText);
resultMap.put("Data", encryptData);
// 生成sig
String resultSign = GBSignUtils.sign(resultMap, platformConfig.getOperatorSecret());
resultMap.put("Sig", resultSign);
return resultMap;
}
/**