diff --git a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/WeiWangKuaiDianController.java b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/WeiWangKuaiDianController.java index 181d4735b..913afd58c 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/WeiWangKuaiDianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/thirdparty/WeiWangKuaiDianController.java @@ -47,13 +47,14 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController { */ @PostMapping("/v1/query_token") public CommonResult queryToken(@RequestBody CommonParamsDTO dto) { - logger.info("{}-请求令牌 params:{}", platformName, JSON.toJSONString(dto)); + logger.info("宁波平台请求令牌 params:{}", JSON.toJSONString(dto)); try { + // Map map = zdlService.generateToken(dto); Map map = platformLogic.queryToken(dto); - logger.info("{}-请求令牌, params:{}, result:{}", platformName, JSON.toJSONString(dto) , JSON.toJSONString(map)); - return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig")); + logger.info("宁波平台请求令牌 result:{}", 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); + logger.error("宁波平台 请求令牌接口 异常"); return CommonResult.failed("获取token发生异常"); } } @@ -310,7 +311,7 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController { * @return */ @GetMapping("/v1/notification_start_charge_result") - public RestApiResponse notificationStartChargeResult(@RequestParam("orderCode") String orderCode) { + public RestApiResponse notification_start_charge_result(@RequestParam("orderCode") String orderCode) { logger.info("【{}】推送启动充电结果 params:{}", this.getClass().getSimpleName(), orderCode); RestApiResponse response = null; try { @@ -334,7 +335,7 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController { * @return */ @PostMapping("/v1/query_equip_charge_status") - public CommonResult queryEquipChargeStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { + public CommonResult query_equip_charge_status(HttpServletRequest request, @RequestBody CommonParamsDTO dto) { logger.info("{}-查询充电状态 params:{}", platformName, JSON.toJSONString(dto)); try { // 校验令牌 @@ -371,8 +372,8 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController { * @param orderCode * @return */ - @GetMapping("/notificationEquipChargeStatus/{orderCode}") - public RestApiResponse notificationEquipChargeStatus(@PathVariable("orderCode") String orderCode) { + @GetMapping("/v1/notification_equip_charge_status") + public RestApiResponse notification_equip_charge_status(@PathVariable("orderCode") String orderCode) { logger.info("推送充电状态 params:{}", orderCode); RestApiResponse response = null; try { @@ -433,7 +434,7 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController { * @param orderCode * @return */ - @GetMapping("/notificationStopChargeResult/{orderCode}") + @GetMapping("/v1/notification_stop_charge_result/{orderCode}") public RestApiResponse notificationStopChargeResult(@PathVariable("orderCode") String orderCode) { logger.info("推送停止充电结果 params:{}", orderCode); RestApiResponse response = null; @@ -454,7 +455,7 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController { /** * 充电订单信息推送 */ - @PostMapping("/notificationChargeOrderInfo") + @PostMapping("/v1/notification_charge_order_info") public AjaxResult notificationChargeOrderInfo(@RequestBody NotificationDTO dto) { AjaxResult result; try { @@ -470,25 +471,6 @@ public class WeiWangKuaiDianController extends ThirdPartyBaseController { return result; } - //TODO 接口待完善 - @PostMapping("/v1/check_charge_orders/{orderCode}") - public RestApiResponse checkChargeOrders(@PathVariable String orderCode) { - logger.info("{}-检查充电订单 params:{}", platformName, JSON.toJSONString(orderCode)); - RestApiResponse response = null; - try { - String result = platformLogic.checkChargeOrders(orderCode); - response = new RestApiResponse<>(result); - }catch (BusinessException e) { - logger.error("{}-检查充电订单 error", platformName, e); - response = new RestApiResponse<>(e.getCode(), e.getMessage()); - }catch (Exception e) { - logger.error("{}-检查充电订单 error", platformName, e); - response = new RestApiResponse<>(e); - } - logger.info("{}-检查充电订单 result:{}", platformName, response); - return response; - } - } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java index c419cb232..f2cd0280c 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/ThirdPartyPlatformService.java @@ -445,9 +445,6 @@ public interface ThirdPartyPlatformService extends InitializingBean { throw new UnsupportedOperationException("This method is not yet implemented"); } - default String checkChargeOrders(String orderCode) { - throw new UnsupportedOperationException("This method is not yet implemented"); - } // -------------------------------------- 以下是公用方法 --------------------------------------- // /** diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/weiWangKuaiDianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/weiWangKuaiDianPlatformServiceImpl.java index 3db654059..bb9700165 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/weiWangKuaiDianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/weiWangKuaiDianPlatformServiceImpl.java @@ -156,7 +156,6 @@ public class weiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer } - // TODO 扩展接口,字段扩展 /** * 查询站点信息 * @param dto 查询站点信息dto @@ -527,7 +526,6 @@ public class weiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer } - //TODO 扩展字段 /** * 请求启动充电 query_start_charge * @param dto 请求启动充电DTO @@ -867,83 +865,6 @@ public class weiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer } - /** - * 推送订单对账结果信息 - * - * @param orderCode - * @return - */ - @Override - public String checkChargeOrders(String orderCode) { - - List list = new ArrayList<>(); - // 根据订单号查询订单信息 - OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); - OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); - if (orderInfo == null || orderDetail == null) { - return null; - } - - // 通过站点id查询相关配置信息 - // 通过三方平台类型查询相关配置信息 - ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); - relation.setThirdPartyType(orderInfo.getThirdPartyType()); - ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation); - // ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId())); - if (relationInfo == null) { - return null; - } - String operatorId = relationInfo.getOperatorId(); - String operatorSecret = relationInfo.getOperatorSecret(); - String signSecret = relationInfo.getSignSecret(); - String dataSecret = relationInfo.getDataSecret(); - String dataSecretIv = relationInfo.getDataSecretIv(); - String urlAddress = relationInfo.getUrlAddress(); - - String url = urlAddress + BusinessInformationExchangeEnum.CHECK_CHARGE_ORDERS.getValue(); - - JSONObject json = new JSONObject(); - json.put("CheckOrderSeq", orderCode); - json.put("StartTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime())); - json.put("EndTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeEndTime())); - json.put("TotalDisputeOrder", 1); - json.put("TotalDisputePower", orderDetail.getTotalUsedElectricity()); - json.put("TotalDisputeMoney", orderDetail.getTotalOrderAmount()); - - ChargeOrder chargeOrder = ChargeOrder.builder() - .startChargeSeq(orderCode) - .totalPower(orderDetail.getTotalUsedElectricity()) - .totalMoney(orderDetail.getTotalOrderAmount()) - .build(); - list.add(chargeOrder); - json.put("DisputeOrders", list); - - // 获取令牌 - String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); - if (StringUtils.isBlank(token)) { - return null; - } - String jsonString = JSON.toJSONString(json); - log.info("请求参数:{}", jsonString); - // 发送请求 - String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); - - return result; - } - - - //<---------------------------扩展接口--------------------------> - //TODO 站点变更通知 notification_station_change - - //TODO 二维码查询枪号 query_terminal_code - - //TODO 推送充电车牌号 notification_charge_carnum - - //TODO 超时占位费推送 notification_overtime_order_info - - //TODO 账单拉取 query_charge_order_info - - /** * 获取微网快电配置密钥信息 * @@ -970,36 +891,16 @@ public class weiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer List resultList = new ArrayList<>(); // 通过站点id查询桩基本信息 List list = pileBasicInfoService.getPileListByStationId(String.valueOf(pileStationInfo.getId())); - // MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId())); - // 封装成联联平台对象 + // 封装成中电联平台对象 for (PileBasicInfo pileBasicInfo : list) { EquipmentInfo equipmentInfo = new EquipmentInfo(); String pileSn = pileBasicInfo.getSn(); equipmentInfo.setEquipmentID(pileSn); - equipmentInfo.setManufacturerID(Constants.OPERATORID_LIANLIAN); - equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime())); PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); - equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType())); - - // Map pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn())); - Map pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn)); - String pileStatus = pileStatusMap.get(pileSn); - if (StringUtils.equals(PileStatusEnum.ON_LINE.getValue(), pileStatus)) { - // 1-在线 - pileStatus = LianLianPileStatusEnum.NORMAL.getCode(); - } else if (StringUtils.equals(PileStatusEnum.OFF_LINE.getValue(), pileStatus)) { - // 2-离线 - pileStatus = LianLianPileStatusEnum.CLOSE_OFFLINE.getCode(); - } else if (StringUtils.equals(PileStatusEnum.FAULT.getValue(), pileStatus)) { - // 3-故障 - pileStatus = LianLianPileStatusEnum.UNDER_MAINTENANCE.getCode(); - } - equipmentInfo.setEquipmentStatus(Integer.valueOf(pileStatus)); - equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); - equipmentInfo.setNewNationalStandard(1); - equipmentInfo.setVinFlag(1); + equipmentInfo.setEquipmentType(Integer.parseInt(modelInfo.getSpeedType())); + equipmentInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); List connectorList = getConnectorList(pileBasicInfo); equipmentInfo.setConnectorInfos(connectorList); @@ -1035,16 +936,16 @@ public class weiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer } connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); - connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); - if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) { - // 如果不是单枪,则枪口功率需要除以枪口数量 - String ratedPowerStr = modelInfo.getRatedPower(); - BigDecimal ratedPower = new BigDecimal(ratedPowerStr); - connectorInfo.setPower(ratedPower.divide(new BigDecimal(modelInfo.getConnectorNum()), 1, BigDecimal.ROUND_HALF_UP)); - }else { - connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); - } + connectorInfo.setNationalStandard(2); + // if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) { + // // 如果不是单枪,则枪口功率需要除以枪口数量 + // String ratedPowerStr = modelInfo.getRatedPower(); + // BigDecimal ratedPower = new BigDecimal(ratedPowerStr); + // connectorInfo.setPower(ratedPower.divide(new BigDecimal(modelInfo.getConnectorNum()), 1, BigDecimal.ROUND_HALF_UP)); + // }else { + // } + connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); resultList.add(connectorInfo); }