| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | public class BasStationController extends BaseController { |
| | |
| | | PageParam<BasStation, BaseParam> page = basStationService.page(pageParam, pageParam.buildWrapper(true)); |
| | | for (BasStation station : page.getRecords()) { |
| | | if (!Cools.isEmpty(station.getCrossZoneArea())) { |
| | | List<Long> longs1 = JSONObject.parseArray(station.getCrossZoneArea(), Long.class); |
| | | List<Long> longs1 = station.getCrossZoneArea().stream() |
| | | .map(Integer::longValue) |
| | | .collect(Collectors.toList()); |
| | | station.setAreaIds(longs1); |
| | | } |
| | | if (!Cools.isEmpty(station.getContainerType())) { |
| | | List<Long> longs1 = JSONObject.parseArray(station.getContainerType(), Long.class); |
| | | List<Long> longs1 = station.getContainerType().stream() |
| | | .map(Integer::longValue) |
| | | .collect(Collectors.toList()); |
| | | station.setContainerTypes(longs1); |
| | | } |
| | | |
| | | } |
| | | return R.ok().add(page); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:warehouseAreas:list')") |
| | | @PostMapping("/basStation/page/v1") |
| | | public R pagev22(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<BasStation, BaseParam> pageParam = new PageParam<>(baseParam, BasStation.class); |
| | | return R.ok().add(basStationService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:basStation:list')") |
| | |
| | | public R get(@PathVariable("id") Long id) { |
| | | BasStation station = basStationService.getById(id); |
| | | if (!Cools.isEmpty(station.getCrossZoneArea())) { |
| | | List<Long> longs1 = JSONObject.parseArray(station.getCrossZoneArea(), Long.class); |
| | | List<Long> longs1 = station.getCrossZoneArea().stream() |
| | | .map(Integer::longValue) |
| | | .collect(Collectors.toList()); |
| | | station.setAreaIds(longs1); |
| | | } |
| | | if (!Cools.isEmpty(station.getContainerType())) { |
| | | List<Long> longs1 = JSONObject.parseArray(station.getContainerType(), Long.class); |
| | | List<Long> longs1 = station.getContainerType().stream() |
| | | .map(Integer::longValue) |
| | | .collect(Collectors.toList()); |
| | | station.setContainerTypes(longs1); |
| | | } |
| | | |
| | |
| | | return R.error(basStation.getStationName()+"站已被初始化"); |
| | | } |
| | | if (null !=basStation.getAreaIds()){ |
| | | basStation.setCrossZoneArea(basStation.getAreaIds().toString()); |
| | | basStation.setCrossZoneArea(basStation.getAreaIds().stream() |
| | | .map(Long::intValue) |
| | | .collect(Collectors.toList())); |
| | | } |
| | | if (null !=basStation.getContainerTypes()){ |
| | | basStation.setContainerType(basStation.getContainerTypes().toString()); |
| | | basStation.setContainerType(basStation.getContainerTypes().stream() |
| | | .map(Long::intValue) |
| | | .collect(Collectors.toList())); |
| | | } |
| | | if (Cools.isEmpty(basStation.getStationAlias())){ |
| | | basStation.setStationAlias(new ArrayList<>()); |
| | | basStation.getStationAlias().add(basStation.getStationName()); |
| | | } else if (!basStation.getStationAlias().contains(basStation.getStationName())){ |
| | | basStation.getStationAlias().add(basStation.getStationName()); |
| | | } |
| | | if (!basStationService.save(basStation)) { |
| | | return R.error("保存失败"); |
| | |
| | | basStation.setUpdateBy(getLoginUserId()); |
| | | basStation.setUpdateTime(new Date()); |
| | | if (null !=basStation.getAreaIds() && !basStation.getContainerTypes().isEmpty()){ |
| | | basStation.setCrossZoneArea(basStation.getAreaIds().toString()); |
| | | basStation.setCrossZoneArea(basStation.getAreaIds().stream() |
| | | .map(Long::intValue) |
| | | .collect(Collectors.toList())); |
| | | } |
| | | if (null != basStation.getContainerTypes() && !basStation.getContainerTypes().isEmpty()){ |
| | | basStation.setContainerType(basStation.getContainerTypes().toString()); |
| | | basStation.setContainerType(basStation.getContainerTypes().stream() |
| | | .map(Long::intValue) |
| | | .collect(Collectors.toList())); |
| | | } |
| | | if (null !=basStation.getUseStatus() && basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)){ |
| | | basStation.setBarcode(null); |
| | | } |
| | | if (Cools.isEmpty(basStation.getStationAlias())){ |
| | | basStation.setStationAlias(new ArrayList<>()); |
| | | basStation.getStationAlias().add(basStation.getStationName()); |
| | | } else if (!basStation.getStationAlias().contains(basStation.getStationName())){ |
| | | basStation.getStationAlias().add(basStation.getStationName()); |
| | | } |
| | | if (!basStationService.updateById(basStation)) { |
| | | return R.error("更新失败"); |
| | | } |