From b58c937b5ec096b3d92e1100ce3e6c3edf5705fe Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期四, 31 十月 2024 15:27:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java |   53 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
index e4839d9..cc70d8a 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -387,7 +387,7 @@
 		TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, addChargingOrder.getId())
 				.in(TChargingOrder::getStatus, Arrays.asList(1, 2, 3)).eq(TChargingOrder::getDelFlag, 0));
 		if(null != one){
-			return AjaxResult.error("充电枪正在充电桩中,启动失败");
+			return AjaxResult.error("充电枪正在充电中,启动失败");
 		}
 		//查询当前充电枪是否有正在支付的订单
 		one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, addChargingOrder.getId())
@@ -447,6 +447,7 @@
 		chargingOrder.setVipDiscountAmount(BigDecimal.ZERO);
 		chargingOrder.setOrderSource(0);
 		chargingOrder.setTitle("【充电桩充电】" + chargingPile.getNumber() + "号桩/" + tChargingGun.getCode() + "号枪");
+		chargingOrder.setStatus(1);
 		
 		Site site = siteClient.getSiteByIds(Arrays.asList(tChargingGun.getSiteId())).getData().get(0);
 		Integer accountingStrategyId = tChargingGun.getAccountingStrategyId();
@@ -686,9 +687,6 @@
 		String key = "AQJC_" + chargingOrder.getChargingGunId();
 		List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData();
 		log.error(code + ":-------------------开始检查调起充电结果-------------------" + data.toString());
-		if(null == data || data.size() == 0){
-			return false;
-		}
 		if(data.size() != 0){
 			PlatformStartChargingReply platformStartChargingReply = data.get(1);
 			Integer startup_result = platformStartChargingReply.getStartup_result();
@@ -737,7 +735,7 @@
 				counter = (null == counter ? 0 : counter) + 1;
 				boot_failed_map.put(code, counter);
 				//启动失败
-				preChargeCheck1.setStartupSuccess(3);
+				preChargeCheck1.setStartupSuccess(1);
 				preChargeCheck1.setFailureCause(0);
 				redisService.setCacheObject(key, preChargeCheck1, 24L, TimeUnit.HOURS);
 				return false;
@@ -981,16 +979,17 @@
 		chargingOrder.setId(Long.valueOf(id));
 		chargingOrder.setAppUserId(order.getAppUserId());
 		chargingOrder.setEndTime(LocalDateTime.now());
+		chargingOrder.setStatus(4);
 		chargingOrder.setEndMode(1);
 		this.updateById(chargingOrder);
 		
-		String code1 = chargingOrder.getCode();
-		TChargingGun chargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData();
+		String code1 = order.getCode();
+		TChargingGun chargingGun = chargingGunClient.getChargingGunById(order.getChargingGunId()).getData();
 		//异步线程处理停机
 		ExecutorService cachedThreadPool = Executors.newFixedThreadPool(1);
 		cachedThreadPool.execute(()->{
 			//调用硬件停止充电,停止成功后开始计算费用退款
-			TChargingPile chargingPile = chargingPileClient.getChargingPileById(chargingOrder.getChargingPileId()).getData();
+			TChargingPile chargingPile = chargingPileClient.getChargingPileById(order.getChargingPileId()).getData();
 			PlatformStopCharging platformStopCharging = new PlatformStopCharging();
 			platformStopCharging.setCharging_pile_code(chargingPile.getCode());
 			platformStopCharging.setCharging_gun_code(chargingGun.getCode());
@@ -1772,7 +1771,7 @@
 	public void endChargeBillingCharge(TransactionRecordMessageVO vo) {
 		TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, vo.getTransaction_serial_number()));
 		Integer status = chargingOrder.getStatus();
-		if(status == 4 || status == 5){
+		if(status == 5){
 			return;
 		}
 		
@@ -1865,9 +1864,7 @@
 		} catch (ParseException e) {
 			throw new RuntimeException(e);
 		}
-		System.err.println(start.getTime() + "\n" + end.getTime() + "\n" + lists.get(0).getStart() + "\n" + lists.get(0).getEnd());
-		
-		
+
 		for (AccountingStrategyDetailOrderVo strategyDetail : lists) {
 			BigDecimal sharp_peak_charge = strategyDetail.getChargingCapacity();
 			TChargingOrderAccountingStrategy chargingOrderAccountingStrategy = new TChargingOrderAccountingStrategy();
@@ -2110,7 +2107,7 @@
 			chargingOrderRefund.setRefundTitle("充电完成退款");
 			chargingOrderRefund.setRefundContent("充电完成退款");
 			chargingOrderRefund.setRefundReason("充电完成退款");
-			chargingOrderRefund.setRefundRemark("实际充电消费金额:" + refundAmount);
+			chargingOrderRefund.setRefundRemark("实际充电消费金额:" + chargingOrder.getPaymentAmount());
 			chargingOrderRefund.setRefundTotalAmount(refundAmount);
 			chargingOrderRefund.setPayAmount(rechargeAmount);
 			if(1 == rechargePaymentType){
@@ -2455,7 +2452,7 @@
 		}
 		TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserCarId, appUserCar.getId())
 				.eq(TChargingOrder::getDelFlag, 0).gt(TChargingOrder::getStartTime, query.getStartTime())
-				.eq(TChargingOrder::getRechargePaymentStatus, 2).ne(TChargingOrder::getStatus, -1));
+				.eq(TChargingOrder::getRechargePaymentStatus, 2).ne(TChargingOrder::getStatus, 5));
 		return one;
 	}
 
@@ -2971,4 +2968,32 @@
 	public Long countNoTag() {
 		return this.baseMapper.countNoTag();
 	}
+	
+	
+	@Override
+	public List<TChargingOrder> getChargingOrder(TChargingOrderVo order) {
+		LambdaQueryWrapper<TChargingOrder> queryWrapper = new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getDelFlag, 0);
+		if(null != order.getChargingPileId()){
+			queryWrapper.eq(TChargingOrder::getChargingPileId, order.getChargingPileId());
+		}
+		if(null != order.getChargingGunId()){
+			queryWrapper.eq(TChargingOrder::getChargingGunId, order.getChargingGunId());
+		}
+		if(null != order.getStatus()){
+			queryWrapper.eq(TChargingOrder::getStatus, order.getStatus());
+		}
+		if(null != order.getAppUserId()){
+			queryWrapper.eq(TChargingOrder::getAppUserId, order.getAppUserId());
+		}
+		if(null != order.getAppUserId()){
+			queryWrapper.eq(TChargingOrder::getAppUserId, order.getAppUserId());
+		}
+		if(null != order.getStatusList()){
+			queryWrapper.in(TChargingOrder::getAppUserId, order.getStatusList());
+		}
+		if(null != order.getEndMode()){
+			queryWrapper.eq(TChargingOrder::getEndMode, order.getEndMode());
+		}
+		return this.list(queryWrapper.orderByDesc(TChargingOrder::getCreateTime));
+	}
 }

--
Gitblit v1.7.1