| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | /** |
| | | * 分页查询车队 |
| | | */ |
| | | @RequiresPermissions(value = {"/fleet/list"}, logical = Logical.OR) |
| | | @RequiresPermissions(value = {"/fleet/list", "/vinManagement/list", "/chargingCard/list"}, logical = Logical.OR) |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "分页查询车队", tags = {"管理后台-车队管理"}) |
| | | public AjaxResult<PageInfo<TFleet>> page(@RequestParam(value = "current", defaultValue = "1") Integer current, |
| | |
| | | records.forEach(item -> item.setCompanyName(nameMap.get(item.getCompanyId()))); |
| | | } |
| | | |
| | | /** |
| | | * 远程接口:车队详情(VIN码车辆所属车队校验使用,内部调用) |
| | | */ |
| | | @PostMapping("/remote/get/{id}") |
| | | @ApiOperation(value = "远程-车队详情", tags = {"内部调用"}) |
| | | public R<TFleet> remoteGet(@PathVariable("id") Integer id) { |
| | | if (id == null) { |
| | | return R.fail("车队ID不能为空"); |
| | | } |
| | | return R.ok(fleetService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 远程接口:按ID批量查询车队(VIN列表回填车队名称使用,内部调用) |
| | | */ |
| | | @PostMapping("/remote/list-by-ids") |
| | | @ApiOperation(value = "远程-按ID批量查询车队", tags = {"内部调用"}) |
| | | public R<List<TFleet>> remoteListByIds(@RequestBody List<Integer> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | List<Integer> distinct = ids.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList()); |
| | | if (distinct.isEmpty()) { |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | return R.ok(fleetService.listByIds(distinct)); |
| | | } |
| | | |
| | | } |