| | |
| | | YearMonth yearMonth = YearMonth.of(today.getYear(), today.getMonthValue()); |
| | | int lengthOfMonth = yearMonth.lengthOfMonth(); |
| | | List<ChartParamDTO> chartParamList = mcsApi.getChartParamList(params); |
| | | logger.info("当前月天数:" + lengthOfMonth); |
| | | chartParamList.forEach(chartParam -> { |
| | | logger.info("指标编码:" + chartParam.getParamCode()); |
| | | List<ApiIndItemValueDTO> indItemlist = indItemApi.queryIndItemDefaultValue(chartParam.getParamCode()); |
| | | logger.info("查询到的指标值:" + indItemlist); |
| | | if (indItemlist != null && indItemlist.size() > 0) { |
| | | ApiPointValueWriteDTO apiPointValueWriteDTO = new ApiPointValueWriteDTO(); |
| | | apiPointValueWriteDTO.setPointNo(chartParam.getParamValue()); |
| | | BigDecimal indValue = (BigDecimal) indItemlist.get(0).getDataValue(); |
| | | BigDecimal pointValue = indValue.divide(new BigDecimal(lengthOfMonth), 3, RoundingMode.HALF_UP); |
| | | apiPointValueWriteDTO.setValue(pointValue); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | try { |
| | | ApiPointValueWriteDTO apiPointValueWriteDTO = new ApiPointValueWriteDTO(); |
| | | apiPointValueWriteDTO.setPointNo(chartParam.getParamValue()); |
| | | BigDecimal indValue = BigDecimal.valueOf((Double) indItemlist.get(0).getDataValue()); |
| | | logger.info("指标值:" + indValue); |
| | | BigDecimal pointValue = indValue.divide(new BigDecimal(lengthOfMonth), 3, RoundingMode.HALF_UP); |
| | | logger.info("测点值:" + pointValue); |
| | | apiPointValueWriteDTO.setValue(pointValue); |
| | | logger.info("写入测点值:" + apiPointValueWriteDTO); |
| | | dataPointApi.writePointRealValue(apiPointValueWriteDTO); |
| | | }catch (Exception ex){ |
| | | logger.error("SaveIndDataToPointDataTask运行异常" + ex); |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | |