mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
update 对接第三方平台
This commit is contained in:
@@ -334,6 +334,13 @@ public interface ThirdPartyPlatformService {
|
||||
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送订单结算信息 notification_order_settlement_info
|
||||
*/
|
||||
default Map<String, String> notificationOrderSettlementInfo(PushOrderSettlementDTO order) {
|
||||
throw new UnsupportedOperationException("This method is not yet implemented");
|
||||
}
|
||||
|
||||
// -------------------------------------- 以下是公用方法 --------------------------------------- //
|
||||
/**
|
||||
* 从联联平台获取令牌
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jsowell.common.util.JWTUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.PushOrderSettlementDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
@@ -857,5 +858,42 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> notificationOrderSettlementInfo(PushOrderSettlementDTO dto) {
|
||||
String orderCode = dto.getStartChargeSeq();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("StartChargeSeq", orderCode);
|
||||
map.put("ConnectorID", dto.getConnectorID());
|
||||
int confirmResult = Constants.one;
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
if (orderInfo == null || orderDetail == null) {
|
||||
return null;
|
||||
}
|
||||
// 通过operatorID 查出 operatorSecret
|
||||
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
if (platformConfig == null) {
|
||||
return null;
|
||||
}
|
||||
// orderInfo 和 orderDetail 都不为空,再根据传过来的数据进行修改数据库信息
|
||||
confirmResult = Constants.zero;
|
||||
orderDetail.setTotalUsedElectricity(dto.getTotalPower()); // 累计充电量
|
||||
orderDetail.setTotalOrderAmount(dto.getTotalMoney()); // 累计总金额
|
||||
orderBasicInfoService.updateOrderDetail(orderDetail);
|
||||
map.put("ConfirmResult", confirmResult);
|
||||
|
||||
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||
// 加密数据
|
||||
String encrypt = Cryptos.encrypt(JSON.toJSONString(map), platformConfig.getDataSecret(), platformConfig.getDataSecretIv());
|
||||
resultMap.put("Data", encrypt);
|
||||
// 生成sig
|
||||
String resultSign = GBSignUtils.sign(resultMap, platformConfig.getSignSecret());
|
||||
resultMap.put("Sig", resultSign);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user