luodangjia
2024-09-12 c5462d60b99823adb10d9e9eda671920118538f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
package com.ruoyi.chargingPile.controller;
 
 
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;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy;
import com.ruoyi.chargingPile.service.TChargingPileService;
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;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * <p>
 * 充电桩 前端控制器
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-06
 */
@Api(tags = "充电桩")
@RestController
@RequestMapping("/t-charging-pile")
public class TChargingPileController {
 
    private final TChargingPileService chargingPileService;
    private final TChargingGunService chargingGunService;
 
 
    @Autowired
    public TChargingPileController(TChargingPileService chargingPileService, TChargingGunService chargingGunService) {
        this.chargingPileService = chargingPileService;
        this.chargingGunService = chargingGunService;
    }
 
    /**
     * 查询充电桩列表
     */
    @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获取充电桩列表 不分页
     */
    @ApiOperation(value = "管理后台-通过站点id获取充电桩列表 不分页")
    @PostMapping(value = "/getChargingPileBySiteId")
    public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId) {
        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")
    @ApiOperation(value = "获取充电桩列表数据", tags = {"管理后台-充电桩信息"})
    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){
        return chargingPileService.addChargingPile(chargingPile);
    }
    
    
    @ResponseBody
    @GetMapping("/getChargingPile/{id}")
    @ApiOperation(value = "获取充电桩详情数据", tags = {"管理后台-充电桩信息"})
    public AjaxResult<TChargingPile> getChargingPile(@PathVariable Integer id){
        TChargingPile chargingPile = chargingPileService.getChargingPile(id);
        return AjaxResult.success(chargingPile);
    }
    
    
    @ResponseBody
    @Log(title = "编辑充电桩数据", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
    @PostMapping("/editChargingPile")
    @ApiOperation(value = "编辑充电桩数据", tags = {"管理后台-充电桩信息"})
    public AjaxResult editChargingPile(@RequestBody TChargingPile chargingPile){
        return chargingPileService.editChargingPile(chargingPile);
    }
    
    
    
    @ResponseBody
    @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(@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){
        chargingPileService.batchSetAccountingStrategy(setAccountingStrategy);
        return AjaxResult.success();
    }
    
    
    @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);
    }
}