|  |  | 
 |  |  | import com.vincent.rsf.server.common.domain.KeyValVo; | 
 |  |  | import com.vincent.rsf.server.common.domain.PageParam; | 
 |  |  | import com.vincent.rsf.server.common.utils.ExcelUtil; | 
 |  |  | import com.vincent.rsf.server.manager.controller.params.LocMastInitParam; | 
 |  |  | import com.vincent.rsf.server.manager.controller.params.LocModifyParams; | 
 |  |  | import com.vincent.rsf.server.manager.entity.Loc; | 
 |  |  | import com.vincent.rsf.server.manager.enums.LocStsType; | 
 |  |  | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import javax.servlet.http.HttpServletResponse; | 
 |  |  | import javax.validation.Valid; | 
 |  |  | import java.util.*; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | 
 |  |  |     private LocService locService; | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:list')") | 
 |  |  |     @PostMapping("/loc/preview/page") | 
 |  |  |     @PostMapping("/locPreview/page") | 
 |  |  |     public R page(@RequestBody Map<String, Object> map) { | 
 |  |  |         BaseParam baseParam = buildParam(map, BaseParam.class); | 
 |  |  |         PageParam<Loc, BaseParam> pageParam = new PageParam<>(baseParam, Loc.class); | 
 |  |  | 
 |  |  |         list.add("row"); | 
 |  |  |         list.add("col"); | 
 |  |  |         list.add("lev"); | 
 |  |  |         return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true,list))); | 
 |  |  |         return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true, list))); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:list')") | 
 |  |  |     @PostMapping("/loc/preview/list") | 
 |  |  |     @PostMapping("/locPreview/list") | 
 |  |  |     public R list(@RequestBody Map<String, Object> map) { | 
 |  |  |         return R.ok().add(locService.list()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:list')") | 
 |  |  |     @PostMapping("/loc/preview/areaNoUse/list") | 
 |  |  |     @PostMapping("/locPreview/areaNoUse/list") | 
 |  |  |     public R areaNoUselist(@RequestBody Map<String, Object> map) { | 
 |  |  |         String locCode = map.get("locCode").toString(); | 
 |  |  |         Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, locCode),false); | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:list')") | 
 |  |  |     @PostMapping({"/loc/preview/many/{ids}", "/loc/preview/many/{ids}"}) | 
 |  |  |     @PostMapping({"/locPreview/many/{ids}", "/locPreview/many/{ids}"}) | 
 |  |  |     public R many(@PathVariable Long[] ids) { | 
 |  |  |         return R.ok().add(locService.listByIds(Arrays.asList(ids))); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:list')") | 
 |  |  |     @GetMapping("/loc/preview/{id}") | 
 |  |  |     @GetMapping("/locPreview/{id}") | 
 |  |  |     public R get(@PathVariable("id") Long id) { | 
 |  |  |         return R.ok().add(locService.getById(id)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:save')") | 
 |  |  |     @OperationLog("Create 库位信息表") | 
 |  |  |     @PostMapping("/loc/preview/save") | 
 |  |  |     @PostMapping("/locPreview/save") | 
 |  |  |     public R save(@RequestBody Loc loc) { | 
 |  |  |         if (Objects.isNull(loc.getWarehouseId())) { | 
 |  |  |             throw new CoolException("仓库ID不能为空!!"); | 
 |  |  | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:update')") | 
 |  |  |     @OperationLog("Update 库位信息表") | 
 |  |  |     @PostMapping("/loc/preview/update") | 
 |  |  |     @PostMapping("/locPreview/update") | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public R update(@RequestBody Loc loc) { | 
 |  |  |         loc.setUpdateBy(getLoginUserId()); | 
 |  |  | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:remove')") | 
 |  |  |     @OperationLog("Delete 库位信息表") | 
 |  |  |     @PostMapping("/loc/preview/remove/{ids}") | 
 |  |  |     @PostMapping("/locPreview/remove/{ids}") | 
 |  |  |     public R remove(@PathVariable Long[] ids) { | 
 |  |  |         if (!locService.removeByIds(Arrays.asList(ids))) { | 
 |  |  |             return R.error("Delete Fail"); | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:list')") | 
 |  |  |     @PostMapping("/loc/preview/query") | 
 |  |  |     @PostMapping("/locPreview/query") | 
 |  |  |     public R query(@RequestParam(required = false) String condition) { | 
 |  |  |         List<KeyValVo> vos = new ArrayList<>(); | 
 |  |  |         LambdaQueryWrapper<Loc> wrapper = new LambdaQueryWrapper<>(); | 
 |  |  | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:list')") | 
 |  |  |     @ApiOperation("库位导出") | 
 |  |  |     @PostMapping("/loc/preview/export") | 
 |  |  |     @PostMapping("/locPreview/export") | 
 |  |  |     public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { | 
 |  |  |         List<Loc> locs = new ArrayList<>(); | 
 |  |  |         if (Objects.isNull(map.get("ids"))) { | 
 |  |  | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:locPreview:update')") | 
 |  |  |     @ApiOperation("库位批量修改") | 
 |  |  |     @PostMapping("/loc/preview/modify") | 
 |  |  |     @PostMapping("/locPreview/modify") | 
 |  |  |     public R batchUpdate(@RequestBody LocModifyParams locs) { | 
 |  |  |         if (Objects.isNull(locs)) { | 
 |  |  |             throw new CoolException("参为不能为空!!"); |