puzhibing
2024-10-24 e04c38cdd62af6e17d7ae45b7374ef4ec46a90f1
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TRepairController.java
@@ -7,11 +7,20 @@
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.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>
@@ -27,7 +36,27 @@
   @Resource
   private TRepairService repairService;
   @Resource
   private TokenService tokenService;
   @Autowired
   private SysUserClient userClient;
   /**
    * 添加故障报修管理
    */
   @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();
      // 查询报修人员信息
      SysUser user = userClient.getSysUser(userId).getData();
      if(Objects.nonNull(user)){
         dto.setRepairman(user.getUserName());
      }
      repairService.add(dto);
      return AjaxResult.success();
   }
   
   @ResponseBody
   @GetMapping("/getRepairList")
@@ -35,7 +64,8 @@
   public AjaxResult<PageInfo<TRepair>> getRepairList(String name, String 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);
   }
   
   
@@ -44,6 +74,7 @@
   @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();
@@ -53,6 +84,7 @@
   @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();