| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.chargingPile.service.TRepairService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | 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.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private TRepairService repairService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | /** |
| | | * 添加故障报修管理 |
| | | */ |
| | | @Log(title = "添加故障报修管理", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-故障报修"},value = "添加故障报修管理") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<String> add(@Validated @RequestBody TRepair dto) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 查询报修人员信息 |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | if(Objects.nonNull(user)){ |
| | | dto.setRepairman(user.getName()); |
| | | } |
| | | repairService.add(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/repairRecord"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getRepairList") |
| | | @ApiOperation(value = "获取报修记录列表数据", tags = {"管理后台-设备监控"}) |
| | | public AjaxResult<PageInfo<TRepair>> getRepairList(String name, String siteId, BasePage basePage){ |
| | | public AjaxResult<PageInfo<TRepair>> getRepairList(String name, Integer siteId, BasePage basePage){ |
| | | PageInfo<TRepair> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<TRepair> repairList = repairService.getRepairList(pageInfo, name, siteId); |
| | | return AjaxResult.success(repairList); |
| | | pageInfo.setRecords(repairList); |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/repairRecord/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/addRepair") |
| | | @ApiOperation(value = "添加报修记录", tags = {"管理后台-设备监控"}) |
| | | @Log(title = "【设备监控】添加报修记录", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | public AjaxResult addRepair(@RequestBody TRepair repair){ |
| | | repairService.save(repair); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/repairRecord/del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delRepair/{id}") |
| | | @ApiOperation(value = "删除报修记录", tags = {"管理后台-设备监控"}) |
| | | @Log(title = "【设备监控】删除报修记录", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | public AjaxResult delRepair(@PathVariable Integer id){ |
| | | repairService.removeById(id); |
| | | return AjaxResult.success(); |