| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | @ResponseBody |
| | | @PostMapping("/addFaultMessage") |
| | | @ApiOperation(value = "添加故障信息", tags = {"管理后台-设备监控"}) |
| | | @Log(title = "【设备监控】添加故障信息", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | public AjaxResult addFaultMessage(@RequestBody TFaultMessage faultMessage){ |
| | | faultMessageService.save(faultMessage); |
| | | return AjaxResult.success(); |
| | |
| | | @ResponseBody |
| | | @DeleteMapping("/delFaultMessage/{id}") |
| | | @ApiOperation(value = "删除故障信息", tags = {"管理后台-设备监控"}) |
| | | @Log(title = "【设备监控】删除故障信息", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | public AjaxResult delFaultMessage(@PathVariable Integer id){ |
| | | faultMessageService.removeById(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 添加离线故障记录 |
| | | * @param faultMessage |
| | | * @return |
| | | */ |
| | | @PostMapping("/createFaultMessage") |
| | | public R<String> createFaultMessage(@RequestBody TFaultMessage faultMessage){ |
| | | faultMessageService.save(faultMessage); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 修改离线故障记录 |
| | | * @param faultMessage |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateFaultMessage") |
| | | public R<String> updateFaultMessage(@RequestBody TFaultMessage faultMessage){ |
| | | faultMessageService.updateById(faultMessage); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 查询枪是否有离线或故障记录 |
| | | * @param gunId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-fault-message/getFaultMessageByGunId/{gunId}") |
| | | public R<TFaultMessage> getFaultMessageByGunId(@PathVariable("gunId") Integer gunId){ |
| | | return R.ok(faultMessageService.getOne(Wrappers.lambdaQuery(TFaultMessage.class) |
| | | .eq(TFaultMessage::getChargingGunId,gunId) |
| | | .and(e->e.eq(TFaultMessage::getStatus,1).or().eq(TFaultMessage::getStatus,2)) |
| | | .isNull(TFaultMessage::getEndTime) |
| | | .orderByDesc(TFaultMessage::getDownTime) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | } |
| | | |