1
zhangc
2025-04-12 113eae78a64aa836f7b6aad86525cc6f053fd561
src/main/java/com/zy/core/thread/impl/FyDevpThread.java
@@ -185,14 +185,21 @@
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId()));
            // 根据实时信息更新数据库
            try {
                BasDevpService basConveyorStaService = SpringUtils.getBean(BasDevpService.class);
                List<BasDevp> stations = new ArrayList<>();
                for (Integer sta : staNos2) {
                    StaProtocol staProtocol = station.get(sta);
                    BasDevp sqlModel = staProtocol.toSqlModel();
                    stations.add(sqlModel);
                    //暂时写入数据库
                    BasDevp basDevp = basConveyorStaService.selectById(sta);
                    if (basDevp == null) {
                        basConveyorStaService.insert(sqlModel);
                    }
                }
                if (!stations.isEmpty()) {
                    BasDevpService basConveyorStaService = SpringUtils.getBean(BasDevpService.class);
                    if (null != basConveyorStaService && !basConveyorStaService.updateBatchById(stations)) {
                        throw new Exception("更新数据库数据失败");
                    }