鞍钢鲅鱼圈能源管控系统后端代码
潘志宝
2025-06-15 31ef4e5133bca08144d8c8bf1fa17edebfa96bed
ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/SyncDutyReportTask.java
@@ -61,13 +61,14 @@
                logger.info("responseStr is null");
                return;
            }
            logger.info("responseStr={}", responseStr);
            Map<String, BigDecimal> dataMap1 = new HashMap<>();
            Map<String, BigDecimal> dataMap2 = new HashMap<>();
            JSONArray jsonArray = JSONArray.parseArray(responseStr);
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                dataMap1.put(jsonObject.getString("nameIndex"), new BigDecimal(jsonObject.get("valAct").toString()));
                dataMap2.put(jsonObject.getString("nameIndex"), new BigDecimal(jsonObject.get("monthAvgValue").toString()));
                dataMap1.put(jsonObject.getString("cdeIndex"), new BigDecimal(jsonObject.get("valAct").toString()));
                dataMap2.put(jsonObject.getString("cdeIndex"), new BigDecimal(jsonObject.get("monthAvgValue").toString()));
            }
            List<DutyReportEntity> list = dutyReportService.list();
@@ -75,17 +76,24 @@
                logger.info("DutyReportEntity list is empty");
                return;
            }
            logger.info("DutyReportEntity list size={}", list.size());
            logger.info("dataMap1={}", JSONObject.toJSONString(dataMap1));
            logger.info("dataMap2={}", JSONObject.toJSONString(dataMap2));
            for (DutyReportEntity dutyReportEntity : list) {
                if (dataMap1.get(dutyReportEntity.getNameIndex()) != null && StringUtils.isNotBlank(dutyReportEntity.getPointNo1())) {
                if (dataMap1.get(dutyReportEntity.getCdeIndex()) != null && StringUtils.isNotBlank(dutyReportEntity.getPointNo1())) {
                    ApiPointValueWriteDTO writeDTO = new ApiPointValueWriteDTO();
                    writeDTO.setPointNo(dutyReportEntity.getPointNo1());
                    writeDTO.setValue(dataMap1.get(dutyReportEntity.getNameIndex()));
                    writeDTO.setValue(dataMap1.get(dutyReportEntity.getCdeIndex()));
                    logger.info("writeDTO={}", JSONObject.toJSONString(writeDTO));
                    dataPointApi.writePointRealValue(writeDTO);
                }
                if (dataMap2.get(dutyReportEntity.getNameIndex()) != null && StringUtils.isNotBlank(dutyReportEntity.getPointNo2())) {
                if (dataMap2.get(dutyReportEntity.getCdeIndex()) != null && StringUtils.isNotBlank(dutyReportEntity.getPointNo2())) {
                    ApiPointValueWriteDTO writeDTO = new ApiPointValueWriteDTO();
                    writeDTO.setPointNo(dutyReportEntity.getPointNo2());
                    writeDTO.setValue(dataMap2.get(dutyReportEntity.getNameIndex()));
                    writeDTO.setValue(dataMap2.get(dutyReportEntity.getCdeIndex()));
                    logger.info("writeDTO={}", JSONObject.toJSONString(writeDTO));
                    dataPointApi.writePointRealValue(writeDTO);
                }
            }