|  |  |  | 
|---|
|  |  |  | package com.vincent.rsf.server.manager.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.Cools; | 
|---|
|  |  |  | 
|---|
|  |  |  | PageParam<BasStation, BaseParam> page = basStationService.page(pageParam, pageParam.buildWrapper(true)); | 
|---|
|  |  |  | for (BasStation station : page.getRecords()) { | 
|---|
|  |  |  | if (!Cools.isEmpty(station.getCrossZoneArea())) { | 
|---|
|  |  |  | String content = station.getCrossZoneArea().substring(1, station.getCrossZoneArea().length() - 1); | 
|---|
|  |  |  | String[] parts = content.split(","); | 
|---|
|  |  |  | Long[] longArray = new Long[parts.length]; | 
|---|
|  |  |  | for (int i = 0; i < parts.length; i++) { | 
|---|
|  |  |  | longArray[i] = Long.parseLong(parts[i].trim()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | station.setAreaIds(longArray); | 
|---|
|  |  |  | List<Long> longs1 = JSONObject.parseArray(station.getCrossZoneArea(), Long.class); | 
|---|
|  |  |  | station.setAreaIds(longs1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(station.getContainerType())) { | 
|---|
|  |  |  | String content = station.getContainerType().substring(1, station.getContainerType().length() - 1); | 
|---|
|  |  |  | String[] parts = content.split(","); | 
|---|
|  |  |  | Long[] longArray = new Long[parts.length]; | 
|---|
|  |  |  | for (int i = 0; i < parts.length; i++) { | 
|---|
|  |  |  | longArray[i] = Long.parseLong(parts[i].trim()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | station.setContainerTypes(longArray); | 
|---|
|  |  |  | List<Long> longs1 = JSONObject.parseArray(station.getContainerType(), Long.class); | 
|---|
|  |  |  | station.setContainerTypes(longs1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @GetMapping("/basStation/{id}") | 
|---|
|  |  |  | public R get(@PathVariable("id") Long id) { | 
|---|
|  |  |  | BasStation station = basStationService.getById(id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(station.getCrossZoneArea())) { | 
|---|
|  |  |  | String content = station.getCrossZoneArea().substring(1, station.getCrossZoneArea().length() - 1); | 
|---|
|  |  |  | String[] parts = content.split(","); | 
|---|
|  |  |  | Long[] longArray = new Long[parts.length]; | 
|---|
|  |  |  | for (int i = 0; i < parts.length; i++) { | 
|---|
|  |  |  | longArray[i] = Long.parseLong(parts[i].trim()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | station.setAreaIds(longArray); | 
|---|
|  |  |  | List<Long> longs1 = JSONObject.parseArray(station.getCrossZoneArea(), Long.class); | 
|---|
|  |  |  | station.setAreaIds(longs1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(station.getContainerType())) { | 
|---|
|  |  |  | String content = station.getContainerType().substring(1, station.getContainerType().length() - 1); | 
|---|
|  |  |  | String[] parts = content.split(","); | 
|---|
|  |  |  | Long[] longArray = new Long[parts.length]; | 
|---|
|  |  |  | for (int i = 0; i < parts.length; i++) { | 
|---|
|  |  |  | longArray[i] = Long.parseLong(parts[i].trim()); | 
|---|
|  |  |  | List<Long> longs1 = JSONObject.parseArray(station.getContainerType(), Long.class); | 
|---|
|  |  |  | station.setContainerTypes(longs1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | station.setContainerTypes(longArray); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok().add(station); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.error(basStation.getStationName()+"站已被初始化"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null !=basStation.getAreaIds()){ | 
|---|
|  |  |  | basStation.setCrossZoneArea(Arrays.toString(basStation.getAreaIds())); | 
|---|
|  |  |  | basStation.setCrossZoneArea(basStation.getAreaIds().toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null !=basStation.getContainerTypes()){ | 
|---|
|  |  |  | basStation.setContainerType(Arrays.toString(basStation.getContainerTypes())); | 
|---|
|  |  |  | basStation.setContainerType(basStation.getContainerTypes().toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!basStationService.save(basStation)) { | 
|---|
|  |  |  | return R.error("保存失败"); | 
|---|
|  |  |  | 
|---|
|  |  |  | public R update(@RequestBody BasStation basStation) { | 
|---|
|  |  |  | basStation.setUpdateBy(getLoginUserId()); | 
|---|
|  |  |  | basStation.setUpdateTime(new Date()); | 
|---|
|  |  |  | if (null !=basStation.getAreaIds()){ | 
|---|
|  |  |  | basStation.setCrossZoneArea(Arrays.toString(basStation.getAreaIds())); | 
|---|
|  |  |  | if (null !=basStation.getAreaIds() && !basStation.getContainerTypes().isEmpty()){ | 
|---|
|  |  |  | basStation.setCrossZoneArea(basStation.getAreaIds().toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null !=basStation.getContainerTypes()){ | 
|---|
|  |  |  | basStation.setContainerType(Arrays.toString(basStation.getContainerTypes())); | 
|---|
|  |  |  | if (null != basStation.getContainerTypes() && !basStation.getContainerTypes().isEmpty()){ | 
|---|
|  |  |  | basStation.setContainerType(basStation.getContainerTypes().toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (null !=basStation.getUseStatus() && basStation.getUseStatus().equals(StaUseStatusType.TYPE_O.type)){ | 
|---|
|  |  |  | basStation.setBarcode(null); | 
|---|