|  |  | 
 |  |  | package com.vincent.rsf.server.manager.controller; | 
 |  |  |  | 
 |  |  | 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; | 
 |  |  | 
 |  |  | import com.vincent.rsf.server.common.domain.KeyValVo; | 
 |  |  | import com.vincent.rsf.server.common.domain.PageParam; | 
 |  |  | import com.vincent.rsf.server.manager.entity.BasStation; | 
 |  |  | import com.vincent.rsf.server.manager.enums.LocStsType; | 
 |  |  | import com.vincent.rsf.server.manager.service.BasStationService; | 
 |  |  | import com.vincent.rsf.server.system.controller.BaseController; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | 
 |  |  |         PageParam<BasStation, BaseParam> pageParam = new PageParam<>(baseParam, BasStation.class); | 
 |  |  |         PageParam<BasStation, BaseParam> page = basStationService.page(pageParam, pageParam.buildWrapper(true)); | 
 |  |  |         for (BasStation station : page.getRecords()) { | 
 |  |  |             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()); | 
 |  |  |             if (!Cools.isEmpty(station.getCrossZoneArea())) { | 
 |  |  |                 List<Long> longs1 = JSONObject.parseArray(station.getCrossZoneArea(), Long.class); | 
 |  |  |                 station.setAreaIds(longs1); | 
 |  |  |             } | 
 |  |  |             station.setAreaIds(longArray); | 
 |  |  |             if (!Cools.isEmpty(station.getContainerType())) { | 
 |  |  |                 List<Long> longs1 = JSONObject.parseArray(station.getContainerType(), Long.class); | 
 |  |  |                 station.setContainerTypes(longs1); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         return R.ok().add(page); | 
 |  |  |     } | 
 |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:basStation:list')") | 
 |  |  |     @GetMapping("/basStation/{id}") | 
 |  |  |     public R get(@PathVariable("id") Long id) { | 
 |  |  |         BasStation basStation = basStationService.getById(id); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         String content = basStation.getCrossZoneArea().substring(1, basStation.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()); | 
 |  |  |         BasStation station = basStationService.getById(id); | 
 |  |  |         if (!Cools.isEmpty(station.getCrossZoneArea())) { | 
 |  |  |             List<Long> longs1 = JSONObject.parseArray(station.getCrossZoneArea(), Long.class); | 
 |  |  |             station.setAreaIds(longs1); | 
 |  |  |         } | 
 |  |  |         basStation.setAreaIds(longArray); | 
 |  |  |         if (!Cools.isEmpty(station.getContainerType())) { | 
 |  |  |             List<Long> longs1 = JSONObject.parseArray(station.getContainerType(), Long.class); | 
 |  |  |             station.setContainerTypes(longs1); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return R.ok().add(basStation); | 
 |  |  |         return R.ok().add(station); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('manager:basStation:save')") | 
 |  |  | 
 |  |  |         if (!Cools.isEmpty(serviceOne)) { | 
 |  |  |             return R.error(basStation.getStationName()+"站已被初始化"); | 
 |  |  |         } | 
 |  |  |         if (null !=basStation.getAreaIds()){ | 
 |  |  |             basStation.setCrossZoneArea(basStation.getAreaIds().toString()); | 
 |  |  |         } | 
 |  |  |         if (null !=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.getContainerTypes().isEmpty()){ | 
 |  |  |             basStation.setContainerType(basStation.getContainerTypes().toString()); | 
 |  |  |         } | 
 |  |  |         if (null !=basStation.getUseStatus() && basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)){ | 
 |  |  |             basStation.setBarcode(null); | 
 |  |  |         } | 
 |  |  |         if (!basStationService.updateById(basStation)) { | 
 |  |  |             return R.error("更新失败"); |