From b4b44f2021dbf083b7057fb7e192b72d08b4bf17 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 22 十月 2024 09:23:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java |   48 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
index b5de0af..5654d26 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
@@ -1,6 +1,7 @@
 package com.ruoyi.chargingPile.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.chargingPile.api.model.TChargingGun;
 import com.ruoyi.chargingPile.api.model.TChargingPile;
@@ -10,8 +11,7 @@
 import com.ruoyi.chargingPile.dto.ChargingGunCountMonitoring;
 import com.ruoyi.chargingPile.dto.ChargingGunMonitoring;
 import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring;
-import com.ruoyi.chargingPile.service.TChargingGunService;
-import com.ruoyi.chargingPile.service.TChargingPileService;
+import com.ruoyi.chargingPile.service.*;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.PageInfo;
@@ -25,6 +25,8 @@
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.log.enums.OperatorType;
+import com.ruoyi.common.redis.service.RedisService;
+import com.ruoyi.other.api.domain.TVip;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -36,7 +38,10 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -53,6 +58,9 @@
 
     private final TChargingPileService chargingPileService;
     private final TChargingGunService chargingGunService;
+	
+	@Resource
+	private RedisService redisService;
 
 
     @Autowired
@@ -94,7 +102,12 @@
         return R.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class)
                 .eq(TChargingPile::getSiteId,siteId)));
     }
-	
+
+	@PostMapping(value = "/getChargingPileBySiteIds")
+	public R<List<TChargingPile>> getChargingPileBySiteIds(@RequestParam("siteIds") List<Integer> siteIds) {
+		return R.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class)
+				.in(!siteIds.isEmpty(),TChargingPile::getSiteId,siteIds)));
+	}
 	
 	@ResponseBody
 	@GetMapping("/pageChargingPileList")
@@ -105,7 +118,7 @@
 	}
 	
 	@ResponseBody
-	@Log(title = "添加充电桩数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
+	@Log(title = "【充电桩信息】添加充电桩数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
 	@PostMapping("/addChargingPile")
 	@ApiOperation(value = "添加充电桩数据", tags = {"管理后台-充电桩信息"})
 	public AjaxResult addChargingPile(@RequestBody TChargingPile chargingPile){
@@ -123,7 +136,7 @@
 	
 	
 	@ResponseBody
-	@Log(title = "编辑充电桩数据", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
+	@Log(title = "【充电桩信息】编辑充电桩数据", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
 	@PostMapping("/editChargingPile")
 	@ApiOperation(value = "编辑充电桩数据", tags = {"管理后台-充电桩信息"})
 	public AjaxResult editChargingPile(@RequestBody TChargingPile chargingPile){
@@ -134,7 +147,7 @@
 	
 	@ResponseBody
 	@DeleteMapping("/delChargingPile")
-	@Log(title = "删除充电桩", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
+	@Log(title = "【充电桩信息】删除充电桩", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
 	@ApiOperation(value = "删除充电桩", tags = {"管理后台-充电桩信息"})
 	@ApiImplicitParams({
 			@ApiImplicitParam(value = "充电桩id", name = "id", dataTypeClass = Integer.class, required = true)
@@ -145,7 +158,7 @@
 	
 	
 	@ResponseBody
-	@Log(title = "批量设置计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
+	@Log(title = "【充电桩信息】批量设置计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
 	@PostMapping("/batchSetAccountingStrategy")
 	@ApiOperation(value = "批量设置计费策略", tags = {"管理后台-充电桩信息"})
 	public AjaxResult batchSetAccountingStrategy(@RequestBody BatchSetAccountingStrategy setAccountingStrategy){
@@ -161,7 +174,8 @@
 		ChargeMonitoring chargeMonitoring = chargingPileService.chargeMonitoring(siteId);
 		return AjaxResult.success(chargeMonitoring);
 	}
-	
+
+
 	@ResponseBody
 	@GetMapping("/getChargingGunCountMonitoring/{siteId}")
 	@ApiOperation(value = "获取充电枪各种状态汇总监控数据", tags = {"管理后台-充电设备监控"})
@@ -191,5 +205,23 @@
 		TChargingPile chargingPile = chargingPileService.getById(id);
 		return R.ok(chargingPile);
 	}
+	
+	
+	/**
+	 * 更新充电桩状态
+	 * @param code
+	 * @param status
+	 */
+	@ResponseBody
+	@PostMapping("/updateChargingPileStatus")
+	public void updateChargingPileStatus(@RequestParam("code") String code, @RequestParam("status") Integer status){
+		TChargingPile chargingPile = chargingPileService.getOne(new LambdaQueryWrapper<TChargingPile>()
+				.eq(TChargingPile::getCode, code).eq(TChargingPile::getDelFlag, 0));
+		if(null != chargingPile){
+			chargingPile.setStatus(0 == status ? 1 : 3);
+			chargingPileService.updateById(chargingPile);
+			redisService.getCacheMap("charging_pile_online").put(code, System.currentTimeMillis());
+		}
+	}
 }
 

--
Gitblit v1.7.1