| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | |
| | | payOrderInfoDto.setPayTime(byId.getCreateTime()); |
| | | payOrderInfoDto.setRefundAmount(byId.getRefundAmount()); |
| | | payOrderInfoDto.setRechargeAmount(byId.getRechargeAmount()); |
| | | payOrderInfoDto.setFinalAmount(byId.getRechargeAmount().subtract(byId.getRefundAmount())); |
| | | return R.ok(payOrderInfoDto); |
| | | case 2: |
| | | TShoppingOrder byId1 = shoppingOrderService.getById(orderId); |
| | |
| | | payOrderInfoDto1.setPayTime(byId1.getCreateTime()); |
| | | payOrderInfoDto1.setRefundAmount(byId1.getRefundAmount()); |
| | | payOrderInfoDto1.setRechargeAmount(byId1.getPaymentAmount()); |
| | | payOrderInfoDto1.setFinalAmount(byId1.getPaymentAmount().subtract(byId1.getRefundAmount())); |
| | | return R.ok(payOrderInfoDto1); |
| | | case 3: |
| | | TVipOrder byId2 = vipOrderService.getById(orderId); |
| | |
| | | payOrderInfoDto2.setPayTime(byId2.getCreateTime()); |
| | | payOrderInfoDto2.setRefundAmount(byId2.getRefundAmount()); |
| | | payOrderInfoDto2.setRechargeAmount(byId2.getPaymentAmount()); |
| | | payOrderInfoDto2.setFinalAmount(byId2.getPaymentAmount().subtract(byId2.getRefundAmount())); |
| | | return R.ok(payOrderInfoDto2); |
| | | //todo luo 停车场订单 |
| | | // case 4: |
| | | // TParkingRecord byId3 = parkingLotClient.getRecordById(orderId).getData(); |
| | | // PayOrderInfoDto payOrderInfoDto3 = new PayOrderInfoDto(); |
| | | // payOrderInfoDto3.setOrderId(byId3.getId().toString()); |
| | | // payOrderInfoDto3.setCode(byId3.getCode()); |
| | | // payOrderInfoDto3.setTradeNo(byId3); |
| | | // payOrderInfoDto3.setPayType(0); |
| | | // payOrderInfoDto3.setPayAmount(new BigDecimal("0")); |
| | | // payOrderInfoDto3.setPayTime(LocalDateTime.now()); |
| | | // payOrderInfoDto3.setRefundAmount(new BigDecimal("0")); |
| | | |
| | | case 4: |
| | | R<TParkingRecord> recordById = parkingLotClient.getRecordById(orderId); |
| | | TParkingRecord byId3 =recordById.getData(); |
| | | PayOrderInfoDto payOrderInfoDto3 = new PayOrderInfoDto(); |
| | | payOrderInfoDto3.setOrderId(byId3.getId().toString()); |
| | | payOrderInfoDto3.setCode(byId3.getCode()); |
| | | payOrderInfoDto3.setPayTime(byId3.getCreateTime()); |
| | | payOrderInfoDto3.setRechargeAmount(byId3.getPayment()); |
| | | return R.ok(payOrderInfoDto3); |
| | | |
| | | |
| | | |
| | |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setVipDiscount(multiply); |
| | | } |
| | | bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | |
| | | if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/securityDetection") |
| | | public void securityDetection(@RequestBody SecurityDetectionVO securityDetection){ |
| | | log.error("-------------------安全检测数据-------------------:" + securityDetection); |
| | | log.info("-------------------安全检测数据-------------------:" + securityDetection); |
| | | chargingOrderService.securityDetection(securityDetection); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/startChargeSuccessfully") |
| | | public void startChargeSuccessfully(@RequestBody PlatformStartChargingReplyMessageVO message){ |
| | | log.error("-------------------远程启动充电请求应答-------------------:" + message); |
| | | log.info("-------------------远程启动充电请求应答-------------------:" + message); |
| | | chargingOrderService.startChargeSuccessfully(message); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/terminateSuccessfulResponse") |
| | | public void terminateSuccessfulResponse(@RequestBody PlatformStopChargingReplyVO platformStopChargingReply){ |
| | | log.error("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply); |
| | | log.info("-------------------远程停止充电请求应答-------------------:" + platformStopChargingReply); |
| | | chargingOrderService.terminateSuccessfulResponse(platformStopChargingReply); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/endChargeBillingCharge") |
| | | public void endChargeBillingCharge(@RequestBody TransactionRecordMessageVO vo){ |
| | | log.error("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); |
| | | log.info("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); |
| | | chargingOrderService.endChargeBillingCharge(vo); |
| | | } |
| | | |
| | |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | |
| | | |
| | | List<Map<String,Object>> maps1 = chargingOrderService.queryPower(siteIds); |
| | | |
| | | |
| | |
| | | brands.add(objectMap.get("vehicle_brand").toString()); |
| | | } |
| | | |
| | | Long count = chargingOrderService.countCar(brands); |
| | | Map<String, Object> others = new HashMap<>(); |
| | | others.put("vehicle_brand","其他"); |
| | | others.put("counts",count); |
| | | carBrandMap.add(others); |
| | | if (carBrandMap.size()>=5) { |
| | | Long count = chargingOrderService.countCar(brands); |
| | | Map<String, Object> others = new HashMap<>(); |
| | | others.put("vehicle_brand", "其他"); |
| | | others.put("counts", count); |
| | | carBrandMap.add(others); |
| | | } |
| | | //本地车数量 |
| | | Map<String,Object> localCarMap = chargingOrderService.countLocalCar(); |
| | | |
| | |
| | | List<Map<String,Object>> badTop = orderEvaluateService.badTop(siteIds); |
| | | |
| | | //流量分析 |
| | | List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds); |
| | | List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds,statisticsQueryDto); |
| | | tCharingUserEvaluateVO.setGoodTop(goodTop); |
| | | tCharingUserEvaluateVO.setBadTop(badTop); |
| | | tCharingUserEvaluateVO.setFlow(sourceMap); |
| | |
| | | } |
| | | //直流可用率 |
| | | List<Map<String,Object>> equipmentMap1 = chargingOrderService.equipmentUserType1(siteIds,statisticsQueryDto); |
| | | for (Map<String, Object> result : equipmentMap1) { |
| | | Object percentObj = result.get("percent"); |
| | | if (percentObj instanceof String) { |
| | | try { |
| | | BigDecimal percent = new BigDecimal((String) percentObj); |
| | | if (percent.compareTo(BigDecimal.ZERO) < 0) { |
| | | result.put("percent", percent.negate().toString()); |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | // 处理转换异常 |
| | | result.put("percent", BigDecimal.ZERO); // 或者其他默认值 |
| | | } |
| | | } else if (percentObj instanceof BigDecimal) { |
| | | BigDecimal percent = (BigDecimal) percentObj; |
| | | if (percent.compareTo(BigDecimal.ZERO) < 0) { |
| | | result.put("percent", percent.negate().toString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //交流可用率 |
| | | List<Map<String,Object>> equipmentMap2= chargingOrderService.equipmentUserType2(siteIds,statisticsQueryDto); |
| | | |
| | | for (Map<String, Object> result : equipmentMap2) { |
| | | Object percentObj = result.get("percent"); |
| | | if (percentObj instanceof String) { |
| | | try { |
| | | BigDecimal percent = new BigDecimal((String) percentObj); |
| | | if (percent.compareTo(BigDecimal.ZERO) < 0) { |
| | | result.put("percent", percent.negate().toString()); |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | // 处理转换异常 |
| | | result.put("percent", BigDecimal.ZERO); // 或者其他默认值 |
| | | } |
| | | } else if (percentObj instanceof BigDecimal) { |
| | | BigDecimal percent = (BigDecimal) percentObj; |
| | | if (percent.compareTo(BigDecimal.ZERO) < 0) { |
| | | result.put("percent", percent.negate().toString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //取出直流可用率和交流可用率的percent的平均值保留两位小数 |
| | | |
| | |
| | | |
| | | |
| | | |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds).ge( TChargingOrder::getCreateTime,min).le(BasePojo::getCreateTime,max).eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list(); |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds).ge( TChargingOrder::getCreateTime,min).le(BasePojo::getCreateTime,max).eq(TChargingOrder::getStatus,5).eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list(); |
| | | //当日的订单总数 |
| | | int size = list.size(); |
| | | //计算list中paymentAmount的总和 |
| | |
| | | */ |
| | | @PostMapping("/endCharge") |
| | | public void endCharge(@RequestParam("code") String code){ |
| | | log.error(code + ":-------------------充电桩自动结束充电-------------------"); |
| | | log.info(code + ":-------------------充电桩自动结束充电-------------------"); |
| | | chargingOrderService.endCharge(code, 2); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/excelEndCharge") |
| | | public void excelEndCharge(@RequestParam("code") String code){ |
| | | log.error(code + ":-------------------充电异常,停止充电-------------------"); |
| | | log.info(code + ":-------------------充电异常,停止充电-------------------"); |
| | | chargingOrderService.excelEndCharge(code); |
| | | } |
| | | |
| | |
| | | List<TChargingOrder> chargingOrder = chargingOrderService.getChargingOrder(order); |
| | | return R.ok(chargingOrder); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车辆id获取指定时间范围内的数据 |
| | | * @param carId |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | @PostMapping("/getCarChargingOrder") |
| | | public R<List<TChargingOrder>> getCarChargingOrder(@RequestParam("carId") Long carId, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){ |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserCarId, carId).eq(TChargingOrder::getDelFlag, 0) |
| | | .in(TChargingOrder::getStatus, Arrays.asList(4, 5)).between(TChargingOrder::getStartTime, startTime, endTime)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | } |