xuhy
2024-08-29 e0207d7029b4e90ea1e4efeab5c3c5591f0e59c3
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingPileController.java
@@ -2,9 +2,14 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.query.TChargingGunQuery;
import com.ruoyi.chargingPile.api.vo.TChargingGunVO;
import com.ruoyi.chargingPile.dto.ChargeMonitoring;
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.common.core.domain.R;
@@ -17,6 +22,9 @@
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.chargingPile.api.query.PageChargingPileList;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.log.enums.OperatorType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -44,20 +52,38 @@
public class TChargingPileController {
    private final TChargingPileService chargingPileService;
    private final TChargingGunService chargingGunService;
    @Autowired
    public TChargingPileController(TChargingPileService chargingPileService) {
    public TChargingPileController(TChargingPileService chargingPileService, TChargingGunService chargingGunService) {
        this.chargingPileService = chargingPileService;
        this.chargingGunService = chargingGunService;
    }
    /**
     * 查询充电桩列表
     */
    @ApiOperation(tags = {"小程序-充电桩"},value = "查询充电桩列表")
    @PostMapping(value = "/list")
    public AjaxResult<List<TChargingPile>> list(@RequestParam(name = "siteId",value = "站点id",required = false)Integer siteId) {
    @ApiOperation(tags = {"小程序-充电桩"},value = "通过站点id查询充电桩列表")
    @GetMapping(value = "/list")
    @ApiImplicitParams({
          @ApiImplicitParam(name = "siteId", value = "站点id")
    })
    public AjaxResult<List<TChargingPile>> list(@RequestParam("siteId") Integer siteId) {
        return AjaxResult.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class)
                .eq(TChargingPile::getSiteId,siteId)));
    }
   /**
     * 查询充电桩列表
     */
    @ApiOperation(tags = {"通过充电桩id 查询充电枪列表"},value = "通过充电桩id 查询充电枪列表")
    @PostMapping(value = "/pileList")
    @ApiImplicitParams({
          @ApiImplicitParam(name = "pileId", value = "充电桩id")
    })
    public AjaxResult<List<TChargingGun>> pileList(@RequestParam("pileId") Integer pileId) {
        return AjaxResult.ok(chargingGunService.list(Wrappers.lambdaQuery(TChargingGun.class)
                .eq(TChargingGun::getChargingPileId,pileId)));
    }
   /**
     * 管理后台-通过站点id获取充电桩列表 不分页
@@ -70,16 +96,16 @@
    }
   
   
   @ResponseBody
   @GetMapping("/pageChargingPileList")
   @ApiOperation(value = "获取充电桩列表数据", tags = {"管理后台-充电桩信息"})
   public AjaxResult<PageInfo<PageChargingPileListDTO>> pageChargingPileList(@RequestBody PageChargingPileList page){
   public AjaxResult<PageInfo<PageChargingPileListDTO>> pageChargingPileList(PageChargingPileList page){
      PageInfo<PageChargingPileListDTO> list = chargingPileService.pageChargingPileList(page);
      return AjaxResult.success(list);
   }
   
   @ResponseBody
   @Log(title = "添加充电桩数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
   @PostMapping("/addChargingPile")
   @ApiOperation(value = "添加充电桩数据", tags = {"管理后台-充电桩信息"})
   public AjaxResult addChargingPile(@RequestBody TChargingPile chargingPile){
@@ -97,6 +123,7 @@
   
   
   @ResponseBody
   @Log(title = "编辑充电桩数据", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
   @PostMapping("/editChargingPile")
   @ApiOperation(value = "编辑充电桩数据", tags = {"管理后台-充电桩信息"})
   public AjaxResult editChargingPile(@RequestBody TChargingPile chargingPile){
@@ -106,17 +133,19 @@
   
   
   @ResponseBody
   @DeleteMapping("/delChargingPile/{id}")
   @DeleteMapping("/delChargingPile")
   @Log(title = "删除充电桩", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
   @ApiOperation(value = "删除充电桩", tags = {"管理后台-充电桩信息"})
   @ApiImplicitParams({
         @ApiImplicitParam(value = "充电桩id", name = "id", dataTypeClass = Integer.class, required = true)
   })
   public AjaxResult delChargingPile(@PathVariable Integer id){
   public AjaxResult delChargingPile(@RequestParam("id") Integer[] id){
      return chargingPileService.delChargingPile(id);
   }
   
   
   @ResponseBody
   @Log(title = "批量设置计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
   @PostMapping("/batchSetAccountingStrategy")
   @ApiOperation(value = "批量设置计费策略", tags = {"管理后台-充电桩信息"})
   public AjaxResult batchSetAccountingStrategy(@RequestBody BatchSetAccountingStrategy setAccountingStrategy){
@@ -125,7 +154,42 @@
   }
   
   
   @ResponseBody
   @GetMapping("/chargeMonitoring/{siteId}")
   @ApiOperation(value = "获取充电设施监控数据", tags = {"管理后台-充电设备监控"})
   public AjaxResult<ChargeMonitoring> chargeMonitoring(@PathVariable Integer siteId){
      ChargeMonitoring chargeMonitoring = chargingPileService.chargeMonitoring(siteId);
      return AjaxResult.success(chargeMonitoring);
   }
   @ResponseBody
   @GetMapping("/getChargingGunCountMonitoring/{siteId}")
   @ApiOperation(value = "获取充电枪各种状态汇总监控数据", tags = {"管理后台-充电设备监控"})
   public AjaxResult<ChargingGunCountMonitoring> getChargingGunCountMonitoring(@PathVariable Integer siteId){
      ChargingGunCountMonitoring chargingGunCountMonitoring = chargingPileService.getChargingGunCountMonitoring(siteId);
      return AjaxResult.success(chargingGunCountMonitoring);
   }
   
   
   @ResponseBody
   @GetMapping("/getChargingGunMonitoring")
   @ApiOperation(value = "获取充电枪监控数据", tags = {"管理后台-充电设备监控"})
   public AjaxResult<PageInfo<ChargingGunMonitoring>> getChargingGunMonitoring(GetChargingGunMonitoring query){
      PageInfo<ChargingGunMonitoring> chargingGunMonitoring = chargingPileService.getChargingGunMonitoring(query);
      return AjaxResult.success(chargingGunMonitoring);
   }
   /**
    * 根据id获取充电桩信息
    * @param id
    * @return
    */
   @ResponseBody
   @PostMapping("/getChargingPileById/{id}")
   public R<TChargingPile> getChargingPileById(@PathVariable Integer id){
      TChargingPile chargingPile = chargingPileService.getById(id);
      return R.ok(chargingPile);
   }
}