| | |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.BasMap; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.entity.DeviceConfig; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.BasMapService; |
| | |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.service.BasStationService; |
| | | import com.zy.asrs.service.DeviceConfigService; |
| | | import com.zy.asrs.utils.MapExcelUtils; |
| | | import com.zy.common.utils.RedisUtil; |
| | |
| | | private DeviceConfigService deviceConfigService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private MapExcelUtils mapExcelUtils; |
| | | @Autowired |
| | | private BasStationService basStationService; |
| | | |
| | | @RequestMapping(value = "/basMap/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok().add(levList); |
| | | } |
| | | |
| | | @Autowired |
| | | private MapExcelUtils mapExcelUtils; |
| | | |
| | | @PostMapping("/basMap/crn/upload") |
| | | public R uploadExcel(@RequestParam("file") MultipartFile file) throws IOException { |
| | | // 保存上传的文件到临时位置 |
| | |
| | | StationObjModel stationObjModel = new StationObjModel(); |
| | | stationObjModel.setDeviceNo(deviceNo); |
| | | stationObjModel.setStationId(value.getInteger("stationId")); |
| | | stationObjModel.setStationLev(lev); |
| | | |
| | | List<StationObjModel> stationList = deviceStationMap.getOrDefault(deviceNo, new ArrayList<>()); |
| | | stationList.add(stationObjModel); |
| | |
| | | basMap.setUpdateTime(new Date()); |
| | | basMap.setLev(lev); |
| | | basMapService.insertOrUpdate(basMap); |
| | | |
| | | } |
| | | |
| | | basStationService.delete(new EntityWrapper<>()); |
| | | |
| | | deviceStationMap.forEach((deviceNo, stationList) -> { |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("devp_no", deviceNo)); |
| | |
| | | deviceConfig.setFakeInitStatus(JSON.toJSONString(stationList)); |
| | | deviceConfigService.updateById(deviceConfig); |
| | | } |
| | | |
| | | for (StationObjModel stationObjModel : stationList) { |
| | | BasStation basStation = new BasStation(); |
| | | basStation.setStationId(stationObjModel.getStationId()); |
| | | basStation.setDeviceNo(stationObjModel.getDeviceNo()); |
| | | basStation.setStationLev(stationObjModel.getStationLev()); |
| | | basStation.setCreateTime(new Date()); |
| | | basStation.setStatus(1); |
| | | basStationService.insert(basStation); |
| | | } |
| | | }); |
| | | return R.ok(); |
| | | } |