From 0d4c9f50ee2bc3e4a03abd91ac7c9e03891d37f2 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期四, 20 二月 2025 17:41:19 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile --- ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java | 301 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 300 insertions(+), 1 deletions(-) diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java index d93bf73..5484a0c 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java @@ -244,7 +244,7 @@ if(null == pageSize){ pageSize = 10; } - PageInfo<Site> siteListPaging = siteClient.getSiteListPaging(pageNo, pageSize); + PageInfo<Site> siteListPaging = siteClient.getSiteListPaging(pageNo, pageSize, new ArrayList<>()); List<TParkingLot> parkingLots = parkingLotClient.getAllParkingLot().getData(); QueryStationsInfoResult queryStationsInfoResult = new QueryStationsInfoResult(); queryStationsInfoResult.setPageNo(pageNo); @@ -1633,4 +1633,303 @@ queryChargeOrderInfoResult.setOrderInfos(orderInfos); return queryChargeOrderInfoResult; } + + + + /*********************数据监管平台接口*********************/ + + + /** + * 查询运营商信息 + * @param baseRequest + * @param request + * @return + */ + @PostMapping("/supervise_query_operator_info") + public BaseResult superviseQueryOperatorInfo(@RequestBody BaseRequest baseRequest, HttpServletRequest request){ + log.info("监管平台查询充电站信息请求参数:" + JacksonUtils.toJson(baseRequest)); + //校验token和签名 + BaseResult baseResult = requestCheck(true, baseRequest, request); + if(0 != baseResult.getRet()){ + log.info("监管平台查询充电站信息响应Data:"); + baseResult.setData(""); + baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); + log.info("监管平台查询充电站信息响应参数:" + JacksonUtils.toJson(baseResult)); + return baseResult; + } + Operator operator = baseResult.getOperator(); + //解密参数 + String decrypt = AESUtil.decrypt(baseRequest.getData(), operator.getOurDataSecret(), operator.getOurDataSecretIv()); + log.info("监管平台查询充电站信息请求Data:" + decrypt); + SuperviseQueryOperatorInfo superviseQueryOperatorInfo = JSON.parseObject(decrypt, SuperviseQueryOperatorInfo.class); + Integer pageNo = superviseQueryOperatorInfo.getPageNo(); + Integer pageSize = superviseQueryOperatorInfo.getPageSize(); + if(null == pageNo){ + pageNo = 1; + } + if(null == pageSize){ + pageSize = 50; + } + String operatorTel = systemConfigurationClient.getServerPhone().getData(); + SuperviseQueryOperatorInfoResult superviseQueryOperatorInfoResult = new SuperviseQueryOperatorInfoResult(); + superviseQueryOperatorInfoResult.setOperatorID("906171535"); + superviseQueryOperatorInfoResult.setOperatorUSCID("91510903906171535D"); + superviseQueryOperatorInfoResult.setOperatorName("四川明星新能源科技有限公司"); + superviseQueryOperatorInfoResult.setOperatorTel1(operatorTel); + + //参数加密 + String jsonString = JacksonUtils.toJson(superviseQueryOperatorInfoResult); + log.info("监管平台查询充电站信息响应Data:" + jsonString); + String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); + baseResult.setData(encrypt); + baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); + log.info("监管平台查询充电站信息响应参数:" + JacksonUtils.toJson(baseResult)); + return baseResult; + } + + + +// /** +// * 查询充电站信息 +// * @param baseRequest +// * @param request +// * @return +// */ +// @PostMapping("/supervise_query_stations_info") +// public BaseResult superviseQueryStationsInfo(@RequestBody BaseRequest baseRequest, HttpServletRequest request){ +// log.info("监管平台查询充电站信息请求参数:" + JacksonUtils.toJson(baseRequest)); +// //校验token和签名 +// BaseResult baseResult = requestCheck(true, baseRequest, request); +// if(0 != baseResult.getRet()){ +// log.info("监管平台查询充电站信息响应Data:"); +// baseResult.setData(""); +// baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); +// log.info("监管平台查询充电站信息响应参数:" + JacksonUtils.toJson(baseResult)); +// return baseResult; +// } +// Operator operator = baseResult.getOperator(); +// //解密参数 +// String decrypt = AESUtil.decrypt(baseRequest.getData(), operator.getOurDataSecret(), operator.getOurDataSecretIv()); +// log.info("监管平台查询充电站信息请求Data:" + decrypt); +// QueryStationsInfo queryStationsInfo = JSON.parseObject(decrypt, QueryStationsInfo.class); +// Integer pageNo = queryStationsInfo.getPageNo(); +// Integer pageSize = queryStationsInfo.getPageSize(); +// List<String> stationIDs = queryStationsInfo.getStationIDs(); +// if(null == pageNo){ +// pageNo = 1; +// } +// if(null == pageSize){ +// pageSize = 50; +// } +// PageInfo<Site> siteListPaging = siteClient.getSiteListPaging(pageNo, pageSize, stationIDs); +// List<TParkingLot> parkingLots = parkingLotClient.getAllParkingLot().getData(); +// QueryStationsInfoResult queryStationsInfoResult = new QueryStationsInfoResult(); +// queryStationsInfoResult.setPageNo(pageNo); +// queryStationsInfoResult.setPageCount((0 == (siteListPaging.getTotal() % pageSize) ? 0 : 1) + Double.valueOf(siteListPaging.getTotal() / pageSize).intValue()); +// queryStationsInfoResult.setItemSize(Long.valueOf(siteListPaging.getTotal()).intValue()); +// queryStationsInfoResult.setStationInfos(superviseBuildSite(parkingLots, siteListPaging.getRecords())); +// //参数加密 +// String jsonString = JacksonUtils.toJson(queryStationsInfoResult); +// log.info("监管平台查询充电站信息响应Data:" + jsonString); +// String encrypt = AESUtil.encrypt(jsonString, operator.getOurDataSecret(), operator.getOurDataSecretIv()); +// baseResult.setData(encrypt); +// baseResult.setSig(TCECUtil.ourBuildSign(baseResult)); +// log.info("监管平台查询充电站信息响应参数:" + JacksonUtils.toJson(baseResult)); +// return baseResult; +// } +// +// +// /** +// * 构建站点数据 +// * @param sites +// * @return +// */ +// public List<StationInfo> superviseBuildSite(List<TParkingLot> parkingLots, List<Site> sites){ +// List<Integer> siteIds = sites.stream().map(Site::getId).collect(Collectors.toList()); +// List<TChargingPile> tChargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); +// List<Integer> collect1 = tChargingPiles.stream().map(TChargingPile::getId).collect(Collectors.toList()); +// List<TChargingGun> chargingGunList = chargingGunClient.getChargingGunByChargingPileIds(collect1).getData(); +// String serviceTel = systemConfigurationClient.getServerPhone().getData(); +// List<StationInfo> StationInfos = new ArrayList<>(); +// for (Site datum : sites) { +// StationInfo stationInfo = new StationInfo(); +// stationInfo.setStationID(datum.getId().toString()); +// stationInfo.setStationUniqueNumber(datum.getDistrictsCode() + "906171535" + datum.getId()); +// stationInfo.setOperatorID("906171535"); +// stationInfo.setEquipmentOwnerID("906171535"); +// stationInfo.setStationName(datum.getName()); +// stationInfo.setCountryCode(StringUtils.isNotEmpty(datum.getCountryCode()) ? datum.getCountryCode() : "CN"); +// stationInfo.setAreaCode(datum.getDistrictsCode()); +// stationInfo.setAreaCodeCountryside(); +// stationInfo.setAddress(datum.getAddress()); +// stationInfo.setStationTel(datum.getPhone()); +// stationInfo.setServiceTel(serviceTel); +// switch (datum.getSiteType()){ +// case 0: +// stationInfo.setStationType(StationTypeEnum.OTHER.getType()); +// break; +// case 1: +// stationInfo.setStationType(StationTypeEnum.PUBLIC.getType()); +// break; +// case 2: +// stationInfo.setStationType(StationTypeEnum.PERSONAGE.getType()); +// break; +// case 3: +// stationInfo.setStationType(StationTypeEnum.BUS_SPECIFIC.getType()); +// break; +// case 4: +// stationInfo.setStationType(StationTypeEnum.SANITATION_SPECIFIC.getType()); +// break; +// case 5: +// stationInfo.setStationType(StationTypeEnum.LOGISTICS_SPECIFIC.getType()); +// break; +// case 6: +// stationInfo.setStationType(StationTypeEnum.TEXT_SPECIFIC.getType()); +// break; +// } +// if(datum.getStatus() == 1){ +// stationInfo.setStationStatus(StationStatusEnum.NORMAL_USE.getStatus()); +// } +// if(datum.getStatus() == 2){ +// stationInfo.setStationStatus(StationStatusEnum.MAINTAIN.getStatus()); +// } +// if(datum.getStatus() == 3){ +// stationInfo.setStationStatus(StationStatusEnum.OFF_LINE.getStatus()); +// } +// stationInfo.setParkNums(datum.getParkingSpace()); +// stationInfo.setStationLat(new BigDecimal(datum.getLat()).setScale(6, RoundingMode.DOWN)); +// stationInfo.setStationLng(new BigDecimal(datum.getLon()).setScale(6, RoundingMode.DOWN)); +// stationInfo.setConstruction(datum.getConstructionSite() == 0 ? ConstructionEnum.OTHER.getType() : datum.getConstructionSite()); +// stationInfo.setPictures(StringUtils.isNotEmpty(datum.getImgUrl()) ? Arrays.asList(datum.getImgUrl().split(",")) : new ArrayList<>()); +// stationInfo.setSiteGuide(datum.getGuide()); +// stationInfo.setMatchCars(datum.getVehicleDescription()); +// stationInfo.setBusineHours(datum.getStartServiceTime() + "-" + datum.getEndServiceTime()); +// stationInfo.setElectricityFee(datum.getRateDescription()); +// //添加停车费信息 +// Optional<TParkingLot> first = parkingLots.stream().filter(s -> s.getSiteId().equals(datum.getId())).findFirst(); +// if(first.isPresent()){ +// TParkingLot tParkingLot = first.get(); +// superviseBuildPlaceHolder(tParkingLot, stationInfo); +// } +// +// //构建充电设备信息数据 +// stationInfo.setEquipmentInfos(superviseBuildEquipmentInfo(datum.getId(), tChargingPiles, chargingGunList)); +// StationInfos.add(stationInfo); +// +// } +// return StationInfos; +// } +// +// +// /** +// * 构建停车费信息 +// * @param tParkingLot +// * @param stationInfo +// */ +// public void superviseBuildPlaceHolder(TParkingLot tParkingLot, StationInfo stationInfo){ +// stationInfo.setOvertimeFee(tParkingLot.getName() + "停车费"); +// PlaceHolder placeHolder = new PlaceHolder(); +// placeHolder.setFreeTime(tParkingLot.getChargeFreeDuration()); +// placeHolder.setMaxFee(tParkingLot.getChargeCapping()); +// List<PlaceHolderPrice> PlaceHolderPrices = new ArrayList<>(); +// PlaceHolderPrice placeHolderPrice = new PlaceHolderPrice(); +// placeHolderPrice.setStartTime("00:00"); +// placeHolderPrice.setEndTime("23:59"); +// placeHolderPrice.setPrice(tParkingLot.getChargeRate()); +// PlaceHolderPrices.add(placeHolderPrice); +// placeHolder.setPlaceHolderPrices(PlaceHolderPrices); +// stationInfo.setPlaceHolder(placeHolder); +// } +// +// +// +// +// /** +// * 构建桩数据 +// * @param tChargingPiles +// * @return +// */ +// public List<EquipmentInfo> superviseBuildEquipmentInfo(Integer siteId, List<TChargingPile> tChargingPiles, List<TChargingGun> chargingGunList){ +// List<EquipmentInfo> equipmentInfos = new ArrayList<>(); +// List<TChargingPile> collect = tChargingPiles.stream().filter(s -> s.getSiteId().equals(siteId)).collect(Collectors.toList()); +// for (TChargingPile tChargingPile : collect) { +// EquipmentInfo equipmentInfo = new EquipmentInfo(); +// equipmentInfo.setEquipmentID(tChargingPile.getId().toString()); +// equipmentInfo.setManufacturerID(tChargingPile.getManufacturerCode()); +// equipmentInfo.setManufacturerName(tChargingPile.getManufacturer()); +// equipmentInfo.setEquipmentModel(tChargingPile.getEquipmentType()); +// if(null != tChargingPile.getProductionDate()){ +// equipmentInfo.setProductionDate(tChargingPile.getProductionDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); +// } +// switch (tChargingPile.getType()){ +// case 0: +// equipmentInfo.setEquipmentType(EquipmentTypeEnum.OTHER.getType()); +// break; +// case 1: +// equipmentInfo.setEquipmentType(EquipmentTypeEnum.DIRECT_CURRENT.getType()); +// break; +// case 2: +// equipmentInfo.setEquipmentType(EquipmentTypeEnum.ALTERNATING_CURRENT.getType()); +// break; +// case 3: +// equipmentInfo.setEquipmentType(EquipmentTypeEnum.ALTERNATING_DIRECT.getType()); +// break; +// case 4: +// equipmentInfo.setEquipmentType(EquipmentTypeEnum.WIRELESS_DEVICE.getType()); +// break; +// } +// +// //构建设备接口信息 +// equipmentInfo.setConnectorInfos(superviseBuildConnectorInfos(tChargingPile.getId(), tChargingPile.getCode(), chargingGunList)); +// equipmentInfo.setPower(tChargingPile.getRatedPower()); +// equipmentInfos.add(equipmentInfo); +// } +// return equipmentInfos; +// } +// +// +// /** +// * 构建接口数据 +// * @param chargingGunList +// * @return +// */ +// public List<ConnectorInfo> superviseBuildConnectorInfos(Integer chargingPileId, String code, List<TChargingGun> chargingGunList){ +// List<ConnectorInfo> connectorInfos = new ArrayList<>(); +// List<TChargingGun> collect = chargingGunList.stream().filter(s -> s.getChargingPileId().equals(chargingPileId)).collect(Collectors.toList()); +// for (TChargingGun chargingGun : collect) { +// ConnectorInfo connectorInfo = new ConnectorInfo(); +// connectorInfo.setConnectorID(chargingGun.getFullNumber()); +// connectorInfo.setConnectorName(chargingGun.getName()); +// switch (chargingGun.getType()){ +// case 0: +// connectorInfo.setConnectorType(ConnectorTypeEnum.OTHER.getType()); +// break; +// case 1: +// connectorInfo.setConnectorType(ConnectorTypeEnum.HOUSEHOLD_SOCKET.getType()); +// break; +// case 2: +// connectorInfo.setConnectorType(ConnectorTypeEnum.AC_SOCKET.getType()); +// break; +// case 3: +// connectorInfo.setConnectorType(ConnectorTypeEnum.AC_INTERFACE_PLUG.getType()); +// break; +// case 4: +// connectorInfo.setConnectorType(ConnectorTypeEnum.DC_INTERFACE_GUN_HEAD.getType()); +// break; +// case 5: +// connectorInfo.setConnectorType(ConnectorTypeEnum.WIRELESS_CHARGING_STAND.getType()); +// break; +// } +// connectorInfo.setVoltageUpperLimits(chargingGun.getUpperRatedVoltage().intValue()); +// connectorInfo.setVoltageLowerLimits(chargingGun.getLowerLimitOfRatedVoltage().intValue()); +// connectorInfo.setCurrent(chargingGun.getRatedCurrent().intValue()); +// connectorInfo.setPower(chargingGun.getRatedPower()); +// connectorInfo.setParkNo(chargingGun.getParkingNumber()); +// connectorInfo.setNationalStandard(Integer.valueOf(chargingGun.getNationalStandard())); +// connectorInfo.setQRCode("https://mxcd.zhinenganguan.com?No=" + code + chargingGun.getCode()); +// connectorInfos.add(connectorInfo); +// } +// return connectorInfos; +// } + } -- Gitblit v1.7.1